Document expiry Issues

query
java
n1ql

#1
  1. A document with expiry set is never deleted if the last operation did a Bucket.get(docId) or bucket.update.
    looks like Couchbase is resetting the document expiry?

  2. getAndTouch expires the document (document gets deleted) but changes the cas value but returned document wouldn’t have the latest CAS :frowning:


#2

Update will indeed update the expiry - the expiry is set by the last operation which modifies a document. A straightforward Get() should not update the expiry, however.

What version of Couchbase Server are you running? I recall a bug in this area in a previous version (where the CAS returned from getAndTouch() was incorrect), but I believe it’s fixed in the most recent release.


#3

thanks, I’m using 4.5.1
also why would update query update the expiry if it wasn’t specifically asked to be updated?


#4

That’s simply the semantics of expiry - every time a document is mutated the expiry is set to whatever value is specified in the mutation; and by default if you don’t set expiry it will default to 0 (i.e. don’t expire).


#5

Ok, so it looks like you’ve encountered https://issues.couchbase.com/browse/MB-23976, which is fixed in 5.0.0 and upwards.


#6

thanks @drigby
we just started migrating to 5