Skip to content

Instantly share code, notes, and snippets.

@vinoski
Created December 1, 2014 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinoski/e61316316bc5e52dfba3 to your computer and use it in GitHub Desktop.
Save vinoski/e61316316bc5e52dfba3 to your computer and use it in GitHub Desktop.
unofficial riak_core changes for Erlang/OTP 17
diff --git a/include/riak_core_handoff.hrl b/include/riak_core_handoff.hrl
index 9956205..e34c4c8 100644
--- a/include/riak_core_handoff.hrl
+++ b/include/riak_core_handoff.hrl
@@ -30,7 +30,7 @@
transport_mon :: reference(),
timestamp :: tuple(),
status :: any(),
- stats :: dict(),
+ stats :: dict:dict(),
vnode_pid :: pid() | undefined,
vnode_mon :: reference(),
type :: ho_type(),
diff --git a/rebar b/rebar
index c66b3e6..54474b3 100755
Binary files a/rebar and b/rebar differ
diff --git a/rebar.config.script b/rebar.config.script
index bd36856..e965777 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -1,11 +1,19 @@
-case erlang:system_info(otp_release) =< "R15B01" of
- true ->
- HashDefine = [{d,old_hash}],
- case lists:keysearch(erl_opts, 1, CONFIG) of
- {value, {erl_opts, Opts}} ->
- lists:keyreplace(erl_opts,1,CONFIG,{erl_opts,Opts++HashDefine});
- false ->
- CONFIG ++ [{erl_opts, HashDefine}]
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ft=erlang ts=4 sw=4 et
+
+case erlang:system_info(otp_release) of
+ "R"++_=RVersion ->
+ case RVersion =< "R15B01" of
+ true ->
+ HashDefine = [{d,old_hash}],
+ case lists:keysearch(erl_opts, 1, CONFIG) of
+ {value, {erl_opts, Opts}} ->
+ lists:keyreplace(erl_opts,1,CONFIG,{erl_opts,Opts++HashDefine});
+ false ->
+ CONFIG ++ [{erl_opts, HashDefine}]
+ end;
+ false -> CONFIG
end;
- false -> CONFIG
+ _ ->
+ CONFIG
end.
diff --git a/src/hashtree.erl b/src/hashtree.erl
index 0c677e7..d5dfb81 100644
--- a/src/hashtree.erl
+++ b/src/hashtree.erl
@@ -1,6 +1,6 @@
%% -------------------------------------------------------------------
%%
-%% Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
+%% Copyright (c) 2012-2014 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@@ -174,13 +174,13 @@
segments :: pos_integer(),
width :: pos_integer(),
mem_levels :: integer(),
- tree :: dict(),
+ tree :: dict:dict(),
ref :: term(),
path :: string(),
itr :: term(),
write_buffer :: [{put, binary(), binary()} | {delete, binary()}],
write_buffer_count :: integer(),
- dirty_segments :: array()
+ dirty_segments :: array:array()
}).
-record(itr_state, {itr :: term(),
@@ -872,17 +872,17 @@ orddict_delta(D1, [], Acc) ->
%%%===================================================================
-define(W, 27).
--spec bitarray_new(integer()) -> array().
+-spec bitarray_new(integer()) -> array:array().
bitarray_new(N) -> array:new((N-1) div ?W + 1, {default, 0}).
--spec bitarray_set(integer(), array()) -> array().
+-spec bitarray_set(integer(), array:array()) -> array:array().
bitarray_set(I, A) ->
AI = I div ?W,
V = array:get(AI, A),
V1 = V bor (1 bsl (I rem ?W)),
array:set(AI, V1, A).
--spec bitarray_to_list(array()) -> [integer()].
+-spec bitarray_to_list(array:array()) -> [integer()].
bitarray_to_list(A) ->
lists:reverse(
array:sparse_foldl(fun(I, V, Acc) ->
diff --git a/src/hashtree_tree.erl b/src/hashtree_tree.erl
index 1c76e2c..54e8145 100644
--- a/src/hashtree_tree.erl
+++ b/src/hashtree_tree.erl
@@ -1,6 +1,6 @@
%% -------------------------------------------------------------------
%%
-%% Copyright (c) 2013 Basho Technologies, Inc. All Rights Reserved.
+%% Copyright (c) 2013-2014 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@@ -138,7 +138,7 @@
snapshot :: ets:tab(),
%% set of dirty leaves
- dirty :: gb_set()
+ dirty :: gb_sets:gb_set()
}).
-define(ROOT, '$ht_root').
diff --git a/src/riak_core_ring.erl b/src/riak_core_ring.erl
index 2978bba..8ee1422 100644
--- a/src/riak_core_ring.erl
+++ b/src/riak_core_ring.erl
@@ -2,7 +2,7 @@
%%
%% riak_core: Core Riak Application
%%
-%% Copyright (c) 2007-2010 Basho Technologies, Inc. All Rights Reserved.
+%% Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@@ -147,7 +147,7 @@
vclock :: vclock:vclock() | undefined, % for this chstate object, entries are
% {Node, Ctr}
chring :: chash:chash(), % chash ring of {IndexAsInt, Node} mappings
- meta :: dict() | undefined, % dict of cluster-wide other data (primarily
+ meta :: dict:dict() | undefined, % dict of cluster-wide other data (primarily
% bucket N-value, etc)
clustername :: {term(), term()},
diff --git a/src/riak_core_vnode_manager.erl b/src/riak_core_vnode_manager.erl
index 47011dc..fc73d8d 100644
--- a/src/riak_core_vnode_manager.erl
+++ b/src/riak_core_vnode_manager.erl
@@ -2,7 +2,7 @@
%%
%% riak_core: Core Riak Application
%%
-%% Copyright (c) 2007-2012 Basho Technologies, Inc. All Rights Reserved.
+%% Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@@ -60,8 +60,8 @@
-type repairs() :: [repair()].
-record(state, {idxtab,
- forwarding :: dict(),
- handoff :: dict(),
+ forwarding :: dict:dict(),
+ handoff :: dict:dict(),
known_modules :: [term()],
never_started :: [{integer(), term()}],
vnode_start_tokens :: integer(),
diff --git a/src/supervisor_pre_r14b04.erl b/src/supervisor_pre_r14b04.erl
index 2f24f1b..d0c20fa 100644
--- a/src/supervisor_pre_r14b04.erl
+++ b/src/supervisor_pre_r14b04.erl
@@ -80,7 +80,7 @@
-record(state, {name,
strategy :: strategy(),
children = [] :: [child_rec()],
- dynamics :: ?DICT() | ?SET(),
+ dynamics :: dict:dict() | sets:set(),
intensity :: non_neg_integer(),
period :: pos_integer(),
restarts = [],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment