File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 229229 },
230230 "conflict_resolution_type" : {
231231 "default" : " seqno" ,
232+ "desr" : " Conflict resolution mode to use for this Bucket" ,
232233 "dynamic" : false ,
233234 "type" : " std::string" ,
234235 "validator" : {
235236 "enum" : [
236237 " seqno" ,
237- " lww"
238+ " lww" ,
239+ " custom"
238240 ]
239241 }
240242 },
Original file line number Diff line number Diff line change @@ -5259,13 +5259,13 @@ bool EventuallyPersistentEngine::decodeWithMetaOptions(
52595259 bool check1 = generateCas == GenerateCas::Yes &&
52605260 checkConflicts == CheckConflicts::Yes;
52615261
5262- // 2) If bucket is LWW and forceFlag is not set and GenerateCas::No
5263- bool check2 = configuration.getConflictResolutionType () == " lww " &&
5262+ // 2) If bucket is LWW/Custom and forceFlag is not set and GenerateCas::No
5263+ bool check2 = configuration.getConflictResolutionType () != " seqno " &&
52645264 !forceFlag && generateCas == GenerateCas::No;
52655265
5266- // 3) If bucket is not LWW then forceFlag must be false.
5266+ // 3) If bucket is seqno then forceFlag must be false.
52675267 bool check3 =
5268- configuration.getConflictResolutionType () != " lww " && forceFlag;
5268+ configuration.getConflictResolutionType () == " seqno " && forceFlag;
52695269
52705270 // So if either check1/2/3 is true, return false
52715271 return !(check1 || check2 || check3);
Original file line number Diff line number Diff line change @@ -240,10 +240,12 @@ VBucket::VBucket(Vbid i,
240240 seqnoAckCb(std::move(seqnoAckCb)),
241241 manifest(std::move(manifest)),
242242 mayContainXattrs(mightContainXattrs) {
243- if (config.getConflictResolutionType (). compare ( " lww " ) == 0 ) {
244- conflictResolver. reset ( new LastWriteWinsResolution () );
243+ if (config.getConflictResolutionType () == " seqno " ) {
244+ conflictResolver = std::make_unique<RevisionSeqnoResolution>( );
245245 } else {
246- conflictResolver.reset (new RevisionSeqnoResolution ());
246+ // Both last-write-wins and custom conflict resolution are treated
247+ // as LWW from KV-Engine's pov.
248+ conflictResolver = std::make_unique<LastWriteWinsResolution>();
247249 }
248250
249251 pendingOpsStart = std::chrono::steady_clock::time_point ();
You can’t perform that action at this time.
0 commit comments