gouuidv6 icon indicating copy to clipboard operation
gouuidv6 copied to clipboard

Add option to always randomize node

Open mvrhov opened this issue 5 years ago • 3 comments

With constant node the uuids look to similar and when debugging by hand it's difficult to spot the differences.

mvrhov avatar Dec 17 '19 08:12 mvrhov

Another solution would be to generate a random value for the node part at startup and then increment it by one each time a new ID is made (with logic to wrap around when it goes out of bounds). This would make it so consecutive IDs visually appear somewhat in sequence when you look at the last few letters.

What do you think about that approach?

One other note is that I think any package level option should also have the ability to read the value as well as disable it. For example https://golang.org/pkg/runtime/#GOMAXPROCS has one function that can set the value or read the current value. It might be fine to have two functions as well, one for reading and one for writing, e.g. SetNodeIncrementMode(bool) and NodeIncrementMode() bool. These should probably lock using the newlock mutex for safety.

bradleypeabody avatar Dec 19 '19 22:12 bradleypeabody

I'm not fond of incrementing it, because when importing a million records the UUIDs are already close together just incrementing the random part wouldn't help much on that regard.

mvrhov avatar Dec 20 '19 07:12 mvrhov

I understand. This does raise the question of whether or not there should be several different modes available or options of some sort. I do understand where you're coming from on randomizing the node part. I do think there is a valid case for incrementing as well. I'm just still thinking about what the best approach is here to be able to incorporate such options.

bradleypeabody avatar Dec 30 '19 17:12 bradleypeabody