Inadvertend DATA LOSS due to a bug in the documentation


#1

When using the ttl parameter and setting it according to the documentation (the number of seconds for the expiration), it is possible to inadvertendly delete documents by setting wrong ttl values.

For example, if your expiration time is 5 years, you will dutifully multiply 606024*365 and pass the resulting number as ttl. It turns out that, contrary to the python client documentation, couchbase will threat all values above 30 days as a unix epoch time, which will convert your 5 years of expiration into the 1970-ies, which will remove the corresponding document immediately on next request.


#2

This is actually part of the memcache definition of ttl, anything below 30 days
= 2592000 sec will be seen as a ttl in secounds, anything above will be
interpreted as a timestamp.

Of course it should be properly documented so, do you mind filing a bug for the
python client, describing the problem?
http://www.couchbase.com/issues/browse/PYCBC

In case you have problems filing it I’m happy to do so and send you a reference.


#3

Thanks Philipp, I’ve just added an issue (didn’t find the link to the issue tracker before).