Old Revisions Not Removed from Index (intermittent)
View indexes point to a document. When updating a document, we usually see the old revision removed from the index and the new revision put in it's place. We're hitting some cases where the old revision remains as well, causing duplicate records in our index. When we hit this state, nothing seems to remove the duplicate content. I've tried 1) waiting 24 hours and, 2) manually compacting, and 3) querying with ?stale=false . The only way I have been able to remove the duplicate data is to slightly modify my view function by adding a blank line to the top. This caused couchbase to think it's a new view function and recalculate the whole index.
What is causing the old revisions to not be removed? I've seen the problem twice. Here were the conditions:
1) In development. I made hundreds of view functions, some of which were inefficient and contained 500+ "if" statements. Moving the views to their own design doc alleviated this.
2) On a live site, we ran couchbase for about 30 minutes. It started to get slow, and I noticed a compaction was running. I cancelled the compaction and told it to only run between 2am and 9am. Then I checked and saw 3 view entries for a single document. All were for different revisions of that document.
This is what I am using :
Design documents: 11
Document records: 4.5 Million
Index with issue records: 4 Million
Centos 6.3 with Moxi Client Library
Couchbase 2.0 - Open Source