View Return Duplicate Result

views

#1

We are currently using VIEW on couchbase-5.0.1 community version.

We found that there are many duplicated rows in the VIEW result. They have exact same meta().id and key.
And we have set STALE = FALSE in the VIEW query.
We also does not set any document expiration.

This is the map function:

function (doc, meta) {
  if(doc.user_id != null){
  	emit(doc.user_id, null)
  }
}

We are using user_id as KEY to get the unique document id.

Here is one of the example of duplicated result:

{
id: "00000888888-00010000200-1",
key: 888888,
value: null,
},
{
id: "00000888888-00010000200-1",
key: 888888,
value: null,
},

As we all know the document id is unique, there is only one document with document id “00000888888-00010000200-1” in our couchbase.

I have searched in the forum and I found that there are similar issues before but it seems it was solved in version 3.x.


#2

@pvarley I have an update for this topic.
I downgrade couchbase version to 4.5 and there is the same issue again.
I noticed that after I swap/reblance or add a node to our cluster and rebalance, duplicated results showed up.
And I have also found another issue, same as this one
I am not sure how to reproduce it, but I suspect that there is something to do with adding node/fail-over node.

Do you have any idea of this issue?


#3

More updates:

On our test servers, I gracefully failed-over one node among 14 nodes and clicked rebalance.
After rebalance finished, I found that VIEW api (with reduce=true & stale=false) returned me total number of items of the bucket: 151 million.
But before this operation, this API showed me that there were 143 million items in that bucket.
Also, from VIEW query that we are using in our application, it is showing more than the actual number.

And I checked that, this is because of the duplicated results (described at beginning of this post).