Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CXXCBC-92: add test to clarify retrying on kv_locked #127

Merged
merged 1 commit into from Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/test_integration_crud.cxx
Expand Up @@ -221,6 +221,15 @@ TEST_CASE("integration: pessimistic locking", "[integration]")
REQUIRE(resp.ctx.retry_reasons.count(couchbase::io::retry_reason::kv_locked) == 1);
}

// but unlock operation is not retried in this case, because it would never have succeeded
{
couchbase::operations::unlock_request req{ id };
req.cas = couchbase::protocol::cas{ cas.value - 1 };
auto resp = test::utils::execute(integration.cluster, req);
REQUIRE(resp.ctx.ec == couchbase::error::key_value_errc::document_locked);
REQUIRE(resp.ctx.retry_reasons.count(couchbase::io::retry_reason::kv_locked) == 0);
}

// but mutating the locked key is allowed with known cas
{
couchbase::operations::replace_request req{ id, basic_doc_json };
Expand Down