The current implementation for time series bucket _id generation follows this process:
- Generate an OID.
- Replace the 4 high-order timestamp bytes of the OID with a rounded version of the user-specified timestamp from the first measurement that lands in the bucket.
- Add the difference between the original timestamp and the rounded version to the next five bytes of the OID (the cluster-unique bytes).
This process was devised originally to deal with coarse granularity in
SERVER-61194, but is still susceptible to collisions when many buckets are opened using the exact same initial timestamp.
In order to further reduce the chances of collisions in these cases, we should simply generate the OID from scratch by filling in the 4 high-order with the rounded timestamp as we currently do, then fill in the remaining 8 low-order bytes with a randomly generated number.