Hi Folks,

Currently I am really curious about Sequoia. The theory sounds fine and the
whole project seems very well documented.

But there's one question that came up my mind concerning the primary keys
generated with SERIAL or BIGSERIAL data types.

Generally, we're building a webapp based on
Java1.6/Spring/Hibernate/PostgreSQL.

If we've got a RAIDb-1 config (multi-master-replication), how can I ensure,
that Hibernate will fetch the right serial number from the sequence of
postgres on the single database instances?

Hibernate is configured to get the nextval() from the sequences, but is it
ensured that all othger instances return the same value from the instances?
The following case:

DB1, table t1 has a sequence s1, currently at 350.
DB2, table t2 has a sequence s2, currently at 350 as well.

Now, Sequoia asks DB1 to return the value of s1   which is now 351. In the
meantime, Another thread asks Sequoia again for a next value. As DB1
currently has more load Seq. Asks DB2 for a value. During the meantime, the
increase of s1 could not happen and DB2 returns 351 as well. So sooner or
later, both new datasets for table t1 will have a duplicate PK which is not
something I would like to see ;-)
So, is there any chance to walk-around this problem? Or is there a native
soluation by sequoia?

What happens if we increment a sequence by 100 on one databse - is this
allowed? Will this crash the system? I am surely not the only person
encountering this problem :-)

Any hint will be much appreciated.

Kind regards from Germany!

_______________________________________________
Sequoia mailing list
Sequoia@lists.forge.continuent.org
https://forge.continuent.org/mailman/listinfo/sequoia

Reply via email to