TOOLS-4309 Fail with a specific error on the upgradeDowngradeViewlessTimeseries oplog entry - #1094
Open
mattb-mdb wants to merge 1 commit into
Open
TOOLS-4309 Fail with a specific error on the upgradeDowngradeViewlessTimeseries oplog entry#1094mattb-mdb wants to merge 1 commit into
mattb-mdb wants to merge 1 commit into
Conversation
…Timeseries oplog entry SERVER-114505 adds an oplog-only upgradeDowngradeViewlessTimeseries command, emitted during setFCV transitions across 8.x <-> 9.0 to convert timeseries collections between their viewful and viewless forms. Because knownCommands is a closed allowlist, mongorestore --oplogReplay aborted on it with a generic "unknown oplog command name" error. Neither one-line mitigation is correct. Allowlisting the entry lets it fall through to ApplyOp, but filterUUIDs strips ui unless --preserveUUID is set and the server handler tripwire-asserts that the UUID is present. Ignoring the entry skips the conversion, leaving the collection in a form that does not match the namespaces used by the oplog entries after it. Instead, intercept the command before the allowlist check and fail with a diagnostic naming the conversion and pointing at --oplogLimit. Also adds TestTimeseriesDumpConcurrentWithSetFCV, which resolves an open question from the investigation: a mongodump whose read is interrupted by the conversion fails with the server's InterruptedDueToTimeseriesUpgradeDowngrade error rather than silently producing a truncated dump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SERVER-114505 adds an oplog-only upgradeDowngradeViewlessTimeseries command, emitted during setFCV transitions across 8.x ↔ 9.0 to convert timeseries collections between their viewful and viewless forms. Because knownCommands is a closed allowlist, mongorestore --oplogReplay aborted on it with a generic unknown oplog command name error.
Changes
mongorestore/oplog.go — intercept the command ahead of the allowlist check and fail with a diagnostic that names the conversion, gives the timestamp, and points at --oplogLimit.
The entry is deliberately neither applied nor skipped. Allowlisting it would trip a server-side assertion (filterUUIDs strips ui unless --preserveUUID is set, and the handler asserts the UUID is present); ignoring it would leave the collection in a form that doesn't match the namespaces used by later oplog entries. Refusing the replay is the correct outcome.
Tests
TestOplogRestoreViewlessTimeseriesConversion (mongorestore/oplog_test.go) — builds a synthetic oplog with an insert followed by the conversion entry, in both the upgrade and downgrade (skipViewCreation) forms, and asserts the specific error. Also asserts the pre-conversion insert was applied, proving replay stops at the conversion. Synthetic, so it runs on any server version.
TestTimeseriesDumpConcurrentWithSetFCV (mongodump/mongodump_test.go) — resolves an open question from the investigation: a mongodump that overlaps a setFCV. Blocks the dump's getMore with the failCommand failpoint, runs setFCV 9.0 → 8.0 underneath it, and asserts the dump either contains every measurement or fails outright — never a silent truncation. Against 9.0.0-rc0 the server aborts the read with InterruptedDueToTimeseriesUpgradeDowngrade, so this is a hard error rather than data loss, and needs no tools-side change. Requires enableTestCommands=1 (CI has it); skips below 9.0 / FCV 9.0.