Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jrglasgow created an issue. See original summary.

jrglasgow’s picture

here is a patch that will add an extra auto incrementing id column to each of the above tables and set it as the primary key.

Status: Needs review » Needs work

The last submitted patch, 2: primary_key_doesn_t-2701449-2.patch, failed testing.

fizk’s picture

What issues were you trying to fix by creating a primary key for those tables?

trevorw’s picture

Running any of the Galera cluster products from MariaDB, Percona, etc ... all tables require a primary key.

trevorw’s picture

patched worked fine for me, easy add. Thx

joaocsilva’s picture

The patch does not apply due to the hook_update number, I'm increasing it by one.

joaocsilva’s picture

According to this page https://www.drupal.org/node/2615496 , adding a new serial field on an existing table can fail on some databases, as a workaround we can create first a int field and change it to serial.
I am uploading a new patch.

joaocsilva’s picture

Status: Needs work » Needs review
jenlampton’s picture

Thanks for this fix @joaocsilva, can you tell me what I need to do to test this patch? How can I reproduce the problem this fixes? Thanks!

ccarnnia’s picture

Hello @jenlampton.
one of nodequue table is nodequeue_NODES.

before the patch:

mysql> describe nodequeue_nodes;
+-----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| qid | int(10) unsigned | NO | MUL | NULL | |
| sqid | int(10) unsigned | NO | MUL | NULL | |
| nid | int(10) unsigned | YES | MUL | NULL | |
| position | int(10) unsigned | YES | | NULL | |
| timestamp | int(10) unsigned | NO | | 0 | |
+-----------+------------------+------+-----+---------+-------+

after the patch:

mysql> describe nodequeue_nodes;
+-----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+----------------+
| qid | int(10) unsigned | NO | MUL | NULL | |
| sqid | int(10) unsigned | NO | MUL | NULL | |
| nid | int(10) unsigned | YES | MUL | NULL | |
| position | int(10) unsigned | YES | | NULL | |
| timestamp | int(10) unsigned | NO | | 0 | |
| id | int(11) | NO | PRI | NULL | auto_increment |
+-----------+------------------+------+-----+---------+----------------+

as you can see a 6th column named id that auto increments has been added.

jenlampton’s picture

Thanks @ccarnnia, I was able to see the result of the patch is that a primary key was added, but I was wondering how to reproduce a problem caused by not having a primary key. Do you have any examples of how I might encounter one of those problems?