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

Method commit

fdbserver/KeyValueStoreMemory.actor.cpp:146–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 Future<Void> commit(bool sequential) override {
147 if (getAvailableSize() <= 0) {
148 TraceEvent(SevError, "KeyValueStoreMemory_OutOfSpace", id).log();
149 return Never();
150 }
151
152 if (recovering.isError())
153 throw recovering.getError();
154 if (!recovering.isReady())
155 return waitAndCommit(this, sequential);
156
157 if (!disableSnapshot && replaceContent && !firstCommitWithSnapshot) {
158 transactionSize += SERVER_KNOBS->REPLACE_CONTENTS_BYTES;
159 committedWriteBytes += SERVER_KNOBS->REPLACE_CONTENTS_BYTES;
160 semiCommit();
161 }
162
163 if (transactionIsLarge) {
164 fullSnapshot(data);
165 resetSnapshot = true;
166 committedWriteBytes = notifiedCommittedWriteBytes.get();
167 overheadWriteBytes = 0;
168
169 if (disableSnapshot) {
170 return Void();
171 }
172 log_op(OpCommit, StringRef(), StringRef());
173 } else {
174 int64_t bytesWritten = commit_queue(queue, !disableSnapshot, sequential);
175
176 if (disableSnapshot) {
177 return Void();
178 }
179
180 if (bytesWritten > 0 || committedWriteBytes > notifiedCommittedWriteBytes.get()) {
181 committedWriteBytes += bytesWritten + overheadWriteBytes +
182 OP_DISK_OVERHEAD; // OP_DISK_OVERHEAD is for the following log_op(OpCommit)
183 notifiedCommittedWriteBytes.set(committedWriteBytes); // This set will cause snapshot items to be
184 // written, so it must happen before the OpCommit
185 log_op(OpCommit, StringRef(), StringRef());
186 overheadWriteBytes = log->getCommitOverhead();
187 }
188 }
189
190 auto c = log->commit();
191
192 committedDataSize = data.sumTo(data.end());
193 transactionSize = 0;
194 transactionIsLarge = false;
195 firstCommitWithSnapshot = false;
196
197 addActor.send(commitAndUpdateVersions(this, c, previousSnapshotEnd));
198 return c;
199 }
200
201 Future<Optional<Value>> readValue(KeyRef key, IKeyValueStore::ReadType, Optional<UID> debugID) override {
202 if (recovering.isError())

Callers

nothing calls this directly

Calls 15

TraceEventClass · 0.85
fullSnapshotFunction · 0.85
log_opFunction · 0.85
getMethod · 0.65
setMethod · 0.65
commitMethod · 0.65
NeverClass · 0.50
VoidClass · 0.50
StringRefClass · 0.50
logMethod · 0.45
isErrorMethod · 0.45
getErrorMethod · 0.45

Tested by

no test coverage detected