Not the answer you need?
Register and ask your own question!

Table with auto increment primary key and unique constraint

snpesnpe EntrantCurrent User Role Beginner
I have a table with auto increment primary key (id int not null auto_increment) and separate unique key (type, related_id).
The table is loaded with a background jobs. All servers can create a row in table.
Sometimes, it happens that two servers create a row with different PK and the same UK.
Standard MySQL replication throws error 1062 (duplicate keys).
Can Persona cluster solve such conflict automatically?

Comments

  • krunalbauskarkrunalbauskar Advisor Inactive User Role Novice
    Yes.

    PXC has concept of conflict resolution.

    Say 2 nodes tries to generate conflicting rows then first node to generate the row will win.
    Even if second node generates the row and it is replicated it will be rejected during PXC certification.
  • snpesnpe Entrant Current User Role Beginner
    krunalbauskar thanks. I will try PXC.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.