summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <trond.norbye@gmail.com>2011-08-08 15:47:54 +0200
committerTrond Norbye <trond.norbye@gmail.com>2011-08-08 15:47:54 +0200
commit911c9d0a6c9a7268358cf4bcff94c33ad012cee7 (patch)
tree115fe16a57dd696ea79b0d1f2f2b7fd8fdd61816
parent2c56090933e01ea5ab7d0c6e6530ea73b0933cf9 (diff)
downloadmemcached-911c9d0a6c9a7268358cf4bcff94c33ad012cee7.tar.gz
Issue 115: accont for CAS in item_size_ok
-rw-r--r--items.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/items.c b/items.c
index d9bacfa..12ffa29 100644
--- a/items.c
+++ b/items.c
@@ -242,8 +242,13 @@ bool item_size_ok(const size_t nkey, const int flags, const int nbytes) {
char prefix[40];
uint8_t nsuffix;
- return slabs_clsid(item_make_header(nkey + 1, flags, nbytes,
- prefix, &nsuffix)) != 0;
+ size_t ntotal = item_make_header(nkey + 1, flags, nbytes,
+ prefix, &nsuffix);
+ if (settings.use_cas) {
+ ntotal += sizeof(uint64_t);
+ }
+
+ return slabs_clsid(ntotal) != 0;
}
static void item_link_q(item *it) { /* item is the new head */