Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 939 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why will timeuuid not have any collisions?

#1
I was reading [the Datastax CQL reference][1]:

> Collisions that would potentially overwrite data that was not intended
> to be overwritten cannot occur.

Can someone explain to me why a collision will never occur? Is it impossible or "highly" unlikely?


[1]:

[To see links please register here]

Reply

#2
Cassandra's timeuuid is a [Version 1 UUID][1] which is based on the time and the MAC address of the machine generating the UUID.

The time used is accurate down to 100ns, so the chance of a collision is incredibly slim (a nano second is a millionth of a millisecond).

[1]:

[To see links please register here]

Reply

#3
Cassandra timeuuid is a Version 1 UUID(Type 1 UUID) which is based on:

1. A timestamp consisting of a count of 100-nanosecond intervals since
15 October 1582 (the date of Gregorian reform to the Christian
calendar).
2. A version (which should have a value of 1).
3. A variant(which should have a value of 2).
4. A sequence number, which can be a counter or a pseudo-random number.
5. A "node" which will be the machine's MAC address (which should make the UUID unique across machines).

Using a pseudo-random number for the sequence number provides a 1 in a 16,384 chance that each UUID Class will have a unique id.

if you generate more than 10000 UUID per msec then they may collide.

1 msec = 10^6 ns

By this you can generate 10^6 UUID if we take ns level timestamp but
as we take timestamp as 100ns count.

we will be have at most 10000 unique timestamps in one millisecond.

Now generating more than that on a single machine(which will have same MAC address), there is a chance to collide ass we also need to take sequence number into account.

If your application generates more than 10000 per ms, use another column to make a compound key which helps to avoid collisions.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through