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

Make the creation of the primary index in Couchbase container retryable #9527

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vincz777
Copy link

When starting the CouchbaseContainer sometimes this error occurs:

Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 8 more
Caused by: java.lang.IllegalStateException: Could not create primary index for bucket default-bucket: Response{protocol=http/1.1, code=500, message=Internal Server Error, url=http://localhost:33753/query/service}, body={
"requestID": "efb1e253-78dc-477e-841f-d74e1ad4a6d2",
"signature": null,
"results": [
],
"errors": [{"code":5000,"msg":"GSI CreatePrimaryIndex() - cause: Index creation for index #primary, bucket default-bucket, scope _default, collection _default cannot start. Reason: Create index or Alter replica cannot proceed due to rebalance in progress..","reason":{"_level":"exception","caller":"secondary_index:413","cause":{"error":"Index creation for index #primary, bucket default-bucket, scope _default, collection _default cannot start.","reason":"Create index or Alter replica cannot proceed due to rebalance in progress..","source":"CreatePrimaryIndex()"},"code":4350,"icause":"Index creation for index #primary, bucket default-bucket, scope _default, collection _default cannot start. Reason: Create index or Alter replica cannot proceed due to rebalance in progress..","key":"indexing.error","message":"GSI CreatePrimaryIndex()"}}],
"status": "fatal",
"metrics": {"elapsedTime": "45.456464ms","executionTime": "45.368677ms","resultCount": 0,"resultSize": 0,"serviceLoad": 1,"errorCount": 1}
}

Apparently the database is rebalancing, preventing the creation of the primary index.

We propose to make the creation of the primary index retryable, as many other operations occuring during the set-up of the container.

@vincz777 vincz777 requested a review from a team as a code owner November 13, 2024 10:24
@vincz777
Copy link
Author

Hi @eddumelendez could you please have a look at this PR ? Thanks in advance !

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

Successfully merging this pull request may close these issues.

1 participant