Page 1 of 1

Galera support ?

Posted: Wed Feb 20, 2019 9:01 pm
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.

Re: Galera support ?

Posted: Wed Feb 20, 2019 9:28 pm
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).

Re: Galera support ?

Posted: Tue Jan 31, 2023 2:28 pm
by bovnet
Ive used it for both database replication and an attempt to reduce bottleneck on multiserver setup
Would these missing keys cause issues ?

Re: Galera support ?

Posted: Wed Feb 01, 2023 8:30 am
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)