Skip to content

feat(tiering): Add experimental list node offloading#6944

Closed
mkaruza wants to merge 6 commits into
mainfrom
mkaruza/github#6467
Closed

feat(tiering): Add experimental list node offloading#6944
mkaruza wants to merge 6 commits into
mainfrom
mkaruza/github#6467

Conversation

@mkaruza
Copy link
Copy Markdown
Contributor

@mkaruza mkaruza commented Mar 22, 2026

Extend tiered storage to offload individual QList nodes. Offloading is supported
for RAW node objects. Functionality is controlled with flag
--tiered_experimental_list_support.

Key changes:

  • Add ListNodeId (dbid, ql*, node*) as a new tiering identity type
    alongside KeyRef; introduce PendingId/ReadId variants so OpManager
    can handle both key-level and node-level I/O uniformly.
  • Add tiering callbacks (offload_cb, onload_cb, delete_cb) to
    QList::TieringParams. PromoteToQLIfNeeded now wires them up when
    tiered storage is available, using the new db_id_ member on
    ListWrapper to store DbIndex for usage.
  • Update CancelStash / ReadInternal signatures to accept the generic
    PendingId / ReadId types instead of (dbid, key).
  • Expose StashListNode / ReadTieredListNode free functions used by the
    ListWrapper callbacks.
  • Add QList::Materialize that is used during RDB save to fetch back data in memory
    from tiered storage.
  • Added ListNodeTieringTest suite. Replication test for tiered list objects.

@mkaruza mkaruza marked this pull request as draft March 22, 2026 14:55
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Mar 22, 2026

🤖 Augment PR Summary

Summary: Adds experimental tiered-storage support for offloading individual QList nodes (list internals) to disk, gated by --tiered_experimental_list_support.

Changes:

  • Extends compact/external representations with ExternalRep::LIST_NODE and maps it to OBJ_LIST.
  • Introduces list-node tiering identities (ListNodeId) and expands PendingId/ReadId so OpManager can track key-level and node-level I/O uniformly.
  • Adds per-node tiering hooks to QList (offload_cb/onload_cb/delete_cb) and updates QList internals to handle offloaded/io_pending nodes.
  • Implements partial-value stashing/reading in TieredStorage for list nodes, with separate accounting and lifecycle handling.
  • Wires list tiering callbacks from list_family when tiered storage is available and list tiering threshold is enabled.
  • Adds QList::Materialize and uses it during RDB save to ensure offloaded nodes are brought back into memory for serialization.
  • Adds extensive tiered list-node test coverage (including compressed-node scenarios) in tiered_storage_test.cc.

Technical Notes: List-node offloading is currently constrained (e.g. page-occupancy checks) and uses pointer-based identities (QList*/Node*) for tracking async I/O and cleanup.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/core/qlist.cc Outdated
Comment thread src/core/qlist.cc
Comment thread src/server/list_family.cc Outdated
Comment thread src/server/list_family.cc Outdated
@mkaruza mkaruza force-pushed the mkaruza/tiering-fragment branch from 4f08cf6 to e708544 Compare March 22, 2026 15:00
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch 2 times, most recently from 46df68e to 3517947 Compare March 23, 2026 13:02
@mkaruza mkaruza changed the title feat(tiering): Support for partial offloading of LIST nodes feat(tiering): Add experimental list node offloading Mar 23, 2026
@mkaruza mkaruza marked this pull request as ready for review March 23, 2026 13:04
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch from 3517947 to 452b5f7 Compare March 23, 2026 13:04
@mkaruza mkaruza changed the base branch from mkaruza/tiering-fragment to main March 23, 2026 13:05
Copilot AI review requested due to automatic review settings March 23, 2026 13:08
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch from 452b5f7 to 27d668b Compare March 23, 2026 13:08
Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/server/list_family.cc Outdated
Comment thread src/core/tiering_types.cc Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends tiered storage beyond key-level PrimeValues to support experimental offloading of individual QList::Node payloads to disk, gated by --tiered_experimental_list_support, by introducing a node-identity (ListNodeId) and wiring list-tiering callbacks into QList.

Changes:

  • Introduces ListNodeId plus PendingId/ReadId variants so tiering I/O can address both keys and list nodes uniformly.
  • Adds list-node offload/onload/delete callback hooks (QList::TieringParams) and connects them from list_family when tiered storage is available.
  • Adds a new test suite (ListNodeTieringTest) to validate list node stash/load/delete behaviors.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/server/tiering/common.h Adds ListNodeId, expands PendingId, introduces ReadId.
src/server/tiering/op_manager.h Extends OwnedEntryId to include ListNodeId.
src/server/tiering/op_manager.cc Supports owning/logging of ListNodeId.
src/server/tiered_storage.h Generalizes Read/CancelStash, adds list-node helpers, adds IsClosed().
src/server/tiered_storage.cc Implements list-node stash/read paths and feature gating flag wiring.
src/server/list_family.cc Wires tiering callbacks into QList via ListWrapper/promotion.
src/core/qlist.h Adds node io_pending, external record, and tiering callbacks.
src/core/qlist.cc Implements offload/onload/delete lifecycle hooks and Node::SetExternal.
src/core/tiering_types.h / .cc Extends FragmentRef to support QList::Node* fragments.
src/core/compact_object.h / .cc Adds ExternalRep::LIST_NODE and object-type mapping behavior.
src/server/tiered_storage_test.cc Adds list node tiering test coverage.
src/server/hset_family.cc Adapts tiered Read call to new signature.
src/server/db_slice.cc Adapts CancelStash calls to new PendingId signature.

