Skip to content

draft: compare explicit SchemeShard Grab snapshots with container undo - #47

Closed
Enjection wants to merge 1 commit into
draft/schemeshard-tpathreffrom
compare/schemeshard-typed-grabs
Closed

Enjection wants to merge 1 commit into
draft/schemeshard-tpathreffrom
compare/schemeshard-typed-grabs

Conversation

@Enjection

Copy link
Copy Markdown
Owner

Restore explicit typed Grab* proposal snapshots while keeping the automatic path-reference ownership from ydb-platform/ydb#46343. This comparison draft is based on that PR's 96311a46096 head, so the diff isolates the alternative.

TDbRefMap now acquires references on insertion and releases them on erasure without importing TMemoryChanges, accepting a transaction argument, or checking proposal phases. Proposal callers use GrabNew* before insertion and typed Grab* before snapshot-backed mutation or replacement. The memory-change coordinator keeps typed snapshots and remaining field undo in a common stack, preserving reverse mutation order. Membership restoration bypasses reference accounting because Paths has already restored the counters.

Snapshots restore into the original info object to preserve owning aliases. Table snapshots use DeepCopy and rebuild their internal partition pointers on restoration. Full table snapshots therefore cost time and memory proportional to partition/statistics state; Update itself remains a lookup. Types without an existing whole-object snapshot implementation retain explicit field undo. Undo registration outside a proposal now aborts instead of silently discarding the action.

Aspect ydb-platform#46343 This comparison
Reference ownership Automatic Automatic
Proposal insertion Set({..., .Changes = ...}) GrabNew* then Set(id, value)
Snapshot-backed mutation Explicit field undo Typed object snapshots
Container dependency on proposal undo Direct None
Table object identity on abort Preserved Preserved
Full table snapshot cost Avoided Proportional to partitions/statistics

Restoring the table object's identity does not preserve addresses of individual partition/statistics entries across full snapshot restoration. The new regressions replace the original partition storage, check restored values and TTL aliases, and exercise repeated snapshots. Existing reference-count, undo-order, redo-abort, and TTL tests remain.

Validation: git diff --check passed. This final implementation has not been built or tested, as requested; remote validation is pending. An earlier local build attempt was interrupted before any tests ran.

Run the complete SchemeShard test tree from the repository root (tests include the build):

set -o pipefail
ya make --build relwithdebinfo -tA --test-threads=4 \
  ydb/core/tx/schemeshard \
  2>&1 | tee schemeshard-typed-grabs-tests.log | tail -100

For a smaller first pass covering the ownership regressions, proposal redo rollback, and TTL aliases:

set -o pipefail
ya make --build relwithdebinfo -tA --test-threads=4 \
  ydb/core/tx/schemeshard/ut_base \
  ydb/core/tx/schemeshard/ut_ttl \
  2>&1 | tee schemeshard-typed-grabs-focused.log | tail -100

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Enjection Enjection closed this Sep 10, 2026
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