Sync gateway sometimes syncs long value as double


#1

I stumbled upon another strange problem with couchbase lite on android. I can write and read long values without problems in a local DB.
When the sync gateway is running with the walrus config (1.0.4-34 on a ubuntu machine) the long values are synced as double.
In my local DB the value is 1430135390962
Sometimes after syncing it the value in the walrus file and on another device is 1.430135390962e+12.
This obviously causes some trouble when reading it, because CBlite/Jackson reads it as a double value.

When I don’t use walrus and a couchbase server instead, the value is correctly synced as long.

Should I report this as a bug on github?

Edit: I just tested this a little bit more and noticed that this problem also occured with the couchbase server. The value in the servers webinterface is still a long, but on one device the value is synced and parsed as double.


#2

Hello @Mav3ric,

Resurfacing this issue and wondering if you tested a range of ‘long’ values that would turn into ‘doubles’?

Are you seeing double type locally and long type on the server?
Can also file a ticket here if this issue persists:


#3

This looks like it might be the same issue as https://github.com/couchbase/sync_gateway/issues/694


#4

I tried to store timestamps as long values, when I noticed the issue. So yes, the values were ‘true’ long values.

The value in my local CBL instance remained a long. The issues was only after the the value is synced once. Then it is stored wrong in the gateway/server and on any other device, which syncs it from the gateway.

The issue seems to be same, I tested this also with gateway and CBL android version 1.0.4

My current workaround is to simply store the long values as Strings and parse them back when reading.