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 2021/04/16 21:45:12 UTC
[couchdb] 07/24: Clean up couch_debug
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit e909cdbb5d1ed30bc7bdfd8ac6b4af36ca1b9224
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed Apr 14 00:21:52 2021 -0400
Clean up couch_debug
Remove logic handling index directories and couch_files. Definitely not a
comprehensive cleanup. We should probably have a separate PR to pick out what
would be useful for `main`.
---
src/couch/src/couch_debug.erl | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/src/couch/src/couch_debug.erl b/src/couch/src/couch_debug.erl
index 290d095..80feb61 100644
--- a/src/couch/src/couch_debug.erl
+++ b/src/couch/src/couch_debug.erl
@@ -370,8 +370,6 @@ fold_tree(Tree, Acc, Fun) ->
linked_processes_info(Pid, Info) ->
link_tree(Pid, Info, fun(P, Props) -> {process_name(P), Props} end).
-print_linked_processes(couch_index_server) ->
- print_couch_index_server_processes();
print_linked_processes(Name) when is_atom(Name) ->
case whereis(Name) of
undefined -> {error, {unknown, Name}};
@@ -386,42 +384,6 @@ print_linked_processes(Pid) when is_pid(Pid) ->
Tree = linked_processes_info(Pid, Info),
print_tree(Tree, TableSpec).
-id("couch_file:init" ++ _, Pid, _Props) ->
- case couch_file:process_info(Pid) of
- {{file_descriptor, prim_file, {Port, Fd}}, FilePath} ->
- term2str([
- term2str(Fd), ":",
- term2str(Port), ":",
- shorten_path(FilePath)]);
- undefined ->
- ""
- end;
-id(_IdStr, _Pid, _Props) ->
- "".
-
-print_couch_index_server_processes() ->
- Info = [reductions, message_queue_len, memory],
- TableSpec = [
- {50, left, name}, {12, centre, reductions},
- {19, centre, message_queue_len}, {14, centre, memory}, {id}
- ],
-
- Tree = link_tree(whereis(couch_index_server), Info, fun(P, Props) ->
- IdStr = process_name(P),
- {IdStr, [{id, id(IdStr, P, Props)} | Props]}
- end),
- print_tree(Tree, TableSpec).
-
-shorten_path(Path) ->
- ViewDir = list_to_binary(config:get("couchdb", "view_index_dir")),
- DatabaseDir = list_to_binary(config:get("couchdb", "database_dir")),
- File = list_to_binary(Path),
- Len = max(
- binary:longest_common_prefix([File, DatabaseDir]),
- binary:longest_common_prefix([File, ViewDir])
- ),
- <<_:Len/binary, Rest/binary>> = File,
- binary_to_list(Rest).
%% Pretty print functions