MB-21587: Rollback: Don't use CAS when rolling back values in HashTable
When ep-engine performs a rollback, if a key needs to be reverted to a
previous value (it has been modified since the rollbackSeqno), the
HashTable update fails due to being called incorrectly - it uses a set
with CAS (where the CAS used is the one for the previous item),
whereas the element in the HashTable will have a newer CAS (by
defintion as we are trying to roll it back).
The effect of this is that after rollback, old values for keys still
exist in memory (disk is correct) on the replica vBucket(s). In the
event of a subsequent failover (and promotion of the replica ->
active), incorrect values will be returned for such keys.
Fix by changing the HashTable::set to a non-CAS one.
As part of testing, made use of recently-added equality and output
operators for Item and related classes:
[ RUN ] RollbackTest.MB21587_RollbackAfterMutation
source/ep-engine/tests/module_tests/evp_store_rollback_test.cc:70: Failure
Value of: *result.getValue()
Actual: Item[0x10441d860] with key:a
value:Blob[0x104543180] with size:5 extMetaLen:1 age:0 data: <01 01 n e w>
metadata:ItemMetaData[0x10441d868] with cas:
5407a59650006 revSeqno:2 flags:0 exptime:0
bySeqno:7 queuedTime:0 vbucketId:0 op:set nru:2
Expected: item_v1
Which is: Item[0x7fff5f181ce0] with key:a
value:Blob[0x104543160] with size:5 extMetaLen:1 age:0 data: <01 01 o l d>
metadata:ItemMetaData[0x7fff5f181ce8] with cas:
5407a59650005 revSeqno:1 flags:0 exptime:0
bySeqno:6 queuedTime:0 vbucketId:0 op:set nru:2
Fetched item after rollback should match item_v1
[ FAILED ] RollbackTest.MB21587_RollbackAfterMutation (22 ms)
Change-Id: I32577afd0f6f9c79122575f84a76acd00fb6f89a
Reviewed-on: http://review.couchbase.org/69478
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
Reviewed-by: Manu Dhundi <manu@couchbase.com>