From c950554b11d6818052b720205b64b21c9f4ad1ce Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Tue, 5 Sep 2023 21:50:06 -0500 Subject: [PATCH] Add comments about which stm_snapshot backend to use 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 --- src/v/cluster/persisted_stm.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/v/cluster/persisted_stm.h b/src/v/cluster/persisted_stm.h index 748d2698f7a91..1ac2753c2d140 100644 --- a/src/v/cluster/persisted_stm.h +++ b/src/v/cluster/persisted_stm.h @@ -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( @@ -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(