Skip to content

Commit

Permalink
don't upgrade rest port config for nodes with defined port_meta
Browse files Browse the repository at this point in the history
If some node already has per-node rest config with port_meta, this
means that somebody already set right value.

But most importantly because we run upgrade code for initial server
startup, previous code always set port_meta to global (because initial
run is always with 1 node). Breaking ./cluster_run badly.

Not upgrading when port_meta is set fixes cluster_run, while
preserving correctness for normal production upgrades.

Change-Id: Iecd627a0576043c91392f111bea1f0fd7673b6ac
Reviewed-on: http://review.couchbase.org/10863
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and aartamonau committed Nov 15, 2011
1 parent 4925ee0 commit 2dc653a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ns_config_default.erl
Expand Up @@ -275,6 +275,18 @@ upgrade_config_from_1_7_1_to_1_7_2(Config) ->
do_upgrade_config_from_1_7_1_to_1_7_2(Config, DefaultConfig).

do_upgrade_config_from_1_7_1_to_1_7_2(Config, DefaultConfig) ->
RestConfig = case ns_config:search_node(Config, rest) of
false -> [];
{value, RestConfigX} -> RestConfigX
end,

NeedRestUpgrade = lists:keysearch(port_meta, 1, RestConfig) =:= false,
case NeedRestUpgrade of
true -> do_upgrade_rest_port_config_from_1_7_1_to_1_7_2(Config, DefaultConfig);
_ -> []
end.

do_upgrade_rest_port_config_from_1_7_1_to_1_7_2(Config, DefaultConfig) ->
Node = node(),
NodesWanted = case ns_config:search(Config, nodes_wanted) of
{value, Nodes} -> lists:usort(Nodes);
Expand Down

0 comments on commit 2dc653a

Please sign in to comment.