Hi everyone,
I’m following this documentation page in order to implement a transaction using the Java SDK against a local Couchbase container (single node).
As soon as I start my application locally, I get the following exception:
com.couchbase.client.core.error.DurabilityImpossibleException: With the current cluster configuration, the requested durability guarantees are impossible
In the “Requirements” section, there is a note that says the following:
If using a single node cluster (for example, during development), then note that the default number of replicas for a newly created bucket is 1. If left at this default, then all Key-Value writes performed at with durabiltiy will fail with a DurabilityImpossibleException
. In turn this will cause all transactions (which perform all Key-Value writes durably) to fail. This setting can be changed via GUI or command line.
Here is what I’ve tried to do in order to solve this issue:
- Disable replicas for each bucket in the GUI;
- Increase the replicas to 2 for each bucket in the GUI;
- Explicitly declare a
TransactionConfigBuilder
that uses the default durability PERSIST_TO_MAJORITY
- Explicitly declare a
TransactionConfigBuilder
that uses the durability NONE
All of these have resulted in the exact same exception INFO message.
Here are the versions that I’m using:
com.couchbase.client:java-client:3.1.6
com.couchbase.client:couchbase-transactions:1.1.8
- Couchbase Image 6.6.1
Do you have any idea of what might be causing this exception? What other configurations can I try? Thanks.
P.S.: here is the GUI configuration of one of the buckets. The other ones share the same configuration.
Hi @mrb_at_work
If you’re created the buckets already, then after you make a change to the number of replicas in the UI, you also need to rebalance your cluster for that setting to take effect.
Hi @graham.pople , thanks for the quick reply, that indeed solved my problem!
For any future search result hits: in order to rebalance through the GUI go to “Servers” on the left and hit on the “Rebalance” button in the top right:
No problem @mrb_at_work , glad you’re up and running now.
- Explicitly declare a
TransactionConfigBuilder
that uses the durability NONE
Incidentally, this also should have worked… If you can paste your code here I can take a look at it?
Sure thing @graham.pople!
I instantiated the transaction object like this:
val transactionConfig = TransactionConfigBuilder
.create()
.durabilityLevel(TransactionDurabilityLevel.NONE)
.logOnFailure(true, Event.Severity.WARN)
.build()
return Transactions.create(cluster, transactionConfig)
The exception was logged before explicitly using the transaction object to perform a transaction.
Thanks, and that looks fine, though it does sound from the description that the durability level is not getting passed down, at least on one path… I’ve done some code analysis and can’t see where this could be, and also run a subset of the transactions tests against that scenario (durability=NONE configured, single node deployment with bucket with 1 replica), which pass without issue.
Do you possibly have the full exception stacktrace handy, or a programmatic log (details here Distributed Transactions from the Java SDK | Couchbase Docs)? Possibly my testing and static analysis just isn’t looking at the same path your transaction is following.