Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-developer-preview-4
-
Fix Version/s: 2.0-beta
-
Component/s: couchbase-bucket, view-engine
-
Security Level: Public
-
Labels:
Description
As suspected the view engine is not correctly picking up the expiry time of the item. This is why you always see if at zero. However, if you access data using the GET api, you will always only get back non-expired data. The admin console exposes the expiry information via document editing / view editing screen using a view but since the view engine doesn't pick up the correct information it always shows it as zero.
I am including Alex from our support team who will work with you on this further. Alex will create a support ticket and move this forward.
I hope this helps in understanding what the problem is.
I am including Alex from our support team who will work with you on this further. Alex will create a support ticket and move this forward.
I hope this helps in understanding what the problem is.
Example, I do this via python:
$ ~/couchbase2-4/ep-engine/management ((8440fae...))> python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mc_bin_client
>>> c = mc_bin_client.MemcachedClient(port = 12000)
>>> c.vbucketId = 0
>>> c.set("doc4", 111112, 8, "{\"value\": 4}")
(1826197228, 48227429387, '')
>>>
Than at couchstore:
$ ../install/bin/couch_dbdump couch/0/default/0.couch.1
Doc seq: 6
id: doc4
rev: 2
content_meta: 0
cas: 48227429387, expiry: 1346265135, flags: 134217728
data: {"value": 4}
Total docs: 1
For flags, 134217728 is 8 with wrong endianness.
I added the following patch to couch-kvstore.cc:
diff --git a/src/couch-kvstore/couch-kvstore.cc b/src/couch-kvstore/couch-kvstore.cc
index 4d316c2..978f236 100644
--- a/src/couch-kvstore/couch-kvstore.cc
+++ b/src/couch-kvstore/couch-kvstore.cc
@@ -246,6 +246,7 @@ CouchRequest::CouchRequest(const Item &it, uint64_t rev, CouchRequestCallback &c
bool isjson = false;
uint64_t cas = htonll(it.getCas());
uint32_t flags = htonl(it.getFlags());
+ getLogger()->log(EXTENSION_LOG_WARNING, NULL, "FLAGS: %d\n", it.getFlags());
uint32_t exptime = htonl(it.getExptime());
itemId = (it.getId() <= 0) ? 1 : 0;
And saw in the output:
[ns_server:info,2012-08-28T12:40:24.368,n_0@127.0.0.1:ns_port_memcached:ns_port_server:log:169]memcached<0.523.0>: Tue Aug 28 11:40:24.168302 3: FLAGS: 134217728
So it seems the Item class stores the flags (and expiration) in network byte order already, making the htonll conversion in couch-kvstore.cc unnecessary:
https://github.com/couchbase/ep-engine/blob/master/src/couch-kvstore/couch-kvstore.cc#L248
Can you confirm me this analysis is correct?
Also, same applies to expiration and CAS, right?
thanks