feat(server): Make DbSlice consumer an interface#7253
feat(server): Make DbSlice consumer an interface#7253dranikpg wants to merge 6 commits intodragonflydb:mainfrom
Conversation
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
|
augment review |
🤖 Augment PR SummarySummary: This PR refactors DbSlice change notification from a callback+id model to a consumer interface, enabling richer interactions with snapshot/serialization code. Changes:
Technical Notes: Snapshot versions are now stored on the consumer object itself ( 🤖 Was this summary useful? React with 👍 or 👎 |
| public: | ||
| // Consumer of bucket change events than can be registered inside the slice. | ||
| // It also includes additional methods for interfacing with snapshots and migrations. | ||
| struct ChangeConsumerInterface { |
There was a problem hiding this comment.
src/server/db_slice.h:89: ChangeConsumerInterface is used as a polymorphic base, but it doesn’t declare a virtual destructor, which can cause UB if a consumer is ever deleted through a ChangeConsumerInterface* (easy to do with interfaces). Consider adding a virtual default destructor to make ownership patterns safer.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| TEST_current_time_ms = TEST_current_time_ms + 100; | ||
| for (unsigned i = 0; i < kKeys; i++) | ||
| EXPECT_THAT(Run({"GET", absl::StrCat("key:", i)}), ArgType(RespExpr::NIL)); | ||
| Run({"SET", absl::StrCat("key:", i), "V"}); |
There was a problem hiding this comment.
src/server/serializer_base_test.cc:415: In DelayedAllDeleted, the loop after advancing time uses SET instead of asserting the keys were actually expired/deleted, so the test may no longer exercise the “bucket becomes empty due to expiry deletion” scenario described in the header comment. If the goal is to validate that expiry-driven deletions flush delayed reads, it may be worth reintroducing an explicit assertion/trigger of expiry deletion here.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Signed-off-by: Vlad <vlad@dragonflydb.io>
309629b to
48ec103
Compare
ChangeConsumerInterfaceto allow for more interactions with registered consumers