Validate: Document accessed after Locking should raise DocumentLockedException or Timeout?

Description

 

class Program { static async Task Main(string[] args) { try { var cluster = await Couchbase.Cluster.ConnectAsync("couchbase://localhost", "Administrator", "password"); var bucket = await cluster.BucketAsync("travel-sample"); var scope = await bucket.ScopeAsync("inventory"); var coll = await scope.CollectionAsync("airport"); var key = "airport-500001"; var document = new { id=500001, type = "airport", airportname = "Francis Airport", Country = "France" }; await coll.UpsertAsync<dynamic>(key, document); await coll.GetAndLockAsync(key, TimeSpan.FromSeconds(30)); await coll.RemoveAsync(key); } catch (CouchbaseException ex) { Console.WriteLine(ex); } catch (Exception ex) { Console.WriteLine(ex); } Console.Read(); } }

In the code above, attempt to remove a document thats being locked should raise a DocumentLockedException instead a AmbiguousTimeoutException is raised

 

Couchbase.Core.Exceptions.AmbiguousTimeoutException: The operation /25 timed out after 00:00:02.5000000. It was retried 10 times using Couchbase.Core.Retry.BestEffortRetryStrategy. at Couchbase.Utils.ThrowHelper.ThrowTimeoutException(IOperation operation, IErrorContext context) at Couchbase.Core.Retry.RetryOrchestrator.RetryAsync(BucketBase bucket, IOperation operation, CancellationTokenPair tokenPair) at Couchbase.KeyValue.CouchbaseCollection.RemoveAsync(String id, RemoveOptions options) at ScopeLevelQuery.Program.Main(String[] args) in /Users/arun.vijayraghavan/ScopeLevelQuery/ScopeLevelQuery/Program.cs:line 47

 

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Activity

Show:

Jeffry Morris June 3, 2022 at 8:21 PM

This is behavior is expected. Too override this behavior a custom retry strategy can be created: https://forums.couchbase.com/t/detecting-locked-document-with-java-sdk-3/32775

https://couchbasecloud.atlassian.net/browse/NCBC-3228#icft=NCBC-3228 was added to make it easier to duplicate and override the behavior of the BestEffortRetryStrategy.

Won't Fix
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Story Points

Sprint

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created November 11, 2021 at 11:16 PM
Updated June 3, 2022 at 8:21 PM
Resolved June 3, 2022 at 8:21 PM
Instabug