Closed Bug 843013 Opened 12 years ago Closed 12 years ago

monolith: Change record uuid in mysql to store bytes as binary(16) instead of hex as binary(32)

Categories

(Marketplace Graveyard :: Statistics, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2012-12-27

People

(Reporter: hschlichting, Assigned: hschlichting)

Details

(Whiteboard: [u=dev c=mkt-statistics p=2])

Currently we store a record uuid as a binary(32) - as a hex representation of a uuid.uuid1().hex. That's wasting space, and we should just store the uuid.uuid1().bytes variant.
Summary: Change record uuid in mysql to store bytes as binary(16) instead of hex as binary(32) → monolith: Change record uuid in mysql to store bytes as binary(16) instead of hex as binary(32)
In addition to using a 16-byte variant, we should also change to a different uuid format, which has stable prefixes and doesn't screw BTree inserts and data locality. Plus one: Have a key that lets us specify a simple "PARTITION BY KEY()", preferably the key denoting the year or year/month combination (http://dev.mysql.com/doc/refman/5.5/en/partitioning-overview.html - NDB cluster needs the partition key to be based on the primary key).
Done: Changed uuid format to have a stable prefix to put data from the same batch into the same buckets and avoiding totally random writes (while preserving a node-specific prefix to avoid writers on multiple hosts from conflicting too much). Also used a url-safe base64-encoded version of the uuid, instead of the hex version. This only cuts it down to 24 bytes, but means less trouble in the ES URL/JSON API's. Todo: Look into partition keys.
I looked into partitions and measured their overhead. At this point it's too much overhead without any clear benefit. And our PK doesn't give anything close to an even distribution for the provided (linear) key/hash algorithms. We can look at this again if we consider cluster (ndb) storage or when we actually get tons of data.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [u=dev c=mkt-statistics p=] → [u=dev c=mkt-statistics p=2]
Target Milestone: --- → 2012-12-27
You need to log in before you can comment on or make changes to this bug.