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 2021/02/23 17:51:44 UTC

[GitHub] [couchdb] iilyak commented on a change in pull request #3380: Clean up logs 3.x.v2

iilyak commented on a change in pull request #3380:
URL: https://github.com/apache/couchdb/pull/3380#discussion_r581256199



##########
File path: src/couch/src/couch_bt_engine.erl
##########
@@ -192,6 +193,44 @@ handle_db_updater_info({'DOWN', Ref, _, _, _}, #st{fd_monitor=Ref} = St) ->
     {stop, normal, St#st{fd=undefined, fd_monitor=closed}}.
 
 
+format_status(normal, [_PDict, #st{} = St]) ->
+    [{data, [{"State", St}]}];
+
+format_status(terminate, [_PDict, #st{} = St]) ->
+    [{data, [{"State", reduce_record(St)}]}].
+
+
+reduce_record(#st{} = St) ->
+    reduce_record(St, undefined).
+
+reduce_record(#st{} = St, _) ->
+    #st{
+        header = Header,
+        id_tree = IdTree,
+        seq_tree = SeqTree,
+        local_tree = LocalTree,
+        purge_tree = PurgeTree,
+        purge_seq_tree = PurgeSeqTree
+    } = St,
+    St#st{
+        header = reduce_record(Header, undefined),
+        id_tree = reduce_record(IdTree, undefined),
+        seq_tree = reduce_record(SeqTree, undefined),
+        local_tree = reduce_record(LocalTree, undefined),
+        purge_tree = reduce_record(PurgeTree, undefined),
+        purge_seq_tree = reduce_record(PurgeSeqTree, undefined)
+    };
+
+reduce_record(Header, _) when element(1, Header) =:= db_header ->

Review comment:
       The `is_record/2` works only for records in scope of a module (defined locally or included). The `db_header` is a private record defined in `couch_bt_engine_header.erl`. 
   
   ```
   couchdb/src/couch/src/couch_bt_engine.erl:224: record db_header undefined
   Compiling couchdb/src/couch/src/couch_bt_engine.erl failed:
   ERROR: compile failed while processing couchdb/src/couch: rebar_abort
   ```




----------------------------------------------------------------
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.

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