You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2025/05/16 03:38:03 UTC
(couchdb) branch improve-couch-debug updated (7167b3303 -> aac7a9aef)
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a change to branch improve-couch-debug
in repository https://gitbox.apache.org/repos/asf/couchdb.git
discard 7167b3303 Fix `couch_debug:ping/1` function clause error
discard c5c9cee74 Use `module_info(exports)` instead of hardcoding
new 59d395efb Fix `mem3:ping/1` function clause error
new f5a945a57 Add missing functions to `help/0`
new aac7a9aef Improve `couch_debug.erl`
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (7167b3303)
\
N -- N -- N refs/heads/improve-couch-debug (aac7a9aef)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 3 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.
Summary of changes:
src/couch/src/couch_debug.erl | 34 ++++++++++++++------
.../src/{couch_debug.erl => couch_debug.erl.orig} | 36 ++++++++++++++++++++--
src/mem3/src/mem3.erl | 7 ++---
3 files changed, 59 insertions(+), 18 deletions(-)
copy src/couch/src/{couch_debug.erl => couch_debug.erl.orig} (97%)
(couchdb) 03/03: Improve `couch_debug.erl`
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a commit to branch improve-couch-debug
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit aac7a9aef247e6693973179c328f0545c3173938
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Wed May 14 14:33:08 2025 -0500
Improve `couch_debug.erl`
- Use `module_info(exports)` instead of hardcoding.
- Export `print_tree/2` as it's already documented in `couch_debug:help/1` function.
- Add a new line after each resource hoggers snapshot table for better viewing.
- Add `couch_debug:ping_live_cluster_nodes/0`, and `ping_live_cluster_nodes/1`.
---
src/couch/src/couch_debug.erl | 65 ++++++++++------------
.../src/{couch_debug.erl => couch_debug.erl.orig} | 9 ++-
2 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/src/couch/src/couch_debug.erl b/src/couch/src/couch_debug.erl
index 9889a50a8..0c05ebd6a 100644
--- a/src/couch/src/couch_debug.erl
+++ b/src/couch/src/couch_debug.erl
@@ -48,7 +48,8 @@
dead_nodes/1,
ping/1,
ping/2,
- ping_nodes/0,
+ ping_live_cluster_nodes/0,
+ ping_live_cluster_nodes/1,
ping_nodes/1,
ping_nodes/2,
node_events/0
@@ -57,9 +58,12 @@
-export([
print_table/2,
print_report/1,
- print_report_with_info_width/2
+ print_report_with_info_width/2,
+ print_tree/2
]).
+-define(PING_TIMEOUT_IN_MS, 60000).
+
-type throw(_Reason) :: no_return().
-type process_name() :: atom().
@@ -75,34 +79,7 @@
-spec help() -> [function_name()].
help() ->
- [
- busy,
- opened_files,
- opened_files_by_regexp,
- opened_files_contains,
- process_name,
- get_pid,
- link_tree,
- mapfold_tree,
- fold_tree,
- map_tree,
- linked_processes_info,
- print_linked_processes,
- memory_info,
- resource_hoggers,
- resource_hoggers_snapshot,
- analyze_resource_hoggers,
- print_table,
- print_report,
- print_report_with_info_width,
- print_tree,
- restart,
- restart_busy,
- dead_nodes,
- ping,
- ping_nodes,
- node_events
- ].
+ lists:uniq([F || {F, _A} <- couch_debug:module_info(exports)]) -- [help, module_info].
-spec help(Function :: function_name()) -> ok.
%% erlfmt-ignore
@@ -472,18 +449,27 @@ help(ping) ->
Ping a node and return either a time in microseconds or an error term.
+ ---
+ ", []);
+help(ping_live_cluster_nodes) ->
+ io:format("
+ ping_live_cluster_nodes()
+ ping_live_cluster_nodes(Timeout)
+ --------------------------------
+
+ Ping the currently connected cluster nodes. Returns a list of
+ {Node, Result} tuples or an empty list.
+
---
", []);
help(ping_nodes) ->
io:format("
- ping_nodes()
- ping_nodes(Timeout)
+ ping_nodes(Nodes)
ping_nodes(Nodes, Timeout)
--------------------------------
- Ping the list of currently connected nodes. Return a list of {Node,
- Result} tuples where Result is either a time in microseconds or an
- error term.
+ Ping the list of nodes. Return a list of {Node, Result} tuples where
+ Result is either a time in microseconds or an error term.
---
", []);
@@ -773,6 +759,7 @@ info_size(InfoKV) ->
{binary, BinInfos} -> lists:sum([S || {_, S, _} <- BinInfos]);
{_, V} -> V
end.
+
resource_hoggers(MemoryInfo, InfoKey) ->
KeyFun = fun
({_Pid, _Id, undefined}) -> undefined;
@@ -981,12 +968,15 @@ ping(Node) ->
ping(Node, Timeout) ->
mem3:ping(Node, Timeout).
-ping_nodes() ->
+ping_live_cluster_nodes() ->
mem3:ping_nodes().
-ping_nodes(Timeout) ->
+ping_live_cluster_nodes(Timeout) ->
mem3:ping_nodes(Timeout).
+ping_nodes(Nodes) ->
+ mem3:ping_nodes(Nodes, ?PING_TIMEOUT_IN_MS).
+
ping_nodes(Nodes, Timeout) ->
mem3:ping_nodes(Nodes, Timeout).
@@ -1012,6 +1002,7 @@ print_table(Rows, TableSpec) ->
end,
Rows
),
+ io:format("~n", []),
ok.
print_report(Report) ->
diff --git a/src/couch/src/couch_debug.erl b/src/couch/src/couch_debug.erl.orig
similarity index 99%
copy from src/couch/src/couch_debug.erl
copy to src/couch/src/couch_debug.erl.orig
index 9889a50a8..cf65c376f 100644
--- a/src/couch/src/couch_debug.erl
+++ b/src/couch/src/couch_debug.erl.orig
@@ -57,7 +57,8 @@
-export([
print_table/2,
print_report/1,
- print_report_with_info_width/2
+ print_report_with_info_width/2,
+ print_tree/2
]).
-type throw(_Reason) :: no_return().
@@ -75,6 +76,7 @@
-spec help() -> [function_name()].
help() ->
+<<<<<<< HEAD
[
busy,
opened_files,
@@ -103,6 +105,9 @@ help() ->
ping_nodes,
node_events
].
+=======
+ lists:uniq([F || {F, _A} <- couch_debug:module_info(exports)]).
+>>>>>>> c5c9cee74 (Use `module_info(exports)` instead of hardcoding)
-spec help(Function :: function_name()) -> ok.
%% erlfmt-ignore
@@ -773,6 +778,7 @@ info_size(InfoKV) ->
{binary, BinInfos} -> lists:sum([S || {_, S, _} <- BinInfos]);
{_, V} -> V
end.
+
resource_hoggers(MemoryInfo, InfoKey) ->
KeyFun = fun
({_Pid, _Id, undefined}) -> undefined;
@@ -1012,6 +1018,7 @@ print_table(Rows, TableSpec) ->
end,
Rows
),
+ io:format("~n", []),
ok.
print_report(Report) ->
(couchdb) 01/03: Fix `mem3:ping/1` function clause error
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a commit to branch improve-couch-debug
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 59d395efb829956c12152424bdbbdd8c545420a8
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Thu May 15 21:57:23 2025 -0500
Fix `mem3:ping/1` function clause error
Error log:
```
** exception error: no function clause matching mem3:ping_nodes(['node2@127.0.0.1']) (src/mem3.erl, line 453)
```
---
src/mem3/src/mem3.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mem3/src/mem3.erl b/src/mem3/src/mem3.erl
index c0d64d7e4..5e419ea12 100644
--- a/src/mem3/src/mem3.erl
+++ b/src/mem3/src/mem3.erl
@@ -434,7 +434,7 @@ engine(Opts) when is_list(Opts) ->
-spec ping(node()) -> pos_integer() | Error :: term().
ping(Node) ->
- [{Node, Res}] = ping_nodes([Node]),
+ [{Node, Res}] = ping_nodes([Node], ?PING_TIMEOUT_IN_MS),
Res.
-spec ping(node(), Timeout :: pos_integer()) -> pos_integer() | Error :: term().
(couchdb) 02/03: Add missing functions to `help/0`
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jiahuili430 pushed a commit to branch improve-couch-debug
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit f5a945a57fb7b798154e3d0eaaf3e7b14e0bb5fc
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Thu May 15 21:49:59 2025 -0500
Add missing functions to `help/0`
---
src/couch/src/couch_debug.erl | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/couch/src/couch_debug.erl b/src/couch/src/couch_debug.erl
index ff864210f..9889a50a8 100644
--- a/src/couch/src/couch_debug.erl
+++ b/src/couch/src/couch_debug.erl
@@ -83,18 +83,23 @@ help() ->
process_name,
get_pid,
link_tree,
- mapfold,
- map,
- fold,
+ mapfold_tree,
+ fold_tree,
+ map_tree,
linked_processes_info,
print_linked_processes,
memory_info,
+ resource_hoggers,
+ resource_hoggers_snapshot,
+ analyze_resource_hoggers,
print_table,
print_report,
print_report_with_info_width,
+ print_tree,
restart,
restart_busy,
dead_nodes,
+ ping,
ping_nodes,
node_events
].