"Sorry for the discussion" for me, this discussion is interesting and important because I need a solution. :-) Thank you for the discussion!
I tried following ideas but they have been up to 4 times slower than the original: 1) I tried to remember the last seed in an inst var of UUIDGenerator and create it new if it was the same as the last one. 2) wait for 1 millisecond before create new seed. As third, I tried adding a (random nextInt: 100000). This did not work, there have been also doouble numbers. So, perhaps the counter is a good idea but is it fast? Again, I work on windows and so I get nil as answer to makeUnixSeed. makeSeed | seed | seed := self makeUnixSeed. seed ifNotNil: [^seed]. [seed := (Time millisecondClockValue bitAnd: 16r3FFFFFFF) bitXor: self hash. seed := seed bitXor: (Time totalSeconds bitAnd: 16r3FFFFFFF). seed = 0] whileTrue: ["Try again if ever get a seed = 0"]. ^seed On Fri, Aug 30, 2013 at 5:15 PM, Sven Van Caekenberghe-2 [via Smalltalk] < [email protected]> wrote: > > On 30 Aug 2013, at 16:54, Esteban Lorenzano <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4705817&i=0>> > wrote: > > > > > On Aug 30, 2013, at 4:49 PM, Sven Van Caekenberghe <[hidden > > email]<http://user/SendEmail.jtp?type=node&node=4705817&i=1>> > wrote: > > > >> > >> On 30 Aug 2013, at 16:35, Esteban Lorenzano <[hidden > >> email]<http://user/SendEmail.jtp?type=node&node=4705817&i=2>> > wrote: > >> > >>> > >>> On Aug 29, 2013, at 5:08 PM, Sven Van Caekenberghe <[hidden > >>> email]<http://user/SendEmail.jtp?type=node&node=4705817&i=3>> > wrote: > >>> > >>>> > >>>> On 29 Aug 2013, at 16:51, Esteban Lorenzano <[hidden > >>>> email]<http://user/SendEmail.jtp?type=node&node=4705817&i=4>> > wrote: > >>>> > >>>>> hi > >>>>> > >>>>> well... I've never been happy on using the UUID generator for my > keys, but is the fastest option I found. > >>>>> There are, of course, alternatives: > >>>>> > >>>>> 1) Using your own number generator (sequential, or whatever). > Problem with that is that is image based, then you need a persistence > strategy... then you are slow. > >>>>> 2) then you can use your own procedure in mongo... with same problem > than (1) > >>>>> 3) you could use timestamp. but TimeStamps are slow :( > >>>>> > >>>>> anyway... I open to ideas :) > >>>>> > >>>>> in the mean time, you can check if your UUID generator is using the > primitive or not. In you are not, you have more possibilities of having a > collision. > >>>> > >>>> Yes, the Smalltalk code (type 4 UUID) is just a random number that is > computed in a complex way. > >>>> > >>>> What does the primitive actually do ? Is it different ? > >>> > >>> the primitive uses the clock ticks to produce an UUID... you shouldn't > have repeated numbers that way... but well, it depends on the platform > implementation also. > >> > >> I don't like plugins because it is some much harder for everyone to > look at the implementation, while everybody thinks some magic happens > there, and often the truth is quite disappointing. > >> > >> Maybe the resolution of #primUTCMicrosecondsClock is not high enough ? > > > > I tried... not enough :( > > I understand: the clock is not fast enough for the request rate. But then > what is there against some counter as part of a UUID ? > > Sorry for the discussion, I find it an interesting subject. I'll have to > read a bit about UUIDs. Can anyone point to the plugin implementation code > ? > > >>>>> Esteban > >>>>> > >>>>> On Aug 29, 2013, at 11:27 AM, Sabine Knöfel <[hidden > >>>>> email]<http://user/SendEmail.jtp?type=node&node=4705817&i=5>> > wrote: > >>>>> > >>>>>> Hi Esteban, All, > >>>>>> > >>>>>> I was proceeding to seach for the reason of the problem I described > >>>>>> yesterday. > >>>>>> > >>>>>> I added some debugging code into > VOMongoSerializer>>ensurePersisted: and the > >>>>>> problem I described, did NOT occur. > >>>>>> > >>>>>> That made the whole process slower...and I had an idea.... > >>>>>> > >>>>>> I was looking into >>UUIDGenerator default makeSeed. > >>>>>> Then I tried the following code: > >>>>>> > >>>>>> |theOld theNew| > >>>>>> > >>>>>> 100000000 timesRepeat: [ > >>>>>> theNew := UUIDGenerator default makeSeed. > >>>>>> theNew = theOld ifTrue: [self halt]. > >>>>>> theOld := theNew] > >>>>>> > >>>>>> The debugger came up! Doesn't that mean that, if the code is run > very fast, > >>>>>> there are double OIDs generated?! > >>>>>> > >>>>>> In my case, the objects for country and currency are very > lightweight and > >>>>>> so, they are created very fast. Also, the error occured much more > often > >>>>>> within my fast production EC2 instance as at my (old and slow) > development > >>>>>> pc. > >>>>>> > >>>>>> Important: I work with windows and so >>makeUnixSeed returns nil... > :-) > >>>>>> > >>>>>> What is your opinion about that? > >>>>>> > >>>>>> Sabine > >>>>>> > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> View this message in context: > http://forum.world.st/voyage-mongo-randomly-wrong-OIDs-tp4705396p4705603.html > >>>>>> Sent from the Pharo Smalltalk Users mailing list archive at > Nabble.com. > >>>>>> > >>>>> > >>>>> > >>>> > >>>> > >>> > >>> > >> > >> > > > > > > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://forum.world.st/voyage-mongo-randomly-wrong-OIDs-tp4705396p4705817.html > To unsubscribe from voyage/mongo randomly wrong OIDs, click > here<http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4705396&code=c2FiaW5lLmtub2VmZWxAZ21haWwuY29tfDQ3MDUzOTZ8MTA0OTM5MTYx> > . > NAML<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://forum.world.st/voyage-mongo-randomly-wrong-OIDs-tp4705396p4705819.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
