| 194 | } |
| 195 | |
| 196 | ACTOR static Future<Void> getChanges(ConfigNodeImpl* self, ConfigFollowerGetChangesRequest req) { |
| 197 | Version lastCompactedVersion = wait(getLastCompactedVersion(self)); |
| 198 | if (req.lastSeenVersion < lastCompactedVersion) { |
| 199 | ++self->failedChangeRequests; |
| 200 | req.reply.sendError(version_already_compacted()); |
| 201 | return Void(); |
| 202 | } |
| 203 | state Version committedVersion = |
| 204 | wait(map(getGeneration(self), [](auto const& gen) { return gen.committedVersion; })); |
| 205 | if (committedVersion < req.mostRecentVersion) { |
| 206 | // Handle a very rare case where a ConfigNode loses data between |
| 207 | // responding with a committed version and responding to the |
| 208 | // subsequent get changes request. |
| 209 | CODE_PROBE(true, "ConfigNode data loss occurred on a minority of coordinators"); |
| 210 | req.reply.sendError(process_behind()); // Reuse the process_behind error |
| 211 | return Void(); |
| 212 | } |
| 213 | state Standalone<VectorRef<VersionedConfigMutationRef>> versionedMutations = |
| 214 | wait(getMutations(self, req.lastSeenVersion + 1, committedVersion)); |
| 215 | state Standalone<VectorRef<VersionedConfigCommitAnnotationRef>> versionedAnnotations = |
| 216 | wait(getAnnotations(self, req.lastSeenVersion + 1, committedVersion)); |
| 217 | TraceEvent(SevDebug, "ConfigNodeSendingChanges", self->id) |
| 218 | .detail("ReqLastSeenVersion", req.lastSeenVersion) |
| 219 | .detail("CommittedVersion", committedVersion) |
| 220 | .detail("NumMutations", versionedMutations.size()) |
| 221 | .detail("NumCommits", versionedAnnotations.size()); |
| 222 | ++self->successfulChangeRequests; |
| 223 | req.reply.send(ConfigFollowerGetChangesReply{ committedVersion, versionedMutations, versionedAnnotations }); |
| 224 | return Void(); |
| 225 | } |
| 226 | |
| 227 | // New transactions increment the database's current live version. This effectively serves as a lock, providing |
| 228 | // serializability |
nothing calls this directly
no test coverage detected