[MB-7342] Touch with expiry time 0 does not work Created: 04/Dec/12  Updated: 19/Dec/12  Resolved: 04/Dec/12

Status: Resolved
Project: Couchbase Server
Component/s: couchbase-bucket
Affects Version/s: 2.0-beta-2
Fix Version/s: 2.0
Security Level: Public

Type: Bug Priority: Blocker
Reporter: Trond Norbye Assignee: Chiyoung Seo
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: Couchbase server 2.0 build 1971

According to the specification touch 0 should set the expiry time to never expire, but for couchbase buckets it cause the document to expire immediately (memcached buckets does the right thing here).

Easy test is:
telnet localhost 11211
add a 1 30 1
touch a 0
get a

On a couchbase bucket you won't get anything back from the last get, whereas on memcached buckets you'll get the document a.

The bug is caused by the following code in ep_engine.cc (in EventuallyPersistentEngine::touch):

exptime = serverApi->core->abstime(serverApi->core->realtime(exptime));

Instead the code should be:

    if (exptime != 0) {
        exptime = serverApi->core->abstime(serverApi->core->realtime(exptime));

Comment by Trond Norbye [ 04/Dec/12 ]
Comment by Farshid Ghods (Inactive) [ 04/Dec/12 ]
Raising this to blocker since this is a regression and it can impacts current users
Comment by Mike Wiederhold [ 04/Dec/12 ]

Change was merged.
Comment by Thuan Nguyen [ 19/Dec/12 ]
Integrated in github-ep-engine-2-0 #461 (See [http://qa.hq.northscale.net/job/github-ep-engine-2-0/461/])
    MB-7342: Fix touch with exp time 0 (Revision 3b59a3089bb865fc0535c288dc4977915850c480)

     Result = SUCCESS
Trond Norbye :
Files :
* tests/ep_testsuite.cc
* src/ep_engine.cc
Generated at Sun Nov 23 21:05:18 CST 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.