Skip to content

fix(v2): prevent stale channel messages in MultiTree concurrency#1140

Open
songgaoye wants to merge 4 commits intocosmos:masterfrom
songgaoye:fix_v2_saveversion
Open

fix(v2): prevent stale channel messages in MultiTree concurrency#1140
songgaoye wants to merge 4 commits intocosmos:masterfrom
songgaoye:fix_v2_saveversion

Conversation

@songgaoye
Copy link
Copy Markdown

@songgaoye songgaoye commented Feb 27, 2026

SaveVersionConcurrently, SnapshotConcurrently, and WarmLeaves previously
used shared errorCh/doneCh channels. Surplus messages could remain in the
buffers and be consumed by later calls, causing version mismatches or
incorrect results.

Use per-call local result channels (one message per goroutine) to avoid
cross-call contamination. Remove the unused doneCh/errorCh fields and
saveVersionResult type, and have WarmLeaves collect all errors.

Add tests covering: single-tree error, all-trees error,
sequential
calls after recovery, SnapshotConcurrently error,
WarmLeaves error
collection, and happy path. Use tableSchema() to
reconstruct dropped
tables from sqlite_master rather than hardcoding column
definitions.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant