Views are empty or with few documents & no indexing process

I’m using Couchbase server community edition 3.0.1 and I noticed a strange view behaviour when the machine is abnormally powered off. In my local development environment I run Couchbase inside a virtual machine, and sometimes I directly power off my laptop independently from the VM state. The VM is in a Virtualbox environment, I don’t know if this matters.

The problem is that one or more views are empty or with only a few documents, but the bucket still contains all the documents and I can access them from CB interface (or my application) without problems. I checked the definition of the view and has no problems, it should show at least 1.000 documents in my bucket. I noticed this problem can only happen when I forgot to power the VM off before my laptop, so I suppose this problem is related to an un-expected Couchbase termination, but it is only my opinion!

Fortunately it doesn’t appear frequently, but when it appears I immediately notice it at the VM startup because I can’t see all the documents inside views (e.g. only 10 documents are shown of more than 1.000 expected).
Another strange behaviour is that in this moment the view indexing process doesn’t begin and there is no way to make it run, even deleting and recreating both development and production design documents.

It seems that the view indexing process is unable to detect broken indexes or maybe cannot delete old dirty indexes* in the following folders:

  • /opt/couchbase/var/lib/couchbase/data/@indexes/bucket-name
  • /opt/couchbase/var/lib/couchbase/data/@indexes_dev/bucket-name

To overcome the problem the only solution I’ve found is to delete all the contents of the previous folders leaving them empty. In a few seconds the indexing process begins and at the end everything is fine and all views are up to date.

Does anyone experienced this kind of problem? Is it a bug?


* this supposition is done because every time I had that problem there were _tmp sub-folders inside the folders.