Skip to content

Commit

Permalink
Removed gentle-rain configuration (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniusa committed Sep 14, 2022
1 parent 6f1528f commit 1482b81
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 281 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REBAR = $(shell pwd)/rebar3
COVERPATH = $(shell pwd)/_build/test/cover
.PHONY: rel test relgentlerain docker-build docker-run
.PHONY: rel test docker-build docker-run

all: compile

Expand Down Expand Up @@ -35,9 +35,6 @@ lint:

check: distclean test reltest dialyzer lint

relgentlerain: export TXN_PROTOCOL=gentlerain
relgentlerain: relclean rel

relnocert: export NO_CERTIFICATION=true
relnocert: relclean rel

Expand Down
67 changes: 7 additions & 60 deletions apps/antidote/src/cure.erl
Original file line number Diff line number Diff line change
Expand Up @@ -173,39 +173,13 @@ obtain_objects(Clock, Properties, Objects, StateOrValue) ->
),
{ok, transform_reads([Val], StateOrValue, Objects), CommitTime};
false ->
case application:get_env(antidote, txn_prot) of
{ok, clocksi} ->
{ok, TxId} = clocksi_istart_tx(Clock, Properties),
case obtain_objects(Objects, TxId, StateOrValue) of
{ok, Res} ->
{ok, CommitTime} = commit_transaction(TxId),
{ok, Res, CommitTime};
{error, Reason} ->
{error, Reason}
end;
{ok, gr} ->
case Objects of
%% Single object read = read latest value
[_Op] ->
{ok, TxId} = clocksi_istart_tx(Clock, Properties),
case obtain_objects(Objects, TxId, StateOrValue) of
{ok, Res} ->
{ok, CommitTime} = commit_transaction(TxId),
{ok, Res, CommitTime};
{error, Reason} ->
{error, Reason}
end;
%% Read Multiple objects = read from a snapshot
[_ | _] ->
%% Snapshot includes all updates committed at time GST
%% from local and remote replicas
case gr_snapshot_obtain(Clock, Objects, StateOrValue) of
{ok, Result, CommitTime} ->
{ok, Result, CommitTime};
{error, Reason} ->
{error, Reason}
end
end
{ok, TxId} = clocksi_istart_tx(Clock, Properties),
case obtain_objects(Objects, TxId, StateOrValue) of
{ok, Res} ->
{ok, CommitTime} = commit_transaction(TxId),
{ok, Res, CommitTime};
{error, Reason} ->
{error, Reason}
end
end.

Expand Down Expand Up @@ -256,33 +230,6 @@ clocksi_full_icommit(TxId) ->
Msg
end.

%%% Snapshot read for Gentlerain protocol
gr_snapshot_obtain(ClientClock, Objects, StateOrValue) ->
%% GST = scalar stable time
%% VST = vector stable time with entries for each dc
{ok, GST, VST} = dc_utilities:get_scalar_stable_time(),
DcId = dc_utilities:get_my_dc_id(),
Dt = vectorclock:get(DcId, ClientClock),
case Dt =< GST of
true ->
%% Set all entries in snapshot as GST
ST = vectorclock:set_all(GST, VST),
%% ST doesn't contain entry for local dc, hence explicitly
%% add it in snapshot time
SnapshotTime = vectorclock:set(DcId, GST, ST),
{ok, TxId} = clocksi_istart_tx(SnapshotTime, [{update_clock, false}]),
case obtain_objects(Objects, TxId, StateOrValue) of
{ok, Res} ->
{ok, CommitTime} = commit_transaction(TxId),
{ok, Res, CommitTime};
{error, Reason} ->
{error, Reason}
end;
false ->
timer:sleep(10),
gr_snapshot_obtain(ClientClock, Objects, StateOrValue)
end.

format_read_params(ReadObjects) ->
lists:map(
fun({Key, Type, Bucket}) ->
Expand Down
22 changes: 3 additions & 19 deletions apps/antidote/src/dc_utilities.erl
Original file line number Diff line number Diff line change
Expand Up @@ -258,28 +258,12 @@ get_stable_snapshot() ->
timer:sleep(10),
get_stable_snapshot();
SS ->
case application:get_env(antidote, txn_prot) of
{ok, clocksi} ->
%% This is fine if transactions coordinators exists on the ring (i.e. they have access
%% to riak core meta-data) otherwise will have to change this
{ok, SS};
{ok, gr} ->
%% For gentlerain use the same format as clocksi
%% But, replicate GST to all entries in the dict
StableSnapshot = SS,
case vectorclock:size(StableSnapshot) of
0 ->
{ok, StableSnapshot};
_ ->
MembersInDc = dc_utilities:get_my_dc_nodes(),
GST = vectorclock:min_clock(StableSnapshot, MembersInDc),
{ok, vectorclock:set_all(GST, StableSnapshot)}
end
end
%% This is fine if transactions coordinators exists on the ring (i.e. they have access
%% to riak core meta-data) otherwise will have to change this
{ok, SS}
end.

%% Returns the minimum value in the stable vector snapshot time
%% Useful for gentlerain protocol.
-spec get_scalar_stable_time() -> {ok, pos_integer(), vectorclock()}.
get_scalar_stable_time() ->
{ok, StableSnapshot} = get_stable_snapshot(),
Expand Down
96 changes: 0 additions & 96 deletions apps/antidote/test/multidc/gr_SUITE.erl

This file was deleted.

101 changes: 0 additions & 101 deletions apps/antidote/test/singledc/gr_SUITE.erl

This file was deleted.

1 change: 0 additions & 1 deletion config/sys.config.src
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@

%% txn_prot:
%% clocksi -> uses "Cure" protocol to define snapshots and causal dependencies (https://pages.lip6.fr/Marc.Shapiro/papers/Cure-final-ICDCS16.pdf)
%% gr -> uses "Gentle-rain like" protocol to define snapshots and causal dependencies (https://infoscience.epfl.ch/record/202079)
%{txn_prot, clocksi},

%% recover_from_log:
Expand Down

0 comments on commit 1482b81

Please sign in to comment.