Auto number next value of identity column skips numbers

84 views
Skip to first unread message

Meni Hillel

unread,
May 24, 2015, 6:46:17 PM5/24/15
to h2-da...@googlegroups.com, thomas.to...@gmail.com
Hi,

I am encountering an issue with auto increment identity field. It seems that if multiple concurrent transaction happens all at once, the number generate is not being incremented correctly (+1). Instead, it starts at 1,then jumps to 349 if the transactions are committed 4 milliseconds apart. It seems that if transaction are not concurrent, behavior is correct.

This is my JDBC connection string jdbc:h2:./myDB;MVCC=TRUE;LOCK_TIMEOUT=10000;

Please let me know what additional information you need to diagnose.


Thanks,
Meni

Jose Schiavon

unread,
May 25, 2015, 10:16:43 AM5/25/15
to h2-da...@googlegroups.com, thomas.to...@gmail.com
This has been discussed in Stack Overflow
Hope this helps

Meni Hillel

unread,
May 25, 2015, 1:45:22 PM5/25/15
to h2-da...@googlegroups.com, Thomas Mueller
Thanks Jose.

I saw this issue and I did not think it applied to me. In my case, it does not skip in 32, there was no crash. I think the cause in my case is related to concurrency.

Meni

--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/hlOv0vqqdt8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Thomas Mueller

unread,
May 26, 2015, 1:43:45 AM5/26/15
to Meni Hillel, H2 Google Group
Hi,

Could you provide a simple, small, reproducible test case please?

Regards,
Thomas

Meni Hillel

unread,
May 26, 2015, 2:23:04 AM5/26/15
to Thomas Mueller, H2 Google Group
Since it is very timing sensitive, it does not always happen. I would imagine that a multi-threaded transactions that attempts to create the same record in a table would reproduce it.

Meni

Thomas Mueller

unread,
May 26, 2015, 2:32:54 PM5/26/15
to Meni Hillel, H2 Google Group
Hi,

OK, this is a description of a test, but I can not reproduce it like this. I would need a simple, small, reproducible test case.

Regards,
Thomas


Reply all
Reply to author
Forward
0 new messages