Re:Show HN: 128-bit, roughly-ordered, URL-safe UUIDs
by sudhirj on Friday January 22, 2021 @10:28AM
(#25872436)
If you’re referring to the monotonic counter implementation, then yes, that’s a documented choice you can make if you explicitly want strictly increasing ULIDs on the same millisecond, but given that you can’t ensure this across servers anyway, it’s more an edge case.
Re:Show HN: 128-bit, roughly-ordered, URL-safe UUIDs
by j-pb on Friday January 22, 2021 @10:45AM
(#25872601)
Yes, monotonic counters, are ULID's "billion dollar mistake".
They're not an edge case, in that the standard displays them quite prominently. They're actually the only code examples given.
The standard should deprecate them, because people WILL use them "wrong".
Re:Show HN: 128-bit, roughly-ordered, URL-safe UUIDs
by sudhirj on Friday January 22, 2021 @11:43AM
(#25873225)
Dunno about that. The implementations I’ve seen so far default to /dev/random and make you jump through hoops to get the monotonic counter, so if you manage to enable it they should assume it’s what you want. I’ve actually used them effectively in a couple of NoSQL problems where I didn’t need cryptographic security, just distributed timestamps - I was creating two sequential events (create and update), and they had to always order one after another, even though I created them in the same loop and millisecond.
The spec doesn’t specify a source of randomness - an implementation that uses https://xkcd.com/221/ will or course not be a very good one.