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

Function applyMetadataEffect

fdbserver/CommitProxyServer.actor.cpp:984–1038  ·  view source on GitHub ↗

Compute and apply "metadata" effects of each other proxy's most recent batch

Source from the content-addressed store, hash-verified

982
983// Compute and apply "metadata" effects of each other proxy's most recent batch
984void applyMetadataEffect(CommitBatchContext* self) {
985 bool initialState = self->isMyFirstBatch;
986 self->firstStateMutations = self->isMyFirstBatch;
987 for (int versionIndex = 0; versionIndex < self->resolution[0].stateMutations.size(); versionIndex++) {
988 // pProxyCommitData->logAdapter->setNextVersion( ??? ); << Ideally we would be telling the log adapter that the
989 // pushes in this commit will be in the version at which these state mutations were committed by another proxy,
990 // but at present we don't have that information here. So the disk queue may be unnecessarily conservative
991 // about popping.
992
993 for (int transactionIndex = 0;
994 transactionIndex < self->resolution[0].stateMutations[versionIndex].size() && !self->forceRecovery;
995 transactionIndex++) {
996 bool committed = true;
997 for (int resolver = 0; resolver < self->resolution.size(); resolver++)
998 committed =
999 committed && self->resolution[resolver].stateMutations[versionIndex][transactionIndex].committed;
1000 if (committed) {
1001 applyMetadataMutations(SpanContext(),
1002 *self->pProxyCommitData,
1003 self->arena,
1004 self->pProxyCommitData->logSystem,
1005 self->resolution[0].stateMutations[versionIndex][transactionIndex].mutations,
1006 /* pToCommit= */ nullptr,
1007 /* pCipherKeys= */ nullptr,
1008 self->forceRecovery,
1009 /* version= */ self->commitVersion,
1010 /* popVersion= */ 0,
1011 /* initialCommit */ false);
1012 }
1013 if (self->resolution[0].stateMutations[versionIndex][transactionIndex].mutations.size() &&
1014 self->firstStateMutations) {
1015 ASSERT(committed);
1016 self->firstStateMutations = false;
1017 self->forceRecovery = false;
1018 }
1019 }
1020
1021 // These changes to txnStateStore will be committed by the other proxy, so we simply discard the commit message
1022 auto fcm = self->pProxyCommitData->logAdapter->getCommitMessage();
1023 self->storeCommits.emplace_back(fcm, self->pProxyCommitData->txnStateStore->commit());
1024
1025 if (initialState) {
1026 initialState = false;
1027 self->forceRecovery = false;
1028 self->pProxyCommitData->txnStateStore->resyncLog();
1029
1030 for (auto& p : self->storeCommits) {
1031 ASSERT(!p.second.isReady());
1032 p.first.get().acknowledge.send(Void());
1033 ASSERT(p.second.isReady());
1034 }
1035 self->storeCommits.clear();
1036 }
1037 }
1038}
1039
1040/// Determine which transactions actually committed (conservatively) by combining results from the resolvers
1041void determineCommittedTransactions(CommitBatchContext* self) {

Callers 1

Calls 12

applyMetadataMutationsFunction · 0.85
SpanContextClass · 0.85
getCommitMessageMethod · 0.80
emplace_backMethod · 0.80
commitMethod · 0.65
getMethod · 0.65
clearMethod · 0.65
VoidClass · 0.50
sizeMethod · 0.45
resyncLogMethod · 0.45
isReadyMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected