Hello Emmanuel,

I was teasting again today and found the following out:

When I do a SELECT nextval('SEQ_NAME') on ALLE Backends there will be an
increase of the sequence. So i guess that Sequoia already broadcasts this
kind of statement to the database, doesn't it?

Your both posts helped me, though. I already found that one about hibernate
and think that sequoia might help us a lot. Hope that Sequioa is able to
handle some thousand reqeusts per second ;-)


Keep on with that great work!

Jan

Am 27.02.09 18:00 schrieb "[email protected]" unter
<[email protected]>:

> 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/[email protected]/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!
>> 
>>   

_______________________________________________
Sequoia mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/sequoia

Reply via email to