Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Large Number Handled Incorrectly #3783
Sync Gateway version
Either Windows 10 or macOS High Sierra (probably doesn't matter)
Unused. Just specified
2018-10-05T10:23:54.170+09:00 [INF] HTTP: #18: PUT /sync_gateway/test (as GUEST)
The number is stored correctly
An alternate number is somehow inserted
Steps to reproduce
Wow looks like this issue has been around for a long time -> https://grokbase.com/t/couchdb/user/09b7nam3h0/silent-corruption-of-large-numbers/oldest
Verified this behaviour w/ both xattrs and non-xattrs. Issue occurs during JSON unmarshalling - the json decoder isn't currently setting UseNumber (to preserve large integers that otherwise get converted to float).
Could review all places that currently unmarshal documents and ensure decoder w/ UseNumber is applied.
The preferred approach is to also preserve raw document bytes whenever possible (particularly when using shared bucket access, where document mutations for _sync metadata aren't required).