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

[Bug]: There is no way to test Transactions with CouchbaseContainer #5835

Closed
spirostz opened this issue Sep 12, 2022 · 2 comments · Fixed by #5840
Closed

[Bug]: There is no way to test Transactions with CouchbaseContainer #5835

spirostz opened this issue Sep 12, 2022 · 2 comments · Fixed by #5840
Labels

Comments

@spirostz
Copy link

spirostz commented Sep 12, 2022

Module

Couchbase

Testcontainers version

1.17.3

Using the latest Testcontainers version?

Yes

Host OS

Windows

Host Arch

x86

Docker version

Client:
 Cloud integration: v1.0.29
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:09:02 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.12.0 (85629)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:23 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

There is no way to test Transactions with CouchbaseContainer.

Fails with "DurabilityImpossibleException:
With the current cluster configuration, the requested durability guarantees are impossible"

- A proper fix is impossible since there is no way to set Bucket.replicaNumber to zero (default = 1)
- Also there is no way to set up a cluster of two servers that would also solve this problem.

Therefore, a proper solution is impossible.

Demonstration code see Problem 1:
https://github.com/spirostz/couchbase-transactions/blob/main/src/test/java/org/spiros/CouchbaseTransactionsTest.java

Relevant log output

No response

Additional Information

Demonstration code see Problem 1:
https://github.com/spirostz/couchbase-transactions/blob/main/src/test/java/org/spiros/CouchbaseTransactionsTest.java

@programmatix
Copy link

The core issue here is that a bucket by default gets created with replicas=1, which is a sensible default for production clusters.

But on single-node clusters (which a CouchbaseContainer effectively is), it's not a valid setting. Most operations work regardless, but durable KV ops do not - reporting the DurabilityImpossibleException error seen. And transactions uses durable KV ops under the hood.

So - I think I agree that we should default to setting the number of replicas on the bucket to 0.

@daschl
Copy link
Member

daschl commented Sep 13, 2022

I agree - working on a PR to make it configurable and default to 0.

daschl added a commit to daschl/testcontainers-java that referenced this issue Sep 13, 2022
This change allows the user to configure the number of bucket replicas
and defaults it to 0 since most of the time the user ever only needs
no replicas since it is a single container.

Note: technically this is a behavioral change since before the number
of replicas was 1 (if not defined) but this causes issues when
testing transactions (as seen in testcontainers#5835).

Fixes testcontainers#5835
daschl added a commit to daschl/testcontainers-java that referenced this issue Sep 14, 2022
This change allows the user to configure the number of bucket replicas
and defaults it to 0 since most of the time the user ever only needs
no replicas since it is a single container.

Note: technically this is a behavioral change since before the number
of replicas was 1 (if not defined) but this causes issues when
testing transactions (as seen in testcontainers#5835).

Fixes testcontainers#5835
kiview pushed a commit that referenced this issue Sep 14, 2022
This change allows the user to configure the number of bucket replicas
and defaults it to 0 since most of the time the user ever only needs
no replicas since it is a single container.

Note: technically this is a behavioral change since before the number
of replicas was 1 (if not defined) but this causes issues when
testing transactions (as seen in #5835).

Fixes #5835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants