Skip to content

Conversation

@DemetrisChr
Copy link
Contributor

@DemetrisChr DemetrisChr commented Jun 25, 2025

Motivation

According to the specification, the SDK shouldn't wrap document_unretrievable errors in a transaction_operation_failed error:

If lookupInAnyReplica() raises DocumentUnretrievableException or FeatureNotAvailable, this is raised directly to the lambda. E.g. this joins the very small list of cases where failures to not set internal state that guarantees this attempt will fail, and allows the user to catch and ignore the error (and more usefully - to fallback to a regular ctx.get()).

Currently, we correctly don't cache the error internally, which allows users to 'catch' it, but we still wrap it in transaction_operation_failed. The convention we must follow is that transaction_operation_failed always sets internal state and indicates the error cannot be handled to prevent a rollback.

Change

When the replica get fails with document_unretrievable return it without wrapping it in a transaction_operation_failed error.

Results

Relevant FIT tests in ExtReplicaFromPreferredServerGroupTest pass – docDoesNotExist and canContinueAfterDocUnretrievable

@DemetrisChr DemetrisChr merged commit ae690df into couchbase:main Jun 25, 2025
24 of 27 checks passed
@DemetrisChr DemetrisChr deleted the CXXCBC-704-txn-doc-unretrievable-unwrapped branch June 25, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants