SERVER-125655 Remove collection and resume state table args from _writeStateToDisk (#52852)

GitOrigin-RevId: c38f4fb21c6c252602fa6bf9ddc0f1686de5d53d
This commit is contained in:
Stephanie 2026-04-29 14:00:05 -04:00 committed by MongoDB Bot
parent f92893881d
commit 6d086d138a
3 changed files with 5 additions and 102 deletions

View File

@ -1,90 +0,0 @@
# This configuration is for migrating code from one Git repository to another using Copybara.
# It selectively copies content, excluding specific paths and preserving authorship.
sourceUrl = "https://github.com/10gen/mongo.git"
prodUrl = "https://github.com/mongodb/mongo.git"
testUrl = "https://github.com/10gen/mongo-copybara.git"
testBranch = "copybara_test_branch"
prodRefForPinnedSourceCommit = "master"
def make_workflow(workflow_name, destination_url, source_ref, destination_ref):
core.workflow(
name = workflow_name,
origin = git.origin(
url = "https://github.com/10gen/mongo.git",
ref = source_ref,
),
destination = git.destination(
url = destination_url,
fetch = destination_ref,
push = destination_ref,
),
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = [
"src/mongo/db/modules/**",
"buildscripts/modules/**",
".github/workflows/**",
"src/third_party/private/**",
"sbom.private.json",
".agents/**",
".cursor/**",
".claude/**",
"AGENTS.md",
"CLAUDE.md",
".github/CODEOWNERS",
"monguard/**",
"etc/evergreen_yml_components/**",
]),
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
mode = "ITERATIVE",
transformations = [
# The transformation rules below will remove the commit message's body, while preserving
# any trailer lines that have acceptable keys (Co-authored-by, etc). The first line of
# the commit message (ie. the commit's subject/summary line) is also always retained.
#
# Achieving this requires a 4 step process.
#
# STEP 1: Non-initial lines (ie. those which appear after a newline char) that start with
# an acceptable trailer key are preserved, but any other lines have their content removed
# (leaving a blank line).
#
# This works because the first .* (inside capture group 1) only matches if the line starts
# with a trailer key. If it doesn't, then the line is fully consumed by the second .*
# (which is outside the capture group, and therefore $1 is empty).
metadata.scrubber(
"\n((?:Co-authored-by|Signed-off-by|Reviewed-by): .*)?.*",
replacement = "\n$1",
),
#
# STEP 2: Remove blank lines, ie. sequences of newlines get condensed down to one newline.
metadata.scrubber("\n+", replacement = "\n"),
#
# STEP 3: Remove any trailing newline.
metadata.scrubber("\n$", replacement = ""),
#
# STEP 4: If there are trailer lines (ie. if the first line has a newline followed by more
# text), then add an extra blank line after the first line, ie. to separate the commit's
# trailers from the subject line.
#
# The first capture group (^.*?\n) is the first line (non-greedily consuming chars until a
# newline), while the second capture group ((\n|.)*) is the rest of the message (greedily
# consume all chars, including newlines).
# If there are no trailers, then there will only be a single line of text, with no newline
# chars, and so the pattern will fail to match.
metadata.scrubber("(^.*?\n)((?:\n|.)*)", replacement = "$1\n$2"),
#
# STEP 5: Replace any private links with their public equivalent.
core.replace(
before = "https://github.com/10gen/mongo",
after = "https://github.com/mongodb/mongo",
paths = glob(["**/*.md"]),
),
],
)
# push to the public repo
make_workflow("prod", prodUrl, prodRefForPinnedSourceCommit, "master")
# push to private test repo to validate configs
make_workflow("test", testUrl, testBranch, testBranch)

View File

@ -1484,7 +1484,7 @@ void MultiIndexBlock::persistResumeState(OperationContext* opCtx,
if (useContainerWrite) {
_writeStateToContainer(opCtx);
} else {
_writeStateToDisk(opCtx, collection, _resumeStateTempRecordStore->getOrCreateTable(opCtx));
_writeStateToDisk(opCtx);
}
}
@ -1519,17 +1519,15 @@ void MultiIndexBlock::abortWithoutCleanup(OperationContext* opCtx,
if (useContainerWrite) {
_writeStateToContainer(opCtx);
} else {
_writeStateToDisk(
opCtx, collection, _resumeStateTempRecordStore->getOrCreateTable(opCtx));
_writeStateToDisk(opCtx);
}
}
_buildIsCleanedUp = true;
}
void MultiIndexBlock::_writeStateToDisk(OperationContext* opCtx,
const CollectionPtr& collection,
RecordStore& rs) const {
void MultiIndexBlock::_writeStateToDisk(OperationContext* opCtx) {
auto& rs = _resumeStateTempRecordStore->getOrCreateTable(opCtx);
auto obj = _constructStateObject();
WriteUnitOfWork wuow(opCtx);
@ -1540,7 +1538,6 @@ void MultiIndexBlock::_writeStateToDisk(OperationContext* opCtx,
"Index build: failed to truncate temporary record store for resumable state",
"buildUUID"_attr = _buildUUID,
"collectionUUID"_attr = _collectionUUID,
logAttrs(collection->ns()),
"details"_attr = obj,
"error"_attr = truncateStatus);
dassert(truncateStatus,
@ -1559,7 +1556,6 @@ void MultiIndexBlock::_writeStateToDisk(OperationContext* opCtx,
"Index build: failed to write resumable state to disk",
"buildUUID"_attr = _buildUUID,
"collectionUUID"_attr = _collectionUUID,
logAttrs(collection->ns()),
"details"_attr = obj,
"error"_attr = insertStatus.getStatus());
dassert(insertStatus,
@ -1574,7 +1570,6 @@ void MultiIndexBlock::_writeStateToDisk(OperationContext* opCtx,
"Index build: wrote resumable state to disk",
"buildUUID"_attr = _buildUUID,
"collectionUUID"_attr = _collectionUUID,
logAttrs(collection->ns()),
"details"_attr = obj);
}

View File

@ -357,9 +357,7 @@ private:
const IndexCatalogEntry* entryForScan = nullptr;
};
void _writeStateToDisk(OperationContext* opCtx,
const CollectionPtr& collection,
RecordStore& rs) const;
void _writeStateToDisk(OperationContext* opCtx);
/**
* Performs a container write to persist build state to the resumable table.