Galera support ?

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
lbm
Posts: 87
Joined: Mon Mar 26, 2018 7:44 pm

Galera support ?

Post by lbm »

Hi,

Im looking into Galera, and I can see that a couple of tables doesn't have primary Keys.
E.g Stats and Logs

Code: Select all

MariaDB [zm]> desc Stats;
+--------------+----------------------+------+-----+---------+-------+
| Field        | Type                 | Null | Key | Default | Extra |
+--------------+----------------------+------+-----+---------+-------+
| MonitorId    | int(10) unsigned     | NO   | MUL | 0       |       |
| ZoneId       | int(10) unsigned     | NO   | MUL | 0       |       |
| EventId      | int(10) unsigned     | NO   | MUL | 0       |       |
| FrameId      | int(10) unsigned     | NO   |     | 0       |       |
| PixelDiff    | tinyint(3) unsigned  | NO   |     | 0       |       |
| AlarmPixels  | int(10) unsigned     | NO   |     | 0       |       |
| FilterPixels | int(10) unsigned     | NO   |     | 0       |       |
| BlobPixels   | int(10) unsigned     | NO   |     | 0       |       |
| Blobs        | smallint(5) unsigned | NO   |     | 0       |       |
| MinBlobSize  | int(10) unsigned     | NO   |     | 0       |       |
| MaxBlobSize  | int(10) unsigned     | NO   |     | 0       |       |
| MinX         | smallint(5) unsigned | NO   |     | 0       |       |
| MaxX         | smallint(5) unsigned | NO   |     | 0       |       |
| MinY         | smallint(5) unsigned | NO   |     | 0       |       |
| MaxY         | smallint(5) unsigned | NO   |     | 0       |       |
| Score        | smallint(5) unsigned | NO   |     | 0       |       |
+--------------+----------------------+------+-----+---------+-------+
16 rows in set (0.00 sec)

Code: Select all

+-----------+----------------------+------+-----+---------+-------+
| Field     | Type                 | Null | Key | Default | Extra |
+-----------+----------------------+------+-----+---------+-------+
| TimeKey   | decimal(16,6)        | NO   | MUL | NULL    |       |
| Component | varchar(32)          | NO   |     | NULL    |       |
| ServerId  | int(10) unsigned     | YES  |     | NULL    |       |
| Pid       | int(10)              | YES  |     | NULL    |       |
| Level     | tinyint(3)           | NO   |     | NULL    |       |
| Code      | char(3)              | NO   |     | NULL    |       |
| Message   | text                 | NO   |     | NULL    |       |
| File      | varchar(255)         | YES  |     | NULL    |       |
| Line      | smallint(5) unsigned | YES  |     | NULL    |       |
+-----------+----------------------+------+-----+---------+-------+
9 rows in set (0.00 sec)
Im aware that I can most likely just alter the table with an unique autoincrement primary key, but are there any plans on "official" Galera support ?
Notice this also applies for percona + extradb.
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Galera support ?

Post by iconnor »

Really... all tables should have primary keys... you can add them yourself and they should not affect anything.

We will get around to adding them ourselves soon.

No there hasn't been any thought about Galera/Percona et al. I don't even really know what they are or why I would care. (goes now to google).
bovnet
Posts: 38
Joined: Tue Jun 28, 2005 9:53 pm

Re: Galera support ?

Post by bovnet »

Ive used it for both database replication and an attempt to reduce bottleneck on multiserver setup
Would these missing keys cause issues ?
lbm
Posts: 87
Joined: Mon Mar 26, 2018 7:44 pm

Re: Galera support ?

Post by lbm »

You might run into issues where the data on the nodes are different if they are not there..

See: https://mariadb.com/kb/en/mariadb-galer ... mitations/

For me the Stats and Logs tables now look like this. Its many years ago I've found this issue, so I cannot remember if I did an alter table and added the id's myself. I think I've might have.

Code: Select all

MariaDB [zm]> desc Stats;
+--------------+----------------------+------+-----+---------+----------------+
| Field        | Type                 | Null | Key | Default | Extra          |
+--------------+----------------------+------+-----+---------+----------------+
| MonitorId    | int(10) unsigned     | NO   | MUL | 0       |                |
| ZoneId       | int(10) unsigned     | NO   | MUL | 0       |                |
| EventId      | bigint(20) unsigned  | NO   | MUL | NULL    |                |
| FrameId      | int(10) unsigned     | NO   |     | 0       |                |
| PixelDiff    | tinyint(3) unsigned  | NO   |     | 0       |                |
| AlarmPixels  | int(10) unsigned     | NO   |     | 0       |                |
| FilterPixels | int(10) unsigned     | NO   |     | 0       |                |
| BlobPixels   | int(10) unsigned     | NO   |     | 0       |                |
| Blobs        | smallint(5) unsigned | NO   |     | 0       |                |
| MinBlobSize  | int(10) unsigned     | NO   |     | 0       |                |
| MaxBlobSize  | int(10) unsigned     | NO   |     | 0       |                |
| MinX         | smallint(5) unsigned | NO   |     | 0       |                |
| MaxX         | smallint(5) unsigned | NO   |     | 0       |                |
| MinY         | smallint(5) unsigned | NO   |     | 0       |                |
| MaxY         | smallint(5) unsigned | NO   |     | 0       |                |
| Score        | smallint(5) unsigned | NO   |     | 0       |                |
| id           | int(11)              | NO   | PRI | NULL    | auto_increment |
+--------------+----------------------+------+-----+---------+----------------+
17 rows in set (0.407 sec)

MariaDB [zm]> desc Logs;
+-----------+----------------------+------+-----+---------+----------------+
| Field     | Type                 | Null | Key | Default | Extra          |
+-----------+----------------------+------+-----+---------+----------------+
| TimeKey   | decimal(16,6)        | NO   | MUL | NULL    |                |
| Component | varchar(32)          | NO   |     | NULL    |                |
| ServerId  | int(10) unsigned     | YES  |     | NULL    |                |
| Pid       | int(10)              | YES  |     | NULL    |                |
| Level     | tinyint(3)           | NO   | MUL | NULL    |                |
| Code      | char(3)              | NO   |     | NULL    |                |
| Message   | text                 | NO   |     | NULL    |                |
| File      | varchar(255)         | YES  |     | NULL    |                |
| Line      | smallint(5) unsigned | YES  |     | NULL    |                |
| id        | int(11)              | NO   | PRI | NULL    | auto_increment |
+-----------+----------------------+------+-----+---------+----------------+
10 rows in set (0.001 sec)
Post Reply