Skip to content

Add an optional hybrid RW mode for LSMT writable layers. - #443

Open
ZarrianShi wants to merge 2 commits into
containerd:mainfrom
ZarrianShi:dev/hybrid-rw
Open

Add an optional hybrid RW mode for LSMT writable layers.#443
ZarrianShi wants to merge 2 commits into
containerd:mainfrom
ZarrianShi:dev/hybrid-rw

Conversation

@ZarrianShi

@ZarrianShi ZarrianShi commented Aug 14, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

This PR adds an optional hybrid RW mode for LSMT writable layers.

When enabled, writes reuse existing non-zero mappings in the current writable layer by overwriting their data payload in place. Ranges not covered by the writable layer—including holes, zeroed mappings, and mappings only present in lower layers—continue to append data and new index records.

This reduces RW layer growth for overwrite-heavy workloads while preserving the existing append-only behavior as the default. It does not introduce online compaction.

The change includes:

  • A --hybrid option for creating a hybrid RW upper layer.
  • A persisted writable-layer header flag for hybrid RW mode.
  • Writable-layer-only range iteration, so lower-layer data is never overwritten.
  • Hybrid range handling for partial overlap, holes, zeroed ranges, and stacked layers.
  • Unit tests covering single/multiple upper ranges, internal holes, exact boundaries, zeroed mappings, and lower-layer isolation.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Fixes #442

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Add an optional hybrid writable-layer type and persist it in the
layer header. Keep append RW as the default.

Signed-off-by: Zehuan Shi <xocoder@gmail.com>
Reuse existing non-zero mappings in the current writable layer while
continuing to append uncovered, zeroed, and lower-layer ranges.

Signed-off-by: Zehuan Shi <xocoder@gmail.com>
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.

Add an optional hybrid RW mode for LSMT writable layers.

1 participant