…lines 1–48 unchanged (48 lines)
49#include "mongo/db/dbhelpers.h"
50#include "mongo/db/import_collection_oplog_entry_gen.h"
51#include "mongo/db/index/index_constants.h"
52#include "mongo/db/index_builds/index_build_oplog_entry.h"
53#include "mongo/db/index_builds/index_builds_coordinator.h"
54#include "mongo/db/index_builds/index_builds_manager.h"
55#include "mongo/db/index_builds/primary_driven/util.h"
56#include "mongo/db/namespace_string.h"
57#include "mongo/db/op_observer/op_observer.h"
58#include "mongo/db/op_observer/op_observer_util.h"
59#include "mongo/db/pipeline/change_stream_preimage_gen.h"
60#include "mongo/db/profile_settings.h"
61#include "mongo/db/query/find_command.h"
…lines 62–1062 unchanged (1001 lines)
1063 }
1064 if (shouldGenerateInternalIdents) {
1065 indexBuildInfo.setInternalIdents(*storageEngine);
1066 }
1067 }
1068
1069 if (mongo::feature_flags::gFeatureFlagPrimaryDrivenIndexBuilds
1070 .isEnabledUseLastLTSFCVWhenUninitialized(
1071 VersionContext::getDecoration(opCtx),
1072 serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
1073 return index_builds::primary_driven::start(opCtx,
1074 entry.getNss().dbName(),
1075 oplogEntry.collUUID,
1076 oplogEntry.buildUUID,
1077 oplogEntry.indexes);
1078 }
1079
1080 IndexBuildsCoordinator::ApplicationMode applicationMode =
1081 IndexBuildsCoordinator::ApplicationMode::kNormal;
1082 if (mode == OplogApplication::Mode::kInitialSync) {
1083 applicationMode = IndexBuildsCoordinator::ApplicationMode::kInitialSync;
1084 }
…lines 1085–1104 unchanged (20 lines)
1105 const auto& entry = *op;
1106 auto swOplogEntry = IndexBuildOplogEntry::parse(opCtx, entry);
1107 if (!swOplogEntry.isOK()) {
1108 return swOplogEntry.getStatus().withContext(
1109 "Error parsing 'commitIndexBuild' oplog entry");
1110 }
1111 auto oplogEntry = std::move(swOplogEntry.getValue());
1112
1113 if (mongo::feature_flags::gFeatureFlagPrimaryDrivenIndexBuilds
1114 .isEnabledUseLastLTSFCVWhenUninitialized(
1115 VersionContext::getDecoration(opCtx),
1116 serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
1117 return index_builds::primary_driven::commit(opCtx,
1118 entry.getNss().dbName(),
1119 oplogEntry.collUUID,
1120 oplogEntry.buildUUID,
1121 oplogEntry.indexes,
1122 oplogEntry.multikey);
1123 }
1124
1125 auto* indexBuildsCoordinator = IndexBuildsCoordinator::get(opCtx);
1126 indexBuildsCoordinator->applyCommitIndexBuild(opCtx, oplogEntry);
1127 return Status::OK();
1128 },
1129 {ErrorCodes::IndexAlreadyExists,
1130 ErrorCodes::IndexBuildAlreadyInProgress,
1131 ErrorCodes::NamespaceNotFound,
1132 ErrorCodes::NoSuchKey}}},
…lines 1133–1139 unchanged (7 lines)
1140
1141 auto swOplogEntry = IndexBuildOplogEntry::parse(opCtx, *op);
1142 if (!swOplogEntry.isOK()) {
1143 return swOplogEntry.getStatus().withContext(
1144 "Error parsing 'abortIndexBuild' oplog entry");
1145 }
1146 auto oplogEntry = std::move(swOplogEntry.getValue());
1147
1148 if (mongo::feature_flags::gFeatureFlagPrimaryDrivenIndexBuilds
1149 .isEnabledUseLastLTSFCVWhenUninitialized(
1150 VersionContext::getDecoration(opCtx),
1151 serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
1152 return index_builds::primary_driven::abort(opCtx,
1153 op->getNss().dbName(),
1154 oplogEntry.collUUID,
1155 oplogEntry.buildUUID,
1156 oplogEntry.indexes,
1157 *oplogEntry.cause);
1158 }
1159
1160 IndexBuildsCoordinator::get(opCtx)->applyAbortIndexBuild(opCtx, oplogEntry);
1161 return Status::OK();
1162 },
1163 {ErrorCodes::NamespaceNotFound}}},
1164 {"collMod",
1165 {[](OperationContext* opCtx, const ApplierOperation& op, OplogApplication::Mode mode)
1166 -> Status {
…lines 1167–3230 unchanged (2064 lines)