Skip site navigation (1) Skip section navigation (2)

UUIDs generated using ossp-uuid on windows not unique

From: Meetesh Karia <meetesh(dot)karia(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: UUIDs generated using ossp-uuid on windows not unique
Date: 2008-06-16 17:03:09
Message-ID: 48569CCD.3040600@gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Hi all,

This may not be the appropriate list to discuss this on (since it looks 
like the bug is in the underlying library), but as the win32 port was 
done because of postgresql (as far as I can tell), I wanted to see if 
anyone had run into this and/or had any workarounds:

As best as I can tell, the problem is caused because generation of v1 
UUIDs uses GetSystemTimeAsFileTime which is stated to have a resolution 
of 100 nanoseconds but in practice has a resolution of around 15ms 
(http://www.ddj.com/showArticle.jhtml?documentID=win0305a&pgno=17).

Here's a snippet from log of id creation from a java app using Hibernate 
on 32-bit Windows Vista Home Premium:

17:59:50,007 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 400770c0-3bbd-11dd-9dcb-bfe9e8f8c4e3
17:59:50,016 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 4008d050-3bbd-11dd-bcfd-efd9d1bca81a
17:59:50,017 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 4008f760-3bbd-11dd-86d8-3b7fffcb1fd0
17:59:50,018 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 40091e70-3bbd-11dd-a129-c3ff008d4230

17:59:50,019 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 40094580-3bbd-11dd-91d4-3f3c34e3d932
17:59:50,020 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 40094580-3bbd-11dd-91d4-3f3c34e3d932

17:59:50,101 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 4015a190-3bbd-11dd-9639-9b73321c2f74
17:59:50,109 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 4016da10-3bbd-11dd-91d7-df8cd7608cfc
17:59:50,118 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 401860b0-3bbd-11dd-8ff9-5f0d982e530e
17:59:50,129 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 4019e750-3bbd-11dd-8e23-2315e240bab8
17:59:50,130 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 401a3570-3bbd-11dd-9af2-8350eef5ace8
17:59:50,131 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 401a5c80-3bbd-11dd-b91d-1fb0760aeab8
17:59:50,132 DEBUG [main][org.hibernate.id.GUIDGenerator] GUID 
identifier generated: 401a5c80-3bbd-11dd-b91d-1fb0760aeab8


Thoughts?  Has anyone run into this before?  Worked around it?

Thanks,
Meetesh

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-06-16 18:25:17
Subject: Re: UUIDs generated using ossp-uuid on windows not unique
Previous:From: Anoo Sivadasan PillaiDate: 2008-06-16 09:39:28
Subject: Re: initdb bug report

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group