Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -685,28 +685,40 @@ private void createBuckets() {

if (bucket.hasPrimaryIndex()) {
if (enabledServices.contains(CouchbaseService.QUERY)) {
@Cleanup
Response queryResponse = doHttpRequest(
QUERY_PORT,
"/query/service",
"POST",
new FormBody.Builder()
.add("statement", "CREATE PRIMARY INDEX on `" + bucket.getName() + "`")
.build(),
true
);
timePhase(
"createBucket:" + bucket.getName() + ":createPrimaryIndex",
() -> {
Unreliables.retryUntilSuccess(
1,
TimeUnit.MINUTES,
() -> {
@Cleanup
Response queryResponse = doHttpRequest(
QUERY_PORT,
"/query/service",
"POST",
new FormBody.Builder()
.add("statement", "CREATE PRIMARY INDEX on `" + bucket.getName() + "`")
.build(),
true
);

try {
checkSuccessfulResponse(
queryResponse,
"Could not create primary index for bucket " + bucket.getName()
);
} catch (IllegalStateException ex) {
// potentially ignore the error, the index will be eventually built.
if (!ex.getMessage().contains("Index creation will be retried in background")) {
throw ex;
try {
checkSuccessfulResponse(
queryResponse,
"Could not create primary index for bucket " + bucket.getName()
);
} catch (IllegalStateException ex) {
// potentially ignore the error, the index will be eventually built.
if (!ex.getMessage().contains("Index creation will be retried in background")) {
throw ex;
}
}
return null;
}
);
}
}
);

timePhase(
"createBucket:" + bucket.getName() + ":primaryIndexOnline",
Expand Down
Loading