Hi everyone,
I have an issue with the method couchbaseTemplate.deleteByQuery.
TransactionOptions transactionOptions = TransactionOptions.transactionOptions().durabilityLevel(DurabilityLevel.NONE);
Transaction transactions = couchbaseTemplate.getCouchbaseClientFactory().getCluster().transactions();
transactions.run(ctx -> couchbaseTemplate.removeByQuery(Customer.class)
.withConsistency(QueryScanConsistency.REQUEST_PLUS)
.all(), transactionOptions);
}
This is the error I get :
The server reported an issue with the underlying index "Keyspace not found in CB datastore: default:customers - cause: No bucket named customers
I don’t understand why he is looking for a customer bucket, my bucket is bucket1. If i simply use repository.deleteAll()
without a transaction it works. If I call couchbaseTemplate.getBucketName()
it yields correctly bucket1. Thank you
Hi Rosario -
First make sure you are running the latest version of spring-data-couchbase. The issue you have looks exactly like scope and collection annotations on repository are not considered during execution. · Issue #1441 · spring-projects/spring-data-couchbase · GitHub
It’s difficult to determine exactly what occurred without your configuration class, the repository class and the entity class (Customer). There are a number of possibilities - they are outlined in the various links I provided in your other post - especially those on scopes and collections.
A ‘keyspace’ as mentioned in the error message is either a bucket (when not using scopes and collections), or a collection (when using scopes and collections).
At the bottom of the issue is a query like “delete from customer …” being sent to the server without a query_context (which would specify the bucket and collection). So it appears that somewhere you have defined an @Collection(“customer”) , and the query is being constructed with that keyspace - but the corresponding query_context (which specifies the bucket and scope) is not being sent - because your Configuration does not specify a scope (@Override getScopeName())
Hi Michael,
thank you very much for your reply. I have uploaded the project on github. You can find the class CustomerServiceImpl here.
In the entity class Customer I have set the scope and the collection with the annotations @Scope and @Collection. All methods of the class CustomerServiceImpl are working fine except deleteAll, which raises this exception:
Transaction has failed with cause ‘com.couchbase.client.core.error.IndexFailureException: The server reported an issue with the underlying index {“completed”:true,“coreId”:“0x38b17e9300000001”,“errors”:[{“code”:12003,“message”:“Keyspace not found in CB datastore: default:customers - cause: No bucket named customers”,“retry”:false}]’
Unfortunately I cannot upload the whole stack trace because I have limitations on the characters in each post.
Clearly i am doing something wrong but I could not be able to find the issue here.
I’ll look at it tomorrow. Today’s a holiday.