You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/07/18 23:29:34 UTC

[GitHub] [couchdb] noahshaw11 commented on a diff in pull request #4033: Implement index report functions

noahshaw11 commented on code in PR #4033:
URL: https://github.com/apache/couchdb/pull/4033#discussion_r923937628


##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -34,7 +50,223 @@ help(view_signature) ->
     io:format("
     view_signature(ShardName, DDocName)
     --------------
+
     Returns a view signature for given ddoc for a given (non clustered) database.
+
+    ---
+    ", []);
+help(index_state) ->
+    io:format("
+    index_state(Pid)
+    --------------
+
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+
+    Returns a state map for an index that includes the following fields:
+        - collator_versions
+        - compact_running
+        - db_name
+        - idx_name
+        - language
+        - pending_updates
+        - purge_seq
+        - signature
+        - sizes
+        - update_options
+        - update_seq
+        - updater_running
+        - view_file_path
+        - waiting_clients
+        - waiting_commit
+
+    ---
+    ", []);
+help(view_state) ->
+    io:format("
+    view_state(PidOrIdxState)
+    view_state(Pid, ViewName)
+    view_state(IdxState, ViewName)
+    --------------
+
+    PidOrIdxState: Pid of couch_index:init/1, specifically an mrview index, or the state
+    of an mrview index.
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+    IdxState: State of an mrview index (#mrst{} record).
+    ViewName: Name of the view to be queried or undefined.
+
+    Returns a state map for a ViewName if specified or all views if not that includes the
+    following fields:
+        - btree_size
+        - def
+        - id_num
+        - options
+        - purge_seq
+        - reduce_funs
+        - update_seq
+
+    ---
+    ", []);
+help(index_view_state) ->
+    io:format("
+    index_view_state(Pid)
+    index_view_state(Pid, ViewName)
+    --------------
+
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+    ViewName: Name of the view to be queried or undefined.
+
+    Returns a state map that includes the index state returned by index_state/1 and the view
+    state returned by view_state/2. Like view_state/2, a ViewName can be specified or not.
+
+    ---
+    ", []);
+help(index_report) ->
+    io:format("
+    index_report(Pid)
+    --------------
+
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+
+    Prints a report for the index state of an mrview index that includes the following fields:
+        - signature
+        - db_name
+        - idx_name
+        - update_seq
+        - purge_seq
+        - view_file_path
+        - pending_updates
+
+    The output will look similar to:
+
+        |info                 |                                                                                               value
+        |  collator_versions  |                                                                                             153.112
+        |  compact_running    |                                                                                               false
+        |  db_name            |                                                            shards/00000000-ffffffff/dbv1.1658165106
+        |  idx_name           |                                                                                    _design/dbv1ddoc
+        |  language           |                                                                                          javascript
+        |  pending_updates    |                                                                                                   0
+        |  purge_seq          |                                                                                                   0
+        |  signature          |                                                                    a967fb72089e71e870f790f32bcc6a55
+        |  sizes              |                                                          {[{file,4264},{active,163},{external,51}]}
+        |  update_options     |
+        |  update_seq         |                                                                                                   3
+        |  updater_running    |                                                                                               false
+        |  view_file_path     |1/data/.shards/00000000-ffffffff/dbv1.1658165106_design/mrview/a967fb72089e71e870f790f32bcc6a55.view
+        |  waiting_clients    |                                                                                                   0
+        |  waiting_commit     |                                                                                               false
+
+    ---
+    ", []);
+help(view_report) ->
+    io:format("
+    view_report(PidOrIdxState)
+    view_report(Pid, ViewName)
+    view_report(IdxState, ViewName)
+    --------------
+
+    PidOrIdxState: Pid of couch_index:init/1, specifically an mrview index, or the state
+    of an mrview index.
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+    IdxState: State of an mrview index (#mrst{} record).
+    ViewName: Name of the view to be queried or undefined.
+
+    Prints a report for a ViewName if specified or all views if not that includes the following
+    fields:
+        - id_num
+        - update_seq
+        - purge_seq
+        - reduce_funs
+        - def
+        - btree_size
+        - options
+
+    The output will look similar to:
+
+        \"dbv1view\"
+        |info           |                                                                                               value
+        |  btree_size   |                                                                                                  51
+        |  def          |                                                                     function(doc){emit(doc.id, 1);}
+        |  id_num       |                                                                                                   0
+        |  options      |
+        |  purge_seq    |                                                                                                   0
+        |  reduce_funs  |
+        |  update_seq   |                                                                                                   3
+        \"dbv2view\"
+        |info           |                                                                                               value
+        |  btree_size   |                                                                                                  50
+        |  def          |                                                                     function(doc){emit(doc.id, 2);}
+        |  id_num       |                                                                                                   1
+        |  options      |
+        |  purge_seq    |                                                                                                   0
+        |  reduce_funs  |                                                                                                _sum
+        |  update_seq   |                                                                                                   3
+
+    ---
+    ", []);
+help(index_view_report) ->
+    io:format("
+    index_view_report(Pid)
+    index_view_report(Pid, ViewName)
+    --------------
+
+    Pid: Pid of couch_index:init/1, specifically an mrview index.
+    ViewName: Name of the view to be queried or undefined.
+
+    Prints a report for the index state and views of an mrview index. The report includes the following
+    fields for an index state:
+        - signature
+        - db_name
+        - idx_name
+        - update_seq
+        - purge_seq
+        - view_file_path
+        - pending_updates
+    The report also includes the following fields for a ViewName if specified or all views if not:
+        - id_num
+        - update_seq
+        - purge_seq
+        - reduce_funs
+        - def
+        - btree_size
+        - options
+
+    The output will look similar to:
+
+        |info                 |                                                                                               value
+        |  collator_versions  |                                                                                             153.112
+        |  compact_running    |                                                                                               false
+        |  db_name            |                                                            shards/00000000-ffffffff/dbv1.1658165106
+        |  idx_name           |                                                                                    _design/dbv1ddoc
+        |  language           |                                                                                          javascript
+        |  pending_updates    |                                                                                                   0
+        |  purge_seq          |                                                                                                   0
+        |  signature          |                                                                    a967fb72089e71e870f790f32bcc6a55
+        |  sizes              |                                                          {[{file,4264},{active,163},{external,51}]}
+        |  update_options     |
+        |  update_seq         |                                                                                                   3
+        |  updater_running    |                                                                                               false
+        |  view_file_path     |1/data/.shards/00000000-ffffffff/dbv1.1658165106_design/mrview/a967fb72089e71e870f790f32bcc6a55.view
+        |  waiting_clients    |                                                                                                   0
+        |  waiting_commit     |                                                                                               false
+        \"dbv1view\"

Review Comment:
   Removed. Now only `dbv1view` is printed.



-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org