Skip to content

Commit 5027a25

Browse files
Merge pull request #317 from amazon-mq/gc-improvements
Add GC property tests and db:list_consistent/0
2 parents 1af1d98 + 6760a93 commit 5027a25

4 files changed

Lines changed: 724 additions & 164 deletions

File tree

src/rabbitmq_stream_s3_db.erl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Zero indicates that the manifest has not been created yet.
7272

7373
-export([setup/0]).
7474

75-
-export([get/1, get_consistent/1, list/0, count/0, put/5, queue_path/1]).
75+
-export([get/1, get_consistent/1, list/0, list_consistent/0, count/0, put/5, queue_path/1]).
7676
-export([put_anchor/2, anchor_exists_consistent/1]).
7777

7878
-define(C_SPROC_TRIGGERS, 1).
@@ -175,10 +175,23 @@ do_get(StreamId, Options) ->
175175
Err
176176
end.
177177

178-
-doc "Lists all streams known to the metadata store.".
178+
-doc "Lists all streams known to the metadata store with a low-latency local read.".
179179
-spec list() -> {ok, #{stream_id() => entry()}} | {error, any()}.
180180
list() ->
181-
case rabbit_khepri:adv_get_many(?MANIFEST_PATH(?KHEPRI_WILDCARD_STAR)) of
181+
do_list(#{}).
182+
183+
-doc """
184+
Lists all streams known to the metadata store with a consistent read.
185+
186+
A consistent read ensures that the query either reflects the latest possible
187+
information across the cluster, or fails.
188+
""".
189+
-spec list_consistent() -> {ok, #{stream_id() => entry()}} | {error, any()}.
190+
list_consistent() ->
191+
do_list(#{favor => consistency, timeout => ?CONSISTENT_READ_TIMEOUT_MS}).
192+
193+
do_list(Options) ->
194+
case rabbit_khepri:adv_get_many(?MANIFEST_PATH(?KHEPRI_WILDCARD_STAR), Options) of
182195
{ok, NodeProps} ->
183196
Entries =
184197
#{

0 commit comments

Comments
 (0)