Skip to content

Commit 5aed3a9

Browse files
authored
Add node_confirms default bucket props (#915)
* Added default (0) for new pd bucket option. PD = Physical diversity. See changes in riak_kv for full details. * Add pd option to prop resolve. * Rename 'pd' bucket property to 'node_confirms' * Move `node_confirms` to version specific props See bug report nhs-riak/kv9. This commit moves the node_confirms property into a version specific list/function. It changes the list concatenation to be shortest list as the left-hand-operand (erlang docs say this is faster http://erlang.org/doc/efficiency_guide/listHandling.html). Why not, since I was in here futzing around. NOTE: I kept with the existing `defaults/0` and `defaults/1` rather than the discussed "new_defaults" or "post_transition_defaults" as I was unclear where, if anywhere, `defaults/1` was called. `defaults/0` is implicitly "post-transition defaults" already. * Update deps for upstream
1 parent c9c924e commit 5aed3a9

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/riak_core_bucket_props.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ resolve_prop({precommit, PC1}, {precommit, PC2}) ->
168168
resolve_hooks(PC1, PC2);
169169
resolve_prop({pw, PW1}, {pw, PW2}) ->
170170
max(PW1, PW2);
171+
resolve_prop({node_confirms, NodeConfirms1}, {node_confirms, NodeConfirms2}) ->
172+
max(NodeConfirms1, NodeConfirms2);
171173
resolve_prop({r, R1}, {r, R2}) ->
172174
max(R1, R2);
173175
resolve_prop({rw, RW1}, {rw, RW2}) ->
@@ -206,6 +208,7 @@ simple_resolve_test() ->
206208
{pr,0},
207209
{precommit,[{a, b}]},
208210
{pw,0},
211+
{node_confirms,0},
209212
{r,quorum},
210213
{rw,quorum},
211214
{small_vclock,50},
@@ -226,6 +229,7 @@ simple_resolve_test() ->
226229
{pr,1},
227230
{precommit,[{c, d}]},
228231
{pw,3},
232+
{node_confirms,3},
229233
{r,3},
230234
{rw,3},
231235
{w,1},
@@ -245,6 +249,7 @@ simple_resolve_test() ->
245249
{pr,1},
246250
{precommit,[{a, b}, {c, d}]},
247251
{pw,3},
252+
{node_confirms,3},
248253
{r,quorum},
249254
{rw,quorum},
250255
{small_vclock,50},

src/riak_core_bucket_type.erl

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,31 @@
120120
%% @doc The hardcoded defaults for all bucket types.
121121
-spec defaults() -> bucket_type_props().
122122
defaults() ->
123-
custom_type_defaults().
123+
v225_defaults() ++ custom_type_defaults().
124+
125+
%% @private default propeties added for v2.2.5
126+
-spec v225_defaults() -> bucket_type_props().
127+
v225_defaults() ->
128+
[{node_confirms, 0}].
124129

125130
%% @doc The hardcoded defaults for the legacy, default bucket
126131
%% type. These find their way into the `default_bucket_props'
127132
%% environment variable
128133
-spec defaults(default_type) -> bucket_type_props().
129134
defaults(default_type) ->
130-
default_type_defaults().
135+
v225_defaults() ++ default_type_defaults().
131136

132137
default_type_defaults() ->
133-
common_defaults() ++
134-
[{dvv_enabled, false},
135-
{allow_mult, false}].
138+
[{dvv_enabled, false},
139+
{allow_mult, false}] ++
140+
common_defaults().
136141

137142
custom_type_defaults() ->
138-
common_defaults() ++
139-
%% @HACK dvv is a riak_kv only thing, yet there is nowhere else
140-
%% to put it (except maybe fixups?)
141-
[{dvv_enabled, true},
142-
{allow_mult, true}].
143+
%% @HACK dvv is a riak_kv only thing, yet there is nowhere else
144+
%% to put it (except maybe fixups?)
145+
[{dvv_enabled, true},
146+
{allow_mult, true}] ++
147+
common_defaults().
143148

144149
common_defaults() ->
145150
[{linkfun, {modfun, riak_kv_wm_link_walker, mapreduce_linkfun}},

0 commit comments

Comments
 (0)