MCPcopy Create free account
hub / github.com/apple/foundationdb / commitMutations

Method commitMutations

fdbserver/ConfigNode.actor.cpp:344–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 }
343
344 ACTOR static Future<Void> commitMutations(ConfigNodeImpl* self,
345 Standalone<VectorRef<VersionedConfigMutationRef>> mutations,
346 Standalone<VectorRef<VersionedConfigCommitAnnotationRef>> annotations,
347 Version commitVersion) {
348 Version latestVersion = 0;
349 int index = 0;
350 for (const auto& mutation : mutations) {
351 if (mutation.version > commitVersion) {
352 continue;
353 }
354 // Mutations should be in ascending version order.
355 ASSERT_GE(mutation.version, latestVersion);
356 if (mutation.version > latestVersion) {
357 latestVersion = mutation.version;
358 index = 0;
359 }
360 Key key = versionedMutationKey(mutation.version, index++);
361 Value value = ObjectWriter::toValue(mutation.mutation, IncludeVersion());
362 if (mutation.mutation.isSet()) {
363 TraceEvent("ConfigNodeSetting")
364 .detail("ConfigClass", mutation.mutation.getConfigClass())
365 .detail("KnobName", mutation.mutation.getKnobName())
366 .detail("Value", mutation.mutation.getValue().toString())
367 .detail("Version", mutation.version);
368 ++self->setMutations;
369 } else {
370 ++self->clearMutations;
371 }
372 self->kvStore->set(KeyValueRef(key, value));
373 }
374 for (const auto& annotation : annotations) {
375 self->kvStore->set(KeyValueRef(versionedAnnotationKey(annotation.version),
376 BinaryWriter::toValue(annotation.annotation, IncludeVersion())));
377 }
378 ConfigGeneration newGeneration = { commitVersion, commitVersion };
379 self->kvStore->set(KeyValueRef(currentGenerationKey, BinaryWriter::toValue(newGeneration, IncludeVersion())));
380 wait(self->kvStore->commit());
381 ++self->successfulCommits;
382 return Void();
383 }
384
385 ACTOR static Future<Void> commit(ConfigNodeImpl* self, ConfigTransactionCommitRequest req) {
386 ConfigGeneration currentGeneration = wait(getGeneration(self));

Callers

nothing calls this directly

Calls 14

versionedMutationKeyFunction · 0.85
IncludeVersionFunction · 0.85
TraceEventClass · 0.85
versionedAnnotationKeyFunction · 0.85
detailMethod · 0.80
getConfigClassMethod · 0.80
getKnobNameMethod · 0.80
setMethod · 0.65
commitMethod · 0.65
KeyValueRefClass · 0.50
VoidClass · 0.50
isSetMethod · 0.45

Tested by

no test coverage detected