Comment thread src/core/tiering_types.cc
Comment thread src/server/tiered_storage.cc Outdated
Comment thread src/server/tiered_storage.cc
Comment thread src/server/list_family.cc Outdated
Comment thread src/core/qlist.h Outdated
Comment thread src/server/tiered_storage.cc Outdated
Comment thread src/server/tiered_storage.cc Outdated
Comment thread src/core/qlist.cc Outdated
Comment thread src/core/qlist.cc Outdated
Comment thread src/core/qlist.cc Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Comment thread src/server/list_family.cc Outdated
Comment thread src/core/qlist.cc Outdated
Comment thread src/core/qlist.cc Outdated
Comment thread src/server/list_family.cc Outdated
Comment thread src/server/list_family.cc Outdated
Comment thread src/core/qlist.cc
Comment thread src/core/qlist.cc
Comment thread src/core/qlist.h
Comment thread src/server/tiered_storage.cc
@mkaruza
Copy link
Copy Markdown
Contributor Author

mkaruza commented Mar 23, 2026

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/core/compact_object.cc Outdated
Comment thread src/core/qlist.h Outdated
Comment thread src/core/qlist.cc Outdated
Comment thread src/server/list_family.cc Outdated
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch 3 times, most recently from 61cdbc9 to 90afdd0 Compare March 24, 2026 06:30
@mkaruza mkaruza requested review from dranikpg and romange March 24, 2026 07:50
@dranikpg
Copy link
Copy Markdown
Contributor

wow this is a lot of code 😟

Copy link
Copy Markdown
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

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

It's really hard to review such a large PR as if its "ready to be commited" code. I know it's very cumbersome to split all of this. I usually make different commits and there are lots of refactoring parts here (uniting db_index, key), extending ListWrapper, etc.

I will take a look a little later at the other parts. I'm not much in context of list tiering yet

Comment thread src/server/tiered_storage.h
Comment thread src/server/tiered_storage.cc Outdated
Comment thread src/server/tiered_storage.cc Outdated
Comment thread src/server/tiering/op_manager.h Outdated
Comment thread src/server/list_family.cc Outdated
@romange
Copy link
Copy Markdown
Collaborator

romange commented Mar 24, 2026

Please rebase and resolve conflicts.

@romange
Copy link
Copy Markdown
Collaborator

romange commented Mar 24, 2026

augment review

@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch 3 times, most recently from ad4aa44 to 622c609 Compare March 25, 2026 16:26
@mkaruza
Copy link
Copy Markdown
Contributor Author

mkaruza commented Mar 25, 2026

augment review

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/core/qlist.cc Outdated
Comment thread src/core/qlist.cc
Comment thread src/core/qlist.cc
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch from 36f213f to 27f7adc Compare March 25, 2026 21:39
@mkaruza mkaruza requested review from dranikpg and romange March 26, 2026 08:42
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch 2 times, most recently from 5e50251 to fb8f92a Compare March 27, 2026 08:31
dranikpg
dranikpg previously approved these changes Mar 27, 2026
Comment thread src/core/tiering_types.cc Outdated
Comment thread src/server/list_family.cc Outdated
dranikpg
dranikpg previously approved these changes Mar 27, 2026
Comment thread src/core/qlist.h Outdated
mkaruza added 6 commits March 30, 2026 10:52
Extend tiered storage to offload individual QList nodes to disk,
gated by --tiered_experimental_list_support.

Key changes:
- Add ListNodeId (dbid, node*, ql*) as a new tiering identity type
  alongside KeyRef; introduce PendingId/ReadId variants so OpManager
  can handle both key-level and node-level I/O uniformly.
- Add tiering callbacks (offload_cb, onload_cb, delete_cb) to
  QList::TieringParams.  PromoteToQLIfNeeded now wires them up when
  tiered storage is available, using the new db_id_ member on
  ListWrapper to store DbIndex for usage.
- Update CancelStash / ReadInternal signatures to accept the generic
  PendingId / ReadId types instead of (dbid, key).
- Add IsClosed() / is_closed_ guard so delete_cb skips I/O after
  TieredStorage::Close() is called.
- Expose StashListNode / ReadTieredListNode free functions used by the
  ListWrapper callbacks.
- Added ListNodeTieringTest suite

Signed-off-by: mkaruza <mario@dragonflydb.io>
Don't stash list nodes if don't occupty whole page (either raw or
compressed).
@mkaruza mkaruza force-pushed the mkaruza/github#6467 branch from d4572a5 to 7316313 Compare March 30, 2026 09:39
@romange
Copy link
Copy Markdown
Collaborator

romange commented Mar 30, 2026

It's really hard to review such a large PR as if its "ready to be commited" code. I know it's very cumbersome to split all of this. I usually make different commits and there are lots of refactoring parts here (uniting db_index, key), extending ListWrapper, etc.

I will take a look a little later at the other parts. I'm not much in context of list tiering yet

I join the sentiment. There is no reason to review it as a whole. I should be split into 3 at least. Lets start with src/core/ changes, first, then tiering and only then - families.

@mkaruza
Copy link
Copy Markdown
Contributor Author

mkaruza commented Mar 30, 2026

@romange @dranikpg

I have split this PR into 3:

#7021 extend QList::Node to support tiering.
#7022 extend TeieredStorage to handle QList::Node
#7023 Enables tiering of nodes and adds test

PR's needs to be merged in order. I'll close this once they are review/merged

@mkaruza
Copy link
Copy Markdown
Contributor Author

mkaruza commented Apr 7, 2026

Closing: #7021 #7022 #7023 were merged

@mkaruza mkaruza closed this Apr 7, 2026
@mkaruza mkaruza deleted the mkaruza/github#6467 branch April 7, 2026 07:59
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.

4 participants