Skip to content

Fix/changestream early start lazy oplog - #727

Open
samafarc wants to merge 2 commits into
documentdb:mainfrom
samafarc:fix/changestream-early-start-lazy-oplog
Open

samafarc wants to merge 2 commits into
documentdb:mainfrom
samafarc:fix/changestream-early-start-lazy-oplog

Conversation

@samafarc

Copy link
Copy Markdown
Contributor

Read the oplog only when an early-start case needs it

test_changeStream_early_start.py calls _oldest_oplog_ts(collection) for every case before running the command. Only oldest_minus_5s uses the value. zero, one_zero and max_increment ignore it. On an engine with no readable local.oplog.rs, those cases fail with StopIteration before the command runs. That hides whether the engine accepts an early startAtOperationTime.

compute_start now takes a callable, so only oldest_minus_5s reads the oplog.
The amazon-documentdb profile no longer declares oplog, which it doesn't expose. oldest_minus_5s is marked requires(oplog=True). This also skips the two collMod tests that target local.oplog.rs on that profile.
Testing: the static cases read the oplog 0 times and oldest_minus_5s reads it once. On amazon-documentdb, oldest_minus_5s is skipped by precondition. Collect-only passes and the framework unit tests pass (48). Not run against a live server.

test_changeStream_early_start looked up the oldest oplog entry for
every parametrized case, before running the change-stream command.
Only oldest_minus_5s uses that value; zero, one_zero and max_increment
use static start times. On a target with no readable oplog entry the
lookup raises StopIteration, so those three cases never reach the
server and record nothing about whether an early startAtOperationTime
is accepted.

Pass compute_start a callable that performs the lookup, so the oplog
is read only by the case that uses it.

Signed-off-by: Samar Farooqi <samafarc@amazon.com>
Amazon DocumentDB does not expose its replication log as
local.oplog.rs: reading the oldest entry returns no document. The
amazon-documentdb profile declared the oplog capability anyway, so
oplog-dependent cases ran and failed in test code rather than being
gated.

Remove oplog from the profile and mark the oldest_minus_5s case of
test_changeStream_early_start with requires(oplog=True), the one case
that reads the oplog. The two collMod oplog cases
(max_target_oplog, size_target_oplog) are already gated on oplog and
are now skipped on Amazon DocumentDB.

Signed-off-by: Samar Farooqi <samafarc@amazon.com>
@samafarc
samafarc requested a review from a team as a code owner October 19, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant