Start a Couchbase CE 7.0.2 or EE 7.0.3 (reproduced on both with the same frequency) on Kubernetes with 4GB RAM for data service and 2GB RAM for indexing service as follows.
The cluster is empty.
Using the Java API 3.2.5 and Scala API 1.2.5 & Scala 2.13.8, create a bucket with the following settings.
scalaCluster
.buckets
.create(CreateBucketSettings(
name = bucketConfiguration.bucketName,
ramQuotaMB = bucketConfiguration.ramQuotaMB,
flushEnabled = Some(bucketConfiguration.flushEnabled),
numReplicas = Some(bucketConfiguration.numReplicas),
replicaIndexes = Some(bucketConfiguration.replicaIndexes),
bucketType = Some(bucketConfiguration.bucketType),
ejectionMethod = Some(bucketConfiguration.ejectionMethod),
maxTTL = None,
compressionMode = None,
conflictResolutionType = None,
minimumDurabilityLevel = Some(bucketConfiguration.minimumDurabilityLevel)
))
After bucket creation, wait 30 seconds so that the bucket is properly initialized - just to make sure.
Programatically create scope oouOCeUc
and collection sehcs-Whatever_e
.
Then programmatically create the following index.
CREATE INDEX `PXPy_1646932173650-oouOCeUc-sehcs-Whatever_e-value` ON `PXPy_1646932173650`.`oouOCeUc`.`sehcs-Whatever_e`(`value`)
The index creation fails about 65 % of time either due to:
The server reported an issue with the underlying index {“completed”:true,“coreId”:“0x4c0c751600000002”,“errors”:[{“code”:12021,“message”:“Scope not found in CB datastore default:PXPy_1646932173650.oouOCeUc”,“retry”:false}],“httpStatus”:500,“idempotent”:false,“lastDispatchedFrom”:“10.240.0.10:50352”,“lastDispatchedTo”:“cbt-5-couchbase-0.cbt-5-couchbase.development.svc.sigma:8093”,“requestId”:155,“requestType”:“QueryRequest”,“retried”:0,“service”:{“operationId”:“9ad19128-1555-4f24-9b0d-37d68fdc3a99”,“statement”:“CREATE INDEX
PXPy_1646932173650-oouOCeUc-sehcs-Whatever_e-value
ONPXPy_1646932173650
.oouOCeUc
.sehcs-Whatever_e
(value
)”,“type”:“query”},“timeoutMs”:30000,“timings”:{“dispatchMicros”:39398,“totalDispatchMicros”:39398}}
or
Index already exists {“completed”:true,“coreId”:“0x4c0c751600000002”,“errors”:[{“code”:4300,“message”:“The index PXPy_1646932173650-oouOCeUc-sehcs-Whatever_e-value already exists.”,“retry”:false}],“httpStatus”:409,“idempotent”:false,“lastDispatchedFrom”:“10.240.0.10:50419”,“lastDispatchedTo”:“cbt-5-couchbase-0.cbt-5-couchbase.development.svc.sigma:8093”,“requestId”:900,“requestType”:“QueryRequest”,“retried”:0,“service”:{“operationId”:“fcebd508-9a22-43aa-b987-7bde8924ed82”,“statement”:“CREATE INDEX
PXPy_1646932173650-oouOCeUc-sehcs-Whatever_e-value
ONPXPy_1646932173650
.oouOCeUc
.sehcs-Whatever_e
(value
)”,“type”:“query”},“timeoutMs”:30000,“timings”:{“dispatchMicros”:50132,“totalDispatchMicros”:50132}}
(When you check in the UI, it does not exist.)
Or the index exists, but it reports an ERROR on the web UI.
However, after the bucket creation and waiting 30 seconds as previously, but running /pools/default/buckets/$bucket/controller/compactBucket
programatically and then following up with scope, collection, and then index creation, indexes properly come up and created every time.
When I remove the compaction command after bucket creation, the program attempts to create the indexes no matter what. It continuously checks whether the index is created or online, waits and after a while runs the index creation again, for 5 minutes. When any time during the reattempts for the index creation, I go to the web UI and click on “Compact” for the said bucket, the index creation then properly finishes and the program then can verify that the index is created and online.