| 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)); |
nothing calls this directly
no test coverage detected