Skip to content

Commit 481c402

Browse files
committed
khepri_machine: Fix dedup mechanism support check
[Why] It is based on the machine version but it used the latest supported one. The problem is that the dedup mechanism was added to version 1, not necessarily the latest. Therefore, the existing check would skip the use of the dedup mechanism just because the effective machine version was not the latest one. [How] We check that the effective version is at least 1, the version where the deduplication mechanism was added.
1 parent b5feed3 commit 481c402

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/khepri_machine.erl

+3-2
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,10 @@ process_command(StoreId, Command, Options) ->
863863

864864
process_sync_command(
865865
StoreId, Command, #{protect_against_dups := true} = Options) ->
866-
MacVer = version(),
866+
%% The deduplication mechanism was added to machine version 1.
867+
DedupMacVer = 1,
867868
case effective_version(StoreId) of
868-
{ok, EffectiveMacVer} when EffectiveMacVer >= MacVer ->
869+
{ok, EffectiveMacVer} when EffectiveMacVer >= DedupMacVer ->
869870
%% When `protect_against_dups' is true, we wrap the command inside
870871
%% a #dedup{} one to give it a unique reference. This is used for
871872
%% non-idempotent commands which could be replayed when there is a

0 commit comments

Comments
 (0)