Skip to content

Commit

Permalink
Initial support for OTP26
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsumner committed May 2, 2024
1 parent 0c060a3 commit 79a0e55
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 46 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Erlang CI

on:
push:
branches: [ nhse-develop ]
branches:
- nhse-develop
- nhse-develop-3.2
- nhse-develop-3.4
pull_request:
branches: [ nhse-develop ]
branches:
- nhse-develop
- nhse-develop-3.2
- nhse-develop-3.4


jobs:
Expand All @@ -17,25 +23,12 @@ jobs:
strategy:
fail-fast: false
matrix:
otp: [22, 24, 25]
otp: [24, 26]
os: [ubuntu-latest]
# OTP lower than 23 does not run on ubuntu-latest (22.04), see
# https://github.com/erlef/setup-beam#compatibility-between-operating-system-and-erlangotp
exclude:
- otp: 22
os: ubuntu-latest
include:
- otp: 22
os: ubuntu-20.04

steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v2
- name: Install dependencies (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get -qq update
sudo apt-get -qq install libsnappy-dev libc6-dev
- uses: actions/checkout@v4
- name: Install Erlang/OTP
uses: erlef/setup-beam@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_accumulating_time.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ start(Pid_list, MFA_list, IntervalMS) ->
{started, TPid}.

stop() ->
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
stopped.

Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_backend_latency.erl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ stop() ->
%% io:format("Histogram stats:\n~p\n", [catch folsom_metrics:get_histogram_statistics(foo)]),
%% catch folsom_metrics:delete_metric(foo),

dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
stopped.

Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_eleveldb_put_size.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ start(Interval) ->
{started, TPid}.

stop() ->
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
stopped.

Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_fsm_init.erl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ start(Interval) ->
{started, TPid}.

stop() ->
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
stopped.

Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_func_args.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ stop() ->
TotalCalls = lists:sum([Count || {_Arg, Count} <- Res]),
io:format("Total calls: ~p\n", [TotalCalls]),
io:format("Call stats:\n~p\n", [catch lists:sort(Sort, Res)]),
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
timer:sleep(100),
stopped.
Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_gc_latency.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ start(LatencyMS) ->
{started, TPid}.

stop() ->
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
timer:sleep(100),
catch folsom_metrics:delete_metric(foo),
Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_latency_histogram.erl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ start(Mod, Func, Arity, RunSeconds) ->

stop() ->
io:format("Histogram stats:\n~p\n", [catch folsom_metrics:get_histogram_statistics(foo)]),
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
timer:sleep(100),
catch folsom_metrics:delete_metric(foo),
Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_merge_and_and_handoff.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ start(Interval) ->
{started, TPid}.

stop() ->
dbg:stop_clear(),
riak_core_tracer:stop_and_clear(),
catch exit(element(2,dbg:get_tracer()), kill),
stopped.

Expand Down
2 changes: 1 addition & 1 deletion priv/tracers/tracer_timeit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ timeit(Mod, Fun, Arity, Type) ->
dbg:p(all, call),
dbg:tpl(Mod, Fun, Arity, [{'_', [], [{return_trace}]}]).

stop() -> dbg:stop_clear().
stop() -> riak_core_tracer:stop_and_clear().

trace({trace, Pid, call, {Mod, Fun, _}}, {D, {all, {Count, Max}}}) ->
D2 = orddict:store({Pid, Mod, Fun}, os:timestamp(), D),
Expand Down
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
]}.

