Skip to content

Raise execute_command_until default timeout to 20 seconds - #737

Merged
eerxuan merged 3 commits into
documentdb:mainfrom
samafarc:fix/poll-timeout-20s
Nov 18, 2026
Merged

eerxuan merged 3 commits into
documentdb:mainfrom
samafarc:fix/poll-timeout-20s

Conversation

@samafarc

@samafarc samafarc commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

execute_command_until (added in #736) polls for state some engines publish
asynchronously. Its default timeout is 10 seconds. On an engine that
publishes $indexStats usage counters on a roughly 10-second cycle, the
counter often appears only on the last read before that deadline, and under
parallel load it sometimes misses it, so the test fails by timing.

This PR raises the default to 20 seconds, twice that cycle. Nothing else
changes: polling still stops as soon as the predicate accepts a result,
errors are still returned at once, and on an engine that reports the state
immediately the command still runs exactly once. The timeout only costs
time when the state never appears. docs/testing/TEST_FORMAT.md now states
the default.

Testing

  • pytest documentdb_tests/framework: 59 passed, including
    test_executor_polling.py.
  • pre-commit (black, isort, flake8, mypy) passes.
  • The 7 $indexStats counter tests in test_hidden_behavior.py and
    test_indexStats_ops_counter.py, together with the other tests in the
    files Route remaining test-side failures through the assertion #736 changed (94 tests), were run 18 times each on an x86_64 and an
    arm64 engine whose counters lag (15 runs with 8 workers, 2 with 6, 1
    serial). All passed. The slowest counter read took 10.5 s on x86_64 and
    10.7 s on arm64; 7 reads took longer than 10 s and would have failed with
    the old default.

Some engines publish $indexStats usage counters on a roughly 10-second
cycle, so a counter read right after a query can stay at 0 for about
10 seconds. With a 10-second poll the counter often arrived on the last
read, and under parallel load it sometimes missed it. A 20-second default
gives twice that cycle. Polling still stops as soon as the predicate
accepts a result, so the timeout only costs time when the state never
appears.

Signed-off-by: Samar Farooqi <samafarc@amazon.com>
@samafarc
samafarc requested a review from a team as a code owner November 18, 2026 18:58
15 seconds leaves about 5 seconds over the ~10-second counter cycle; the slowest counter read measured was 10.7 s.

Signed-off-by: Samar Farooqi <samafarc@amazon.com>
@samafarc samafarc changed the title Raise execute_command_until default timeout to 20 seconds Raise execute_command_until default timeout to 15 seconds Nov 18, 2026
@documentdb-triage-tool documentdb-triage-tool Bot added the documentation Improvements or additions to documentation label Nov 18, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: documentation
Project fields suggested: Component docs · Priority P2 · Effort M · Status Needs Review
Confidence: 0.95 (deterministic)

Reasoning

component from path globs (docs, test-framework); effort from diff stats (8+2 LOC, 2 files)

If a label is wrong, ping @patty-chow so the rules can be tuned. Issues with component labels are left alone; PR component labels are reconciled from changed paths on every run.

This reverts commit 5a0af39. 20 seconds gives twice the ~10-second counter cycle, and it is the limit the validation runs used.

Signed-off-by: Samar Farooqi <samafarc@amazon.com>
@samafarc samafarc changed the title Raise execute_command_until default timeout to 15 seconds Raise execute_command_until default timeout to 20 seconds Nov 18, 2026
@eerxuan
eerxuan merged commit 58394a4 into documentdb:main Nov 18, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants