You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/04/10 21:31:08 UTC
[couchdb] 09/11: Remove jobs on index cleanup
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 2e5a5566be88036ae6bb8d1f420bd6028f7c6253
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Apr 9 12:57:51 2020 -0500
Remove jobs on index cleanup
---
src/couch_views/src/couch_views.erl | 1 +
src/couch_views/src/couch_views_jobs.erl | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/couch_views/src/couch_views.erl b/src/couch_views/src/couch_views.erl
index cc18364..9d518eb 100644
--- a/src/couch_views/src/couch_views.erl
+++ b/src/couch_views/src/couch_views.erl
@@ -90,6 +90,7 @@ cleanup_indices(#{} = Db, DDocs) when is_list(DDocs) ->
ExistingSigs = couch_views_fdb:list_signatures(Db),
StaleSigs = ExistingSigs -- ActiveSigs,
lists:foreach(fun(Sig) ->
+ couch_views_jobs:remove(Db, Sig),
couch_views_fdb:clear_index(Db, Sig)
end, StaleSigs).
diff --git a/src/couch_views/src/couch_views_jobs.erl b/src/couch_views/src/couch_views_jobs.erl
index b97e7ce..76cc563 100644
--- a/src/couch_views/src/couch_views_jobs.erl
+++ b/src/couch_views/src/couch_views_jobs.erl
@@ -15,7 +15,8 @@
-export([
set_timeout/0,
build_view/3,
- build_view_async/2
+ build_view_async/2,
+ remove/2
]).
-ifdef(TEST).
@@ -60,6 +61,12 @@ build_view_async(TxDb0, Mrst) ->
{ok, JobId}.
+remove(TxDb, Sig) ->
+ DbName = fabric2_db:name(TxDb),
+ JobId = job_id(DbName, Sig),
+ couch_jobs:remove(TxDb, ?INDEX_JOB_TYPE, JobId).
+
+
ensure_correct_tx(#{tx := undefined} = TxDb) ->
TxDb;