facebookarchive / flashback

Capture and replay real mongodb workloads
Other
217 stars 72 forks source link

Switch Flashback record and replay to use BSON instead of JSON #35

Closed tredman closed 8 years ago

tredman commented 8 years ago

Addresses https://github.com/ParsePlatform/flashback/issues/31 - which affects $hint, $orderby, $nearSphere, $geoWithin, etc - basically anytime mongo cares about ordering of keys in an operation. This is caused by two things:

1) when python dumps to JSON, keys are written alphabetically, which can break ordering 2) Ordering of go maps is non-deterministic, thus when we unmarshal JSON into a map, we sometimes lose order.

By switching to BSON as the recording format, we can write documents in their original order in the record tool and unmarshal into bson.D objects and preserve order in the replay tool.

tmc commented 8 years ago

:shipit: