Skip to content

Commit 327a51c

Browse files
committed
MB-31149: Fix regression where returned cas was set to 0
When sending an Append (0x0e) request to the server I'm seeing a status of success with a CAS value of 0 when the MutationSeqNo Hello Feature is set. When the MutationSeqNo Hello Feature is not set then the CAS value is correct and everything looks fine. Change-Id: If9610716a31074bcb15d65675baf9c8e60988ad0 Reviewed-on: http://review.couchbase.org/99218 Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]> Reviewed-by: Jim Walker <[email protected]>
1 parent 68271a6 commit 327a51c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

daemon/protocol/mcbp/appendprepend_context.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ENGINE_ERROR_CODE AppendPrependCommandContext::storeItem() {
238238
{},
239239
{},
240240
cb::mcbp::Datatype::Raw,
241-
0);
241+
ncas);
242242
} else {
243243
cookie.sendResponse(cb::mcbp::Status::Success);
244244
}

tests/testapp/testapp_regression.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,29 @@ TEST_P(RegressionTest, MB_31070) {
180180
EXPECT_EQ(PROTOCOL_BINARY_RESPONSE_SUCCESS, results[0].status);
181181
EXPECT_EQ(exptime, std::stol(results[0].value));
182182
}
183+
184+
/**
185+
* https://issues.couchbase.com/browse/MB-31149
186+
*
187+
* When sending an Append (0x0e) request to the server I'm seeing a status
188+
* of success with a CAS value of 0 when the MutationSeqNo Hello Feature is
189+
* set. When the MutationSeqNo Hello Feature is not set then the CAS value is
190+
* correct and everything looks fine.
191+
*/
192+
TEST_P(RegressionTest, MB_31149) {
193+
auto& conn = getConnection();
194+
195+
Document document;
196+
document.info.cas = mcbp::cas::Wildcard;
197+
document.info.flags = 0xcaffee;
198+
document.info.id = name;
199+
document.info.expiration = 30;
200+
document.value = "hello";
201+
202+
conn.mutate(document, 0, MutationType::Set);
203+
document.info.expiration = 0;
204+
document.value = " world";
205+
const auto info = conn.mutate(document, 0, MutationType::Append);
206+
207+
EXPECT_NE(0, info.cas);
208+
}

0 commit comments

Comments
 (0)