Details
-
Improvement
-
Resolution: Fixed
-
Major
-
5.0.0
-
None
Description
The current behaviour of ep-engine under full eviction is to assume that any mutation to a non-resident key is an Insert - i.e. the creation of a new item - and hence will increase the bucket item count. If this assumption is found to be false when the persistence callback completes, then a correction factor is applied (we decrement 1 from curr_items).
The net effect is the item count is correct eventually (when mutations quiesce), but it can over-count while there are mutations outstanding.
This is problematic as it could mislead users - for example if they see their bucket has 1001 items in it when they know they only have 1000 documents.
Instead we should do the opposite - assume a mutation to a non-resident key is an update - and don't increment the count until the persistence callback can confirm that the mutation was an insert. The result of this is we may under-count before we quiesce; but that is (a) consistent with the rest of ep-engine and (b) less surprising to a user as we haven't made up an extra item.