iilyak commented on a change in pull request #3766:
URL: https://github.com/apache/couchdb/pull/3766#discussion_r775635176
##########
File path: src/smoosh/src/smoosh_channel.erl
##########
@@ -232,22 +232,24 @@ handle_info(unpause, State0) ->
State = maybe_open_queue(State0),
{noreply, maybe_start_compaction(State#state{paused = false})}.
-terminate(_Reason, #state{name = Name, waiting = Q}) ->
- file:delete(active_file_name(Name)),
- file:delete(starting_file_name(Name)),
- if
- Q =/= nil ->
- smoosh_priority_queue:close(Q);
- true ->
- nil
- end,
+terminate(_Reason, _State) ->
ok.
maybe_recover_state(#state{name = Name} = State) ->
Active = recover(active_file_name(Name)),
Starting = recover(starting_file_name(Name)),
- DatabaseDir = config:get("couchdb", "database_dir"),
- Active1 = get_matching_compact_files(DatabaseDir, Active),
+ Active1 = lists:foldl(
+ (fun({DbName, CPid}, Acc) ->
+ case couch_server:is_compacting(DbName) of
+ true ->
+ [{DbName, CPid} | Acc];
Review comment:
I thought about it over weekend and want to share one idea that you have.
Instead of distinguishing between VM restart and smoosh components restart
we could try to use `is_process_alive` and use `{DbName, CPid}` in this case.
To be extra sure we don't run into Pid recycle problem we could have a method
which checks type of a pid.
--
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]