Use BINARY(16) for ID columns in SQL backends

Registered by Dolph Mathews

UUIDs are 16 bytes in length [1], however keystone's SQL backends generally use VARCHAR(64) columns [2] to store 32-character hexidecimal representations of UUIDs. Beyond the obvious waste of space, this may result in poor JOIN performance [3] in particular.

Specifically:

- Keystone should continue to emit 32-character hexidecimal representations of UUIDs (other services should not be affected)
- Keystone should be migrated to persist UUIDs using their raw 16-byte representations

To illustrate, a hex string representation can be loaded by the uuid module and translated to a 16-byte representation:

  $ python -c "import uuid; hex_str = uuid.uuid4().hex; print(len(uuid.UUID(hex_str).bytes));"
  16

As this is primarily a performance optimization, this change should be benchmarked.

[1]: http://docs.python.org/library/uuid.html
[2]: https://github.com/openstack/keystone/blob/64075262308f83b078c5f29209f19bb29106055c/keystone/identity/backends/sql.py#L33
[3]: http://lists.openstack.org/pipermail/openstack-dev/2014-March/028637.html

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Dolph Mathews
Direction:
Needs approval
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Not started
Milestone target:
None
Completed by
Dolph Mathews

Related branches

Sprints

Whiteboard

https://github.com/openstack/keystone/blob/64075262308f83b078c5f29209f19bb29106055c/keystone/assignment/backends/sql.py#L587

would not change, right? (nor target_id, I'm not sure which one can correspond to the user)
-markwash

As an internal reference, L587 should be migrated to a BINARY(16) column. -Dolph

Today in the LDAP identity driver, the default user-id field is the CN, which is not generally a UUID. So it seems like a migration of existing user-ids would be required in order to change L587 to BINARY(16).
-markwash

Correct - this blueprint is effectively dependent on a solution to https://bugs.launchpad.net/keystone/+bug/1226171 capable of alleviating that constraint. -Dolph

This may also conflict with https://bugs.launchpad.net/keystone/+bug/1291465 (a long-standing wishlist item), and more importantly, diablo deployments that have been migrated forward this far containing 36-character UUIDs as user and project IDs.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.