diff options
author | Mike Wallace <mikewallace1979@googlemail.com> | 2014-09-02 12:34:08 +0100 |
---|---|---|
committer | Jay Doane <jaydoane@apache.org> | 2021-04-19 00:35:19 -0700 |
commit | aa6ed85490b248a8917f9cef06f89cb1f70cc865 (patch) | |
tree | d89214662cb8a20170c4ac2e5e1c778156d7111e | |
parent | 73c724b46ccfe7a0b9b1e69609447a760e450da6 (diff) | |
download | couchdb-aa6ed85490b248a8917f9cef06f89cb1f70cc865.tar.gz |
Handle conflicted shard maps
Custodian will output a message if there are one or more
conflicting revisions for a shard map. Previously
weatherreport_check_custodian failed to match that message which
caused the check to fail.
This commit adds new function clauses to report_to_message/1 and
format/1 so that the conflict messages are output to the console
at the warning log level.
BugzID: 34157
-rw-r--r-- | src/weatherreport/src/weatherreport_check_custodian.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/weatherreport/src/weatherreport_check_custodian.erl b/src/weatherreport/src/weatherreport_check_custodian.erl index 1beb99f5e..36a6a4c8b 100644 --- a/src/weatherreport/src/weatherreport_check_custodian.erl +++ b/src/weatherreport/src/weatherreport_check_custodian.erl @@ -27,6 +27,8 @@ %% Shard liveness is similar but also requires nodes containing copies %% to be actively participating in the cluster. If one or more nodes %% containing copies are in maintenance mode then liveness is impaired. +%% Messages are also returned for any databases where there are +%% conflicting shard maps. -module(weatherreport_check_custodian). -behaviour(weatherreport_check). @@ -56,7 +58,9 @@ n_to_level(_) -> info. report_to_message({DbName, ShardRange, {Type, N}}) -> - {n_to_level(N), {Type, N, DbName, ShardRange}}. + {n_to_level(N), {Type, N, DbName, ShardRange}}; +report_to_message({DbName, {conflicted, N}}) -> + {warning, {conflicted, N, DbName}}. -spec check(list()) -> [{atom(), term()}]. check(_Opts) -> @@ -71,4 +75,8 @@ check(_Opts) -> format(ok) -> {"All shards available and alive.", []}; format({Type, N, DbName, ShardRange}) -> - {"~w ~w shards for Db: ~s Range: ~w.", [N, Type, DbName, ShardRange]}. + {"~w ~w shards for Db: ~s Range: ~w.", [N, Type, DbName, ShardRange]}; +format({conflicted, 1, DbName}) -> + {"1 conflicted shard map for Db: ~s", [DbName]}; +format({conflicted, N, DbName}) -> + {"~w conflicted shard maps for Db: ~s", [N, DbName]}. |