You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by to...@apache.org on 2020/08/25 18:26:18 UTC

[couchdb] 01/01: clear jobs data in active area during removal

This is an automated email from the ASF dual-hosted git repository.

tonysun83 pushed a commit to branch fix-couch-jobs-for-active-tasks
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 3c2fc453e2f899bbe76ff37ae18566f31186e21f
Author: Tony Sun <to...@gmail.com>
AuthorDate: Tue Aug 25 11:22:06 2020 -0700

    clear jobs data in active area during removal
    
    During job removal, it was not cleared from the active area so
    active_tasks would mistakenly believe the job still existed. When we
    try to actually open the data it is not there and not_found error
    would be issued.@nvatama found this issue during replication work.
---
 src/couch_jobs/src/couch_jobs_fdb.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/couch_jobs/src/couch_jobs_fdb.erl b/src/couch_jobs/src/couch_jobs_fdb.erl
index 891aedc..3fcad55 100644
--- a/src/couch_jobs/src/couch_jobs_fdb.erl
+++ b/src/couch_jobs/src/couch_jobs_fdb.erl
@@ -119,8 +119,9 @@ remove(#{jtx := true} = JTx0, #{job := true} = Job) ->
     #{type := Type, id := JobId} = Job,
     Key = job_key(JTx, Job),
     case get_job_val(Tx, Key) of
-        #jv{stime = STime} ->
+        #jv{stime = STime, seq = Seq} ->
             couch_jobs_pending:remove(JTx, Type, JobId, STime),
+            clear_activity(JTx, Type, Seq),
             erlfdb:clear(Tx, Key),
             update_watch(JTx, Type),
             ok;