Skip to content

Commit

Permalink
MB-49207: Set cas on temp items
Browse files Browse the repository at this point in the history
So that we can use the cas as a "token" to determine if the item
in the HashTable at the point of the completion of the BgFetch is
the same as the item that originally drove the BgFetch.

Change-Id: Iff7b9118f6839b7d7590e189c46c6650385c3dff
Reviewed-on: https://review.couchbase.org/c/kv_engine/+/165105
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
  • Loading branch information
BenHuddleston authored and daverigby committed Nov 18, 2021
1 parent 67a62d0 commit 4d2ad48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engines/ep/src/vbucket.cc
Expand Up @@ -3875,6 +3875,12 @@ VBucket::AddTempSVResult VBucket::addTempStoredValue(

updateRevSeqNoOfNewStoredValue(*v);

// MB-49207: We set the cas of temp items so that when we complete a BGFetch
// we can check that we are replacing the correct temp item with the one
// that triggered the BGFetch. If we didn't then we'd run the risk of
// fetching older revisions of documents back into memory.
v->setCas(nextHLCCas());

return {TempAddStatus::BgFetch, v};
}

Expand Down

0 comments on commit 4d2ad48

Please sign in to comment.