Skip to content

Commit

Permalink
Add comments about which stm_snapshot backend to use
Browse files Browse the repository at this point in the history
I was reading the source and had to go lookup in the cover letters of
the PR that introduced the kvstore snapshots to understand when I should
use files over kvstore snapshots. This might help future readers of the
code.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
  • Loading branch information
rockwotj committed Sep 6, 2023
1 parent 15c93aa commit c950554
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/v/cluster/persisted_stm.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ struct stm_snapshot {
}
};

// stm_snapshots powered by a seperate file on disk.
//
// This is the default backend for stm_snapshots and works well when
// there are very few partitions (ie for internal topics).
class file_backed_stm_snapshot {
public:
file_backed_stm_snapshot(
Expand All @@ -79,6 +83,11 @@ class file_backed_stm_snapshot {
size_t _snapshot_size{0};
};

// stm_snapshots powered by the kvstore.
//
// This backend is recommended when it's possible there will be many partitions
// for a given stm, as the alternative (files) does not scale well with many
// partitions.
class kvstore_backed_stm_snapshot {
public:
kvstore_backed_stm_snapshot(
Expand Down

0 comments on commit c950554

Please sign in to comment.