This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/3.x by this push:
new 6462712 Fix smoosh enqueueing not found dbs and typo
new d0bff0b Merge pull request #3970 from
noahshaw11/fix-smoosh-enqueueing-not-found-dbs
6462712 is described below
commit 6462712b755f5b4c40e575776438e6c66e4e684b
Author: ncshaw <[email protected]>
AuthorDate: Fri Mar 25 13:06:04 2022 -0500
Fix smoosh enqueueing not found dbs and typo
---
src/couch/src/couch_db.erl | 4 ++++
src/smoosh/src/smoosh_channel.erl | 20 +++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index cafbb0d..473b785 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -19,6 +19,7 @@
incref/1,
reopen/1,
close/1,
+ exists/1,
clustered_db/2,
clustered_db/3,
@@ -231,6 +232,9 @@ close(#db{} = Db) ->
close(?OLD_DB_REC) ->
ok.
+exists(DbName) ->
+ couch_server:exists(DbName).
+
is_idle(#db{compactor_pid = nil} = Db) ->
monitored_by(Db) == [];
is_idle(_Db) ->
diff --git a/src/smoosh/src/smoosh_channel.erl
b/src/smoosh/src/smoosh_channel.erl
index 064f18a..85b345b 100644
--- a/src/smoosh/src/smoosh_channel.erl
+++ b/src/smoosh/src/smoosh_channel.erl
@@ -223,7 +223,7 @@ handle_info(check_window, State) ->
State;
{false, true} ->
% resume is always safe even if we did not previously suspend
- {reply, ok, NewState} = handle_call(resume, nil, State),
+ {reply, ok, NewState} = handle_call(resume_and_activate, nil,
State),
NewState;
{true, false} ->
if
@@ -240,7 +240,7 @@ 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
+ case couch_db:exists(DbName) andalso
couch_db:is_compacting(DbName) of
true ->
Priority = smoosh_server:get_priority(Name, DbName),
smoosh_priority_queue:in(DbName, Priority, Priority, Acc);
@@ -371,8 +371,13 @@ activate_channel(#state{name = Name, waiting = Waiting0,
requests = Requests0} =
RecStarting = recover(starting_file_name(Name)),
Starting = lists:foldl(
fun(DbName, Acc) ->
- Priority = smoosh_server:get_priority(Name, DbName),
- smoosh_priority_queue:in(DbName, Priority, Priority, Acc)
+ case couch_db:exists(DbName) of
+ true ->
+ Priority = smoosh_server:get_priority(Name, DbName),
+ smoosh_priority_queue:in(DbName, Priority, Priority, Acc);
+ false ->
+ Acc
+ end
end,
Waiting0,
RecStarting
@@ -381,7 +386,12 @@ activate_channel(#state{name = Name, waiting = Waiting0,
requests = Requests0} =
Requests1 = lists:reverse(Requests0),
Waiting2 = lists:foldl(
fun({DbName, Priority}, Acc) ->
- smoosh_priority_queue:in(DbName, Priority, Priority, Acc)
+ case couch_db:exists(DbName) of
+ true ->
+ smoosh_priority_queue:in(DbName, Priority, Priority, Acc);
+ false ->
+ Acc
+ end
end,
Waiting1,
Requests1