Skip to content

perf(experience): read the incubation scope-head snapshot once per window - #2225

Open
Inference1 wants to merge 2 commits into
oceanbase:masterfrom
Inference1:perf/incubation-experience-snapshot
Open

Inference1 wants to merge 2 commits into
oceanbase:masterfrom
Inference1:perf/incubation-experience-snapshot

Conversation

@Inference1

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

No issue to close. Found while reviewing the Experience incubation read path.

Rationale for this change

RelationalRecurrenceLedger.record_window handles every task-outcome row without a handoff receipt by matching it against all active Experiences of the Scope. Each such row re-read that snapshot with one ArtifactRepository.get per Experience, so a window cost rows x Experiences x 2 statements and grew with both dimensions.

Measured on the recurrence ledger with the scenario from tests/e2e/test_recurring_failure_repair.py (statements counted at the engine level):

active Experiences outcome rows before after
1 1 22 22
10 1 31 13
40 1 91 13
10 4 115 34
40 4 355 34

What changes are included in this PR?

  • record_window parses the outcomes once, reads the scope-head snapshot once when any row is unlinked, and passes it to _record_outcome. This method writes no Artifacts, so one snapshot per window returns the same data that every row used to re-read.
  • _contents loads the cited revisions with one get_many batch. get_many is all-or-nothing, so RepositoryNotFoundError falls back to the previous per-reference skip loop.
  • New guard test_incubation_statement_count_does_not_grow_with_scope_experiences: equal counts for 10 and 40 active Experiences, with a ceiling one statement above the measured value.

Are there any user-facing changes?

No. The recurrence proposals, matches and observations are unchanged.

How was this change tested?

  • pytest tests/builtin/runtime/test_recurrence_ledger.py tests/e2e/test_recurring_failure_repair.py -q -> 16 passed.
  • pytest tests/e2e/test_portable_archive.py::test_restore_rejects_invalid_remote_source_dependencies_before_writing -q -> 8 passed.
  • The new guard fails on the pre-fix code (assert 31 == 91) and passes with the change.
  • ruff check and ruff format --check pass on both changed files.

…ndow

An outcome without a handoff receipt matches against every active Experience,
and every such row reloaded that snapshot with one get() per Experience. Load
it once per window and batch the revision reads with get_many; the window
writes no artifacts, so each row sees the same heads.

Measured with 40 Experiences and four outcome rows: 355 -> 34 statements.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit 8d87321edd346d5dd83297e9fbc04330d44602a6; no correctness findings in the snapshot reuse or batched reads. SQLite differential probes preserved matches, observations, proposals, and replay behavior, including missing citations and batches over 100 revisions.

One validation issue remains: code-seekdb (3.14) timed out after 10 minutes in the embedded SeekDB migration step, while running test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix[True-seekdb]. Please rerun or investigate that check before merging. The log does not establish that this failure was caused by this PR; I did not independently run the OceanBase/SeekDB acceptance tests.

@hidb4ai hidb4ai added the 1.5.0 v1.5.0 release tracking label Oct 25, 2026
@Inference1

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the code-seekdb (3.14) failure:

  • The failing step is Test unified migrations with embedded seekdb. The log shows a per-test timeout in tests/e2e/test_topic_memory_recovery_migration.py::test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix[True-seekdb] (Timeout (0:02:00) at 12:04:50Z, job 120865903438); the [False-seekdb] variant passed two minutes earlier.
  • The same step timed out on two unrelated branches the same day: run 40066690145 (job 120792692143, codex/issue-2154-full-server-upgrade) and run 40065705204 (job 120789082090, codex/2084-portable-receipt-layout), both with The action 'Test unified migrations with embedded seekdb' has timed out.
  • On master the same job finishes in about five minutes: run 40155994950 (02:54Z) and run 40160706205 (04:12Z) both passed.

This PR changes only runtime/recurrence.py (Experience incubation reads) and its test; it does not touch migrations, topic memory or SeekDB. I did not run the embedded SeekDB migration suite locally, so I cannot add a local control for it.

I do not have write access to re-run the job. Could you re-run code-seekdb (3.14) (or the whole run)?

The code-seekdb (3.14) job timed out in the embedded SeekDB migration step;
the same step also timed out on unrelated branches that day.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.0 v1.5.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants