Andrea Cosentino created CAMEL-25172:
----------------------------------------

             Summary: camel-couchbase: persistTo=2 is rejected although 
PersistTo.TWO exists, by a message that says 0 to 4 are supported
                 Key: CAMEL-25172
                 URL: https://issues.apache.org/jira/browse/CAMEL-25172
             Project: Camel
          Issue Type: Bug
          Components: camel-couchbase
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


{{CouchbaseProducer}} maps the numeric {{persistTo}} option onto the SDK's 
{{PersistTo}} enum and skips 2:

{code:java}
switch (persistTo) {
    case 0:
        this.persistTo = PersistTo.NONE;
        break;
    case 1:
        this.persistTo = PersistTo.ACTIVE;
        break;
    case 3:
        this.persistTo = PersistTo.THREE;
        break;
    case 4:
        this.persistTo = PersistTo.FOUR;
        break;
    default:
        throw new IllegalArgumentException(
                "Unsupported persistTo parameter. Supported values are 0 to 4. 
Currently provided: " + persistTo);
}
{code}

{{com.couchbase.client.java.kv.PersistTo}} declares NONE, ACTIVE, ONE, TWO, 
THREE and FOUR, so {{PersistTo.TWO}} - persist to two nodes - is a perfectly 
ordinary durability requirement. It is the only value in the advertised range 
that fails, and the message it fails with claims that range is supported:

{noformat}
persistTo=0 -> accepted
persistTo=1 -> accepted
persistTo=2 -> REJECTED: Unsupported persistTo parameter. Supported values are 
0 to 4. Currently provided: 2
persistTo=3 -> accepted
persistTo=4 -> accepted
{noformat}

The parallel {{replicateTo}} switch immediately below covers 0 to 3 with no 
gap, which is what the {{persistTo}} one was evidently meant to do.

h2. Proposed fix

Add {{case 2: this.persistTo = PersistTo.TWO;}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to