[Ur] MySQL+InnoDB-backed sequences reset on database restart

Adam Chlipala adamc at csail.mit.edu
Wed Jul 17 10:08:48 EDT 2013


Thanks for the patch!

Unfortunately, I don't think this alternative is going to work correctly 
in the presence of concurrency.  Two threads could simultaneously decide 
to assign themselves the same ID.  The latest Postgres versions support 
true serializable transactions, such that the approach you use would 
work, but I've tested MySQL 5.1 and verified that it allows the bad 
behavior.  Maybe newer MySQL versions do better, but I'm skeptical.

P.S.: A meta-level reminder for folks submitting patches: I think it 
works best to generate patches with the 'hg export' command, to save 
authorship information & commit message for easy importation into 
Mercurial repositories.

P.P.S.: Sorry for the delayed response.  Big conference paper deadline 
last week!

On 07/09/2013 07:25 PM, Istvan Chung wrote:
> Alright, I've done just this, reimplementing sequences for MySQL only
> by patching "mysql.sml". Hopefully it functions as intended.
>
> On 06/14/2013 02:13 PM, Istvan Chung wrote:
>    
>> Well, another option could be to just maintain our own counter and
>>   increment it manually, forgoing AUTO_INCREMENT entirely.
>>      




More information about the Ur mailing list