View are inconsistent very long after data creation

I am examining CB as a replacement for MySql. I’m using CB 3.0.1 (CE) and java client 1.2.3.
I have a 3 node CB cluster with 4 buckets (all of type: couchbase).
One of the buckets has 4 views in 2 design documents (2 views each). This is a rapidly growing bucket (a lot of inserts and a lot of updates).

The problem:
Sometimes (1% of the cases), results from the views are inconsistent with the actual data. I can’t reproduce this - I can only detect that after it happens. I see the problem since I insert the same data into MySql and CB and then get them from MySql and CB (using view) and compare them - the results are not the same. After some time (few days sometimes), the view does return the correct results. I’m using stale=false.

From reading about disk writes, it appears that they happen quickly (a few seconds) so it can’t be that data is not written to disk within days.
Moreover, since this is CB 3.0.1 stream-based views should be applied and so indexes should be updated even before it is written to disk.

So, I don’t know how it happens that my results in the views are so far from being up-to-date.

can anyone suggest an explanation?


Hi Asaf,

There is always some lag between writing data to Couchbase and the views being updates, even when the views are drawing from the DCP stream.

My first suggestion is that you might want to switch to N1QL using GSI indexes. That’ll give you a much more MySQL-like experience when querying Couchbase. You’ll need a more recent version of Couchbase Server to use N1QL; 4.0.0 is the most recent version of Community Edition.

Coming back to the specific issue you mention, I have two questions:

  • How many documents are in the bucket?
  • Is it definite that the lag is days long?

You’re right that we shouldn’t be seeing a lag of days; depending on the dataset size and your hardware, we should be talking milliseconds or seconds.



Hi Matthew,

  1. The bucket has about 1.5M documents (1.5GB of data - most of it in RAM).
  2. I’m 99% sure that the lag is a couple of days: the view value contains the time of the document creation and my logs show that 3 days after that time, the document was not retrieved by the view.

what can possibly cause a lag of days?

We had problems with indexes too with the Community Edition 3.0.1.

  1. setting stale = false and timeouts
  2. index that stopped working
    No problems since we upgraded to Enterprise Edition 3.1.3 a week ago.



Hi Fred,
so you are now a paying customer? what were the reasons for switching to EE?

We are still in the development phase and we still need to decide which version we’ll use in production. One thing is sure: not the Community 3.0.1 Ubuntu version.
The reason for migrating from Community 2.2 to 3.0.1: faster indexes as explained by Couchbase.
We thought that having only one node could be the reason of those problems.
We decided to check the Enterprise Edition after having found threads on this forum talking about patches.
Warning: we had to use an old backup of our 2.2 version to create the database because the 3.0.1 backup tool has also problems.