Skip to content

refactor(tiering): introduce FragmentRef abstraction for serialization#6796

Open
romange wants to merge 1 commit intomainfrom
Pr4
Open

refactor(tiering): introduce FragmentRef abstraction for serialization#6796
romange wants to merge 1 commit intomainfrom
Pr4

Conversation

@romange
Copy link
Collaborator

@romange romange commented Mar 3, 2026

Summary

  • Moves DetermineSerializationParams logic into a new FragmentRef class in the tiering namespace
  • FragmentRef wraps a CompactValue* and exposes IsOffloaded, HasStashPending, ClearStashPending, ObjType, and GetSerializationDescr
  • StashDescriptor now inherits from FragmentRef::SerializationDescr
  • CancelStash and ShouldStash updated to accept FragmentRef instead of PrimeValue*

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 3, 2026 18:21
@romange romange requested review from dranikpg and mkaruza March 3, 2026 18:23
@augmentcode
Copy link

augmentcode bot commented Mar 3, 2026

🤖 Augment PR Summary

Summary: This PR refactors tiering offload/stash code by centralizing serialization-descriptor computation behind a new abstraction.

Changes:

  • Introduces tiering::FragmentRef (wrapping a CompactValue) to query offload/stash state and compute serialization descriptors
  • Moves the old DetermineSerializationParams logic into new src/core/tiering_types.{h,cc} and wires it into the core build
  • Updates TieredStorage stashing, cancellation, and eligibility checks to use FragmentRef
  • Makes TieredStorageBase::StashDescriptor reuse FragmentRef::SerializationDescr via inheritance

Technical Notes: Behavior for stashing strings and listpack-encoded hashes is preserved while reusing the descriptor in both scheduling and completion paths.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@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. 1 suggestions posted.

Fix All in Augment

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

Copy link
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

This PR introduces a FragmentRef class in the dfly::tiering namespace that encapsulates value introspection and serialization description logic previously spread across a free function (DetermineSerializationParams) and the StashDescriptor struct. FragmentRef wraps a CompactValue* and exposes methods like IsOffloaded, HasStashPending, ClearStashPending, ObjType, and GetSerializationDescr. StashDescriptor now inherits from FragmentRef::SerializationDescr, and CancelStash/ShouldStash signatures are updated to accept FragmentRef.

Changes:

  • New FragmentRef class added to src/core/tiering_types.h/.cc, centralizing serialization introspection
  • TieredStorage::StashDescriptor updated to inherit from FragmentRef::SerializationDescr; CancelStash and ShouldStash signatures updated to accept tiering::FragmentRef
  • tiering_types.cc added to the dfly_core CMake library target

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/core/tiering_types.h Defines new FragmentRef class and nested SerializationDescr struct
src/core/tiering_types.cc Implements FragmentRef::GetDescr (moved from DetermineSerializationParams)
src/core/CMakeLists.txt Adds tiering_types.cc to dfly_core build target
src/server/tiered_storage.h Updates StashDescriptor, ShouldStash, CancelStash, and adds unimplemented GetStashParams private method
src/server/tiered_storage.cc Updates call sites to use FragmentRef, removes DetermineSerializationParams

Copy link
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 5 out of 5 changed files in this pull request and generated 2 comments.

Move DetermineSerializationParams logic into a new FragmentRef class in
the tiering namespace. FragmentRef wraps a CompactValue* and exposes
IsOffloaded, HasStashPending, ClearStashPending, ObjType, and
GetSerializationDescr methods. StashDescriptor now inherits from
FragmentRef::SerializationDescr. CancelStash and ShouldStash updated to
accept FragmentRef instead of PrimeValue*.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
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.

2 participants