SERVER-115307: Always log optime when replication fails to apply an operation (#48086)

GitOrigin-RevId: 9f375ff8da4a702da3c5e6c734c853cef5b59f43
This commit is contained in:
Indy Prentice
2026-02-18 15:05:08 -06:00
committed by MongoDB Bot
parent 1e0e62bb30
commit 413475e158
4 changed files with 5 additions and 119 deletions

38
.github/CODEOWNERS vendored
View File

@@ -1,38 +0,0 @@
# All backports must be approved by the server release team
* @10gen/server-release
# Exclude some test files and READMEs from the backport approvals
/etc/backports_required_for_multiversion_tests.yml
/etc/*.suppressions
README.md
# Exclude test-only related files from server-release approvals
jstests/
/src/mongo/dbtests/
/src/mongo/**/*_test.cpp
/src/mongo/**/*_bm.cpp
# Exclude coverity-related files from server-release approvals
bazel/coverity/
bazel/coverity/coverity_toolchain.BUILD
bazel/coverity/coverity_toolchain.bzl
bazel/coverity/generate_coverity_targets.py
evergreen/coverity_build.sh
etc/coverity.yml
etc/coverity_parse_warnings.conf
etc/evergreen_yml_components/tasks/coverity_tasks.yml
etc/evergreen_yml_components/variants/coverity.yml
# Exclude sbom-related files from server-release approvals
README.third_party.md
sbom.json
buildscripts/sbom_linter.py
buildscripts/sbom/*
buildscripts/tests/test_generate_sbom.py
buildscripts/tests/sbom_linter/*
buildscripts/tests/sbom_linter/inputs/*
src/third_party/scripts/gen_thirdpartyreadme.py
src/third_party/scripts/README.third_party.md.template
# Changes to WT sources can be approved by wiredtiger release team
src/third_party/wiredtiger/ @10gen/wiredtiger-release @10gen/server-release

View File

@@ -1,81 +0,0 @@
on:
pull_request:
types: [opened, edited]
concurrency:
group: pr-comment-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
comment-policy:
runs-on: ubuntu-latest
steps:
- name: Post comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const targetBranch = context.payload.pull_request.base.ref;
const prNumber = context.issue.number;
const prAuthor = context.payload.pull_request.user.login;
// Define regex patterns for production release and staging branches
const productionBranchRegex = /^v[0-9]\.[0-9]$/;
const stagingBranchRegex = /^v[0-9]\.[0-9]-staging$/;
console.log(`PR target branch: ${targetBranch}`);
// Define comments for each branch
let commentBody = null;
if (stagingBranchRegex.test(targetBranch)) {
commentBody =
"### [Backport Policy](https://wiki.corp.mongodb.com/spaces/KERNEL/pages/155324063/Database+SERVER+Backports+Policy+and+Workflow) Overview\n\n" +
"@" + prAuthor + ", please ensure the following:\n\n" +
"- A full Evergreen patch has been run, and the patch link has been posted in this PR. Any failures should be reviewed and explicitly confirmed as unrelated in the PR comments.\n" +
"- The PR has been reviewed by a member of the [server-backport-mergers](https://github.com/orgs/10gen/teams/server-backport-mergers) team.\n" +
"- For feature backports requiring a break-glass rebase: **Do not enable auto-merge**. Instead, post in [#10gen-mongo-break-glass-requests](https://mongodb.enterprise.slack.com/archives/C0877CMLRB4) for manual review.\n\n" +
"The [server-backport-mergers](https://github.com/orgs/10gen/teams/server-backport-mergers) reviewer is responsible for enabling auto-merge after completing their review. Once auto-merge is enabled, @svc-auto-approve-bot will periodically evaluate merge readiness and approve the PR on behalf of Server Release when criteria is met.\n\n" +
"---\n" +
"Check Release Dates: [Server Release Schedule](https://jira.mongodb.org/secure/Dashboard.jspa?selectPageId=33483).\n" +
"For questions, please reach out in [#server-release](https://mongodb.enterprise.slack.com/archives/C1XQ502TA).";
} else if (productionBranchRegex.test(targetBranch)) {
const correspondingStagingBranch = `${targetBranch}-staging`;
commentBody =
"### [Backport Policy](https://wiki.corp.mongodb.com/spaces/KERNEL/pages/155324063/Database+SERVER+Backports+Policy+and+Workflow) Overview\n\n" +
"@" + prAuthor + ", This branch (`" + targetBranch + "`) is a production release branch and does not accept direct PRs.\n" +
"All changes must flow through the corresponding staging branch (`" + correspondingStagingBranch + "`), where they are tested and validated before being promoted into `" + targetBranch + "` by the Server Release team.\n\n" +
"**Next step:** Please re-open this PR against `" + correspondingStagingBranch + "`.\n\n"+
"Please reach out in [#server-release](https://mongodb.enterprise.slack.com/archives/C1XQ502TA) if you have any questions.";
} else {
console.log(`Branch ${targetBranch} does not match the Server Release branch pattern. Skipping.`);
return;
}
// Check if the comment for this branch already exists
console.log("Checking for existing comments...");
const { data: comments } = await github.rest.issues.listComments({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
});
const alreadyCommented = comments.some(comment => comment.body && comment.body.includes(commentBody));
if (alreadyCommented) {
console.log("Comment already posted for this branch. Skipping.");
return;
}
// Post the comment if it hasn't been posted yet
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody,
});
console.log(`Comment posted: ${commentBody}`);

View File

@@ -716,6 +716,8 @@ StatusWith<OpTime> OplogApplierImpl::_applyOplogBatch(OperationContext* opCtx,
"numOperationsInBatch"_attr = ops.size(),
"firstOperation"_attr = redact(ops.front().toBSONForLogging()),
"lastOperation"_attr = redact(ops.back().toBSONForLogging()),
"firstOperationOpTime"_attr = ops.front().getOpTime(),
"lastOperationOpTime"_attr = ops.back().getOpTime(),
"failedWriterThread"_attr = std::distance(statusVector.cbegin(), it),
"error"_attr = redact(status));
return status;

View File

@@ -664,6 +664,7 @@ Status OplogApplierUtils::applyOplogBatchCommon(
LOGV2_FATAL_CONTINUE(21237,
"Error applying operation",
"opTime"_attr = op->getOpTime(),
"oplogEntry"_attr = redact(op->toBSONForLogging()),
"error"_attr = causedBy(redact(status)));
return status;
@@ -675,6 +676,7 @@ Status OplogApplierUtils::applyOplogBatchCommon(
"keyPattern"_attr = info->getKeyPattern(),
"keyValue"_attr = redact(info->getDuplicatedKeyValue()),
"error"_attr = redact(e.reason()),
"opTime"_attr = op->getOpTime(),
"oplogEntry"_attr = redact(op->toBSONForLogging()));
return e.toStatus();
} catch (const DBException& e) {
@@ -701,6 +703,7 @@ Status OplogApplierUtils::applyOplogBatchCommon(
LOGV2_FATAL_CONTINUE(21238,
"Writer worker caught exception",
"error"_attr = redact(e),
"opTime"_attr = op->getOpTime(),
"oplogEntry"_attr = redact(op->toBSONForLogging()));
return e.toStatus();
}