I setup Postgres Master to master replication using bucardo a few days back. It was working good till yesterday until I found an extremely rare issue. The issue was as follows. one table has auto-generated primary key. Someone Inserted a record in Master-1 Table. At the same time someone I inserted a record in Master-2 Table. I think both got the same ID and at last both Master had data which was inserted on Master 2.
Bucardo works on basis of triggers. If Master-1 data was inserted first then it should be replicated on Master-2 as well and Master-2 should have inserted Data with 1 incremented ID. I thought a lot but didn't find any satisfactory answer.
How can we avoid these type of situations?