We are encountering on our production cluster from time to time the below error when executing N1QL query:
“[12008] Error performing bulk get operation - cause: unable to complete action after 6 attemps”
We have no idea why it happens. We found no errors on the Couchbase logs or any indications for issues.
When executing it in the Couchbase UI Query editor we validated that it’s using an index . Also, the query take 3.02ms.
Here are a some details on our configuration:
Couchbase version: 6.0.2
We have 3 nodes
Minimum replica is 2
6 cpu
60GB RAM. 20 % reserved for operation system
Here is an example to one of the codes which executing N1QL query that gets the error, but again, it randomly happens in other N1ql queries too and only from time to time.
(I changed the method variables/names so it’s a pseudo)
func GetActivities(userId string) (*entity.Activity, error) {
q := gocb.NewN1qlQuery(SELECT * FROM users WHERE type = $1 AND userId = $2 ORDER BY createdAt DESC)
rows, err := bucket.ExecuteN1qlQuery(q, []interface{}{entity.DocTypeActivity, userId})
if err != nil {
return nil, err
}
var activities []entity.Activity
var activity = entity.Activity
for rows.Next(&activity) {
activity = data["users"]
activities = activities.append(activities, activity)
}
err = rows.Close()
if err != nil {
return nil, err
}
return &res, nil
}
I found in the forum other posts that related to this error but no solution other than “try to upgrade the Couchbase”.
What is the index definition. Can you change type value as static
SELECT * FROM users WHERE type = "xyz" AND userId = $1 ORDER BY createdAt DESC
CREATE INDEX ix1 ON ( userId, createdAt DESC) type = "xyz";
If you can't
SELECT * FROM users WHERE type = $1 AND userId = $2 ORDER BY createdAt DESC
CREATE INDEX ix1 ON ( type, userId, createdAt DESC) ;
The error says trying to get the specific keys and not able to complete after 6 attempts. Check query.log any other errors around that time.
Node down or network issue or overloaded node.
Found the request log when when query the system:completed_requests.
I see that the query completed, but with error. I still unable to understand the error and the cause.
(I changed some values such remoteAddr, etc… in terms of security)
I am facing similar issue in my Enterprise tool. Mostly, the query works in <10ms with expected results. Intermittently, the query throws the error. Attaching two screenshots for reference.