Hi Jan-Hendrik,
There has been a couple of posts on the list about PostgreSQL and sequences.
The basic idea is that calls to setval/nextval must be broadcast. There
are basically 2 options:
- modify the Hibernate dialect as explained in
http://sequoia.continuent.org/doc/latest/userGuide/ar01s06.html (see
section 6.7)
- update the Sequoia SQL parser regular expression. You can find more
details about this in this post:
http://www.mail-archive.com/sequoia@lists.forge.continuent.org/msg03691.html
Thanks for your interest in Sequoia,
Emmanuel
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!
--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: m...@frogthinker.org
Skype: emmanuel_cecchet
_______________________________________________
Sequoia mailing list
Sequoia@lists.forge.continuent.org
https://forge.continuent.org/mailman/listinfo/sequoia