Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6054

Improve uniqueness of ObjectIds

      (This would include both drivers and core.)

      Currently, two bytes are used in ObjectId to store the PID. This seems to be meant to make ObjectIds not collide if multiple processes on the same server generate ObjectIds.

      However, many environments will only ever have a single process per server. In that case this wastes two bytes, particularly when running imaged servers that will always boot in the same way (resulting in the same PIDs across all servers). This can be improved.

      In http://www.mongodb.org/display/DOCS/Object+IDs#ObjectIDs-BSONObjectIDSpecification:

      • Change the definition of "machine" to the following:

      MD5(HostName + PID)[0:3]

      • Remove the "pid" field, extending the "inc" field to five bytes.

      This preserves the separation of different processes on the same server, while giving 40 bits of randomness (assuming the "inc" field is initialized to a random value, which it always should be) rather than just 24.

      This change should cause no compatibility issues with existing ObjectIds, and improve the uniqueness guarantees of ObjectId.

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            glenn Glenn Maynard
            Votes:
            3 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated: