noahshaw11 commented on a change in pull request #3766:
URL: https://github.com/apache/couchdb/pull/3766#discussion_r816275975
##########
File path: src/smoosh/src/smoosh_channel.erl
##########
@@ -194,18 +231,144 @@ handle_info(check_window, State0) ->
end,
erlang:send_after(60 * 1000, self(), check_window),
{noreply, FinalState};
-handle_info(pause, State0) ->
- {ok, State} = code_change(nil, State0, nil),
+handle_info(start_recovery, #state{name = Name, waiting = Waiting0} = State0)
->
+ RecActive = recover(active_file_name(Name)),
+ Waiting1 = lists:foldl(
+ fun(DbName, Acc) ->
+ case couch_db:is_compacting(DbName) of
+ true ->
+ Priority = smoosh_server:get_priority(Name, DbName),
+ smoosh_priority_queue:in(DbName, Priority, Priority, Acc);
+ false ->
+ Acc
+ end
+ end,
+ Waiting0,
+ RecActive
+ ),
+ State1 = maybe_start_compaction(State0#state{paused = false, waiting =
Waiting1}),
+ couch_log:notice(
+ "~p Previously active compaction jobs (if any) have been successfully
recovered and restarted.",
+ [?MODULE]
+ ),
+ erlang:send_after(?ACTIVATE_DELAY_IN_MSEC, self(), activate),
Review comment:
Doing it this way will cause an infinite loop:
1. Enter `maybe_start_compaction` in `activate`.
2. State is not activated so it calls `activate` again, and this continues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]