{deps, [
{riak_core, {git, "https://github.com/nhs-riak/riak_core.git", {branch, "nhse-develop"}}},
{riak_core, {git, "https://github.com/nhs-riak/riak_core.git", {branch, "nhse-d32-nhscore.i5-tracer"}}},
{sidejob, {git, "https://github.com/nhs-riak/sidejob.git", {branch, "nhse-develop"}}},
{bitcask, {git, "https://github.com/nhs-riak/bitcask.git", {branch, "nhse-develop"}}},
{redbug, {git, "https://github.com/massemanet/redbug", {branch, "master"}}},
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.2"}}},
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.5"}}},
{sext, {git, "https://github.com/uwiger/sext.git", {tag, "1.8.0"}}},
{riak_pipe, {git, "https://github.com/nhs-riak/riak_pipe.git", {branch, "nhse-develop"}}},
{riak_dt, {git, "https://github.com/nhs-riak/riak_dt.git", {branch, "nhse-develop"}}},
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_bitcask_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ get(Bucket, Key, #state{ref=Ref, key_vsn=KVers}=State) ->
%% NOTE: The bitcask backend does not currently support
%% secondary indexing and the_IndexSpecs parameter
%% is ignored.
-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()} |
{error, term(), state()}.
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_eleveldb_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ get(Bucket, Key, #state{read_opts=ReadOpts,
{error, Reason, State}
end.

-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().

%% @doc Normal put, use existing option, do not modify write options
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
Expand Down
15 changes: 6 additions & 9 deletions src/riak_kv_leveled_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,9 @@ head(Bucket, Key, #state{bookie=Bookie}=State) ->
end.

%% @doc Insert an object into the leveled backend.
-type index_spec() :: {add, Index, SecondaryKey} |
{remove, Index, SecondaryKey}.

-spec flush_put(riak_object:bucket(),
riak_object:key(),
[index_spec()],
[riak_object:index_spec()],
binary(),
state()) ->
{ok, state()} |
Expand All @@ -250,7 +247,7 @@ flush_put(Bucket, Key, IndexSpecs, Val, State) ->

-spec put(riak_object:bucket(),
riak_object:key(),
[index_spec()],
[riak_object:index_spec()],
binary(),
state()) ->
{ok, state()} |
Expand All @@ -262,7 +259,7 @@ put(Bucket, Key, IndexSpecs, Val, State) ->
%% @doc Delete an object from the leveled backend
-spec delete(riak_object:bucket(),
riak_object:key(),
[index_spec()],
[riak_object:index_spec()],
state()) ->
{ok, state()} |
{error, term(), state()}.
Expand Down Expand Up @@ -671,10 +668,10 @@ callback(Ref, UnexpectedCallback, State) ->
%% ===================================================================
%% Internal functions
%% ===================================================================

-type regex() :: {re_pattern, term(), term(), term(), term()}|undefined.

-spec dollarkey_foldfun(
riak_kv_backend:fold_keys_fun(), boolean(), re:mp()|undefined)
riak_kv_backend:fold_keys_fun(), boolean(), regex())
-> riak_kv_backend:fold_objects_fun().
dollarkey_foldfun(FoldKeysFun, ReadTombs, TermRegex) ->
FilteredFoldKeysFun =
Expand Down Expand Up @@ -738,7 +735,7 @@ log_fragmentation(Allocator) ->
%% flush_put or put has been called
-spec do_put(riak_object:bucket(),
riak_object:key(),
[index_spec()],
[riak_object:index_spec()],
binary(),
boolean(),
state()) ->
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_memory_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ get(Bucket, Key, State=#state{data_ref=DataRef,
end.

%% @doc Insert an object into the memory backend.
-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()}.
put(Bucket, PrimaryKey, IndexSpecs, Val, State=#state{data_ref=DataRef,
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_multi_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ head(Bucket, Key, State) ->

%% @doc Insert an object with secondary index
%% information into the kv backend
-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()} |
{error, term(), state()}.
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_multi_prefix_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ head(Bucket, Key, State) ->

%% @doc Insert an object with secondary index
%% information into the kv backend
-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()} |
{error, term(), state()}.
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_test_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ dep_apps(Test, Extra) ->
(_) -> ok
end,

[sasl, Silencer, folsom, exometer_core, runtime_tools,
[sasl, Silencer, exometer_core, runtime_tools,
mochiweb, webmachine, sidejob, poolboy, basho_stats, bitcask,
eleveldb, riak_core, riak_pipe, riak_api, riak_dt, riak_pb, riak_kv,
DefaultSetupFun, Extra].
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_yessir_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ make_get_return_val(RObj, false = _WantsBinary, #state{op_get = Gets} = S) ->
{ok, RObj, S#state{op_get = Gets + 1}}.

%% @doc Store an object, yes, sir!
-type index_spec() :: {add, Index, SecondaryKey} | {remove, Index, SecondaryKey}.
-type index_spec() :: riak_object:index_spec().
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()}.
put(_Bucket, _PKey, _IndexSpecs, _Val, #state{op_put = Puts} = S) ->
Expand Down
6 changes: 4 additions & 2 deletions src/riak_object.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@
-type r_content() :: #r_content{}.
-type index_op() :: add | remove.
-type index_value() :: integer() | binary().
-type index_spec() :: {index_op(), binary(), index_value()}.
-type binary_version() :: v0 | v1.

-export_type([index_spec/0]).

-define(MAX_KEY_SIZE, 65536).

-define(LASTMOD_LEN, 29). %% static length of rfc1123_date() type. Hard-coded in Erlang.
Expand Down Expand Up @@ -984,8 +987,7 @@ dvv_enabled(Bucket) ->
%% the case where there is no existing object
%% stored for a key and therefore no existing
%% index data.
-spec index_specs(riak_object()) ->
[{index_op(), binary(), index_value()}].
-spec index_specs(riak_object()) -> [{index_op(), binary(), index_value()}].
index_specs(Obj) ->
Indexes = index_data(Obj),
assemble_index_specs(Indexes, add).
Expand Down

0 comments on commit 79a0e55

Please sign in to comment.