You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/09/09 19:34:07 UTC

[couchdb] branch add-node-and-pid-to-active-tasks created (now c53ce00)

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

vatamane pushed a change to branch add-node-and-pid-to-active-tasks
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at c53ce00  Add node and pid to indexer active tasks output

This branch includes the following new commits:

     new c53ce00  Add node and pid to indexer active tasks output

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Add node and pid to indexer active tasks output

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch add-node-and-pid-to-active-tasks
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit c53ce00321246732546b85911a9029409e16f971
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed Sep 9 15:33:24 2020 -0400

    Add node and pid to indexer active tasks output
---
 src/couch_views/src/couch_views_util.erl               |  4 +++-
 src/couch_views/test/couch_views_active_tasks_test.erl | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/couch_views/src/couch_views_util.erl b/src/couch_views/src/couch_views_util.erl
index 11bba75..6298acf 100644
--- a/src/couch_views/src/couch_views_util.erl
+++ b/src/couch_views/src/couch_views_util.erl
@@ -286,7 +286,9 @@ active_tasks_info(ChangesDone, DbName, DDocId, LastSeq, DBSeq) ->
         <<"changes_done">> => ChangesDone,
         <<"design_document">> => DDocId,
         <<"current_version_stamp">> => convert_seq_to_stamp(LastSeq),
-        <<"db_version_stamp">> => convert_seq_to_stamp(DBSeq)
+        <<"db_version_stamp">> => convert_seq_to_stamp(DBSeq),
+        <<"node">> => erlang:atom_to_binary(node(), utf8),
+        <<"pid">> => list_to_binary(pid_to_list(self()))
     }.
 
 
diff --git a/src/couch_views/test/couch_views_active_tasks_test.erl b/src/couch_views/test/couch_views_active_tasks_test.erl
index f87e010..c782ffc 100644
--- a/src/couch_views/test/couch_views_active_tasks_test.erl
+++ b/src/couch_views/test/couch_views_active_tasks_test.erl
@@ -81,6 +81,19 @@ verify_basic_active_tasks({Db, DDoc}) ->
     {IndexerPid, {changes_done, ChangesDone}} = wait_to_reach_changes(10000),
     [ActiveTask] = fabric2_active_tasks:get_active_tasks(),
     ChangesDone1 = maps:get(<<"changes_done">>, ActiveTask),
+    Type = maps:get(<<"type">>, ActiveTask),
+    DbName = maps:get(<<"database">>, ActiveTask),
+    DDocId = maps:get(<<"design_document">>, ActiveTask),
+    Node = maps:get(<<"node">>, ActiveTask),
+    PidBin = maps:get(<<"pid">>, ActiveTask),
+    Pid = erlang:list_to_pid(binary_to_list(PidBin)),
+    ?assertEqual(<<"indexer">>, Type),
+    ?assertEqual(fabric2_db:name(Db), DbName),
+    ?assertEqual(?INDEX_FOO, DDocId),
+    ?assertEqual(atom_to_binary(node(), utf8), Node),
+    ?assert(is_pid(Pid)),
+    ?assert(is_process_alive(Pid)),
+    ?assertEqual(IndexerPid, Pid),
     IndexerPid ! continue,
     % we assume the indexer has run for a bit so it has to > 0
     ?assert(ChangesDone1 > 0),