Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "disallow rebalance for 5 minutes" changes.

Revert "disallow rebalance 5 minutes after rebalance fails"
This reverts commit 93e35a2.
Revert "extended ServersSection#postAndReload for better error handling"
This reverts commit 05319f7.
Revert "pass xhr object to error callback of postWithValidationErrors"
This reverts commit 1f1f685.

Change-Id: I3b27f2ebb2db2eb5d49e4db01f250d4fdca3d673
Reviewed-on: http://review.couchbase.org/10209
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Farshid Ghods <farshid.ghods@gmail.com>
Tested-by: Farshid Ghods <farshid.ghods@gmail.com>
  • Loading branch information...
commit 4925ee0838cd3d24ce1dec7b6c29412a5102d430 1 parent 93e35a2
@aartamonau aartamonau authored farshidce committed
View
2  priv/public/js/app-misc.js
@@ -137,7 +137,7 @@ function postWithValidationErrors(url, data, callback, ajaxOptions) {
}
errorsData = [errorsData];
}
- callback.call(this, errorsData, 'error', data);
+ callback.call(this, errorsData, 'error');
}
if (!_.isString(data)) {
View
31 priv/public/js/servers.js
@@ -308,36 +308,11 @@ var ServersSection = {
var self = this;
self.postAndReload(self.poolDetails.value.controllers.rebalance.uri,
{knownNodes: _.pluck(self.allNodes, 'otpNode').join(','),
- ejectedNodes: _.pluck(self.pendingEject, 'otpNode').join(',')},
- onError);
+ ejectedNodes: _.pluck(self.pendingEject, 'otpNode').join(',')});
self.poolDetails.getValue(function () {
// switch to active server tab when poolDetails reload is complete
self.tabs.setValue("active");
});
-
- function onError(data, status, xhr) {
- var statusCode = 0;
- var message = "Request failed. Check logs."
- try {
- statusCode = xhr.status;
- } catch (e) {}
- if (statusCode === 503) {
- var retryAfterString = xhr.getResponseHeader("Retry-After");
- var retryAfter = parseHTTPDate(String(retryAfterString));
- if (retryAfter != null) {
- message = "System needs to cool down from the last rebalance attempt. Please try again at ";
- message += retryAfter.toString();
- message += " (" + retryAfterString + ").";
-
- var now = (new Date()).valueOf();
- var diff = ((retryAfter.valueOf() - now + 999) / 1000) >> 0;
- if (diff > 0) {
- message += " According to your browser's clock it is " + diff + " seconds from now."
- }
- }
- }
- displayNotice(message, true);
- }
},
onStopRebalance: function () {
this.postAndReload(this.poolDetails.value.stopRebalanceUri, "");
@@ -520,9 +495,7 @@ var ServersSection = {
// re-calc poolDetails according to it's formula
self.poolDetails.invalidate();
if (status == 'error') {
- if (typeof(errorMessage) === "function") {
- errorMessage.apply(null, arguments);
- } else if (data[0].mismatch) {
+ if (data[0].mismatch) {
self.poolDetails.changedSlot.subscribeOnce(function () {
var msg = "Could not Rebalance because the cluster configuration was modified by someone else.\nYou may want to verify the latest cluster configuration and, if necessary, please retry a Rebalance."
alert(msg);
View
6 src/menelaus_web.erl
@@ -1414,11 +1414,7 @@ do_handle_rebalance(Req, KnownNodesS, EjectedNodesS) ->
no_active_nodes_left ->
Req:respond({400, [], []});
ok ->
- Req:respond({200, [], []});
- {rebalance_needs_cool_down, TS} ->
- TimeString = httpd_util:rfc1123_date(calendar:now_to_local_time(TS)),
- Req:respond({503, [{"Retry-After", TimeString}],
- "Rebalance retry needs some time to cool down. Retry at: " ++ TimeString})
+ Req:respond({200, [], []})
end.
handle_rebalance_progress(_PoolId, Req) ->
View
3  src/ns_cluster_membership.erl
@@ -87,9 +87,6 @@ system_joinable() ->
get_rebalance_status() ->
ns_orchestrator:rebalance_progress().
--spec start_rebalance([node()], [node()]) ->
- no_active_nodes_left | nodes_mismatch |
- ok | in_progress | already_balanced | {rebalance_needs_cool_down, tuple()}.
start_rebalance(KnownNodes, KnownNodes) ->
no_active_nodes_left;
start_rebalance(KnownNodes, EjectedNodes) ->
View
52 src/ns_orchestrator.erl
@@ -117,32 +117,11 @@ rebalance_progress() ->
request_janitor_run(BucketName) ->
gen_fsm:send_event(?SERVER, {request_janitor_run, BucketName}).
--define(REBALANCE_COOL_DOWN_MICROS, (1000000 * 60 * 5)).
-
-spec start_rebalance([node()], [node()], [node()]) ->
- ok | in_progress | already_balanced | {rebalance_needs_cool_down, tuple()}.
+ ok | in_progress | already_balanced.
start_rebalance(KeepNodes, EjectNodes, FailedNodes) ->
- CoolDownMessage = case ns_config:search(rebalance_failure_ts) of
- false -> undefined;
- {value, undefined} -> undefined;
- {value, FailTS} ->
- Diff = timer:now_diff(os:timestamp(), FailTS),
- if
- 0 =< Diff andalso Diff =< ?REBALANCE_COOL_DOWN_MICROS ->
- Secs = element(1, FailTS) * 1000000 +
- element(2, FailTS) +
- (element(3, FailTS) + 999999 + ?REBALANCE_COOL_DOWN_MICROS) div 1000000,
- {rebalance_needs_cool_down, {Secs div 1000000, Secs rem 1000000, 0}};
- true -> undefined
- end
- end,
- case CoolDownMessage of
- undefined ->
- gen_fsm:sync_send_event(?SERVER, {start_rebalance, KeepNodes,
- EjectNodes, FailedNodes});
- _ ->
- CoolDownMessage
- end.
+ gen_fsm:sync_send_event(?SERVER, {start_rebalance, KeepNodes,
+ EjectNodes, FailedNodes}).
-spec stop_rebalance() -> ok | not_rebalancing.
@@ -208,21 +187,18 @@ handle_info({'EXIT', Pid, Reason}, janitor_running,
{next_state, idle, #idle_state{remaining_buckets = Buckets}};
handle_info({'EXIT', Pid, Reason}, rebalancing,
#rebalancing_state{rebalancer=Pid}) ->
- {Status, FailTS} =
- case Reason of
- normal ->
- ns_log:log(?MODULE, ?REBALANCE_SUCCESSFUL,
- "Rebalance completed successfully.~n"),
- {none, undefined};
- _ ->
- ns_log:log(?MODULE, ?REBALANCE_FAILED,
- "Rebalance exited with reason ~p~n", [Reason]),
- {{none, <<"Rebalance failed. See logs for detailed reason. "
- "You can try rebalance again.">>},
- os:timestamp()}
- end,
+ Status = case Reason of
+ normal ->
+ ns_log:log(?MODULE, ?REBALANCE_SUCCESSFUL,
+ "Rebalance completed successfully.~n"),
+ none;
+ _ ->
+ ns_log:log(?MODULE, ?REBALANCE_FAILED,
+ "Rebalance exited with reason ~p~n", [Reason]),
+ {none, <<"Rebalance failed. See logs for detailed reason. "
+ "You can try rebalance again.">>}
+ end,
ns_config:set(rebalance_status, Status),
- ns_config:set(rebalance_failure_ts, FailTS),
{next_state, idle, #idle_state{}};
handle_info(Msg, StateName, StateData) ->
?log_warning("Got unexpected message ~p in state ~p with data ~p",
Please sign in to comment.
Something went wrong with that request. Please try again.