You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2021/03/16 16:00:19 UTC
[couchdb] branch clean-up-logs-3.x.v2 created (now 9d2e7af)
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a change to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git.
at 9d2e7af Strip proxy_url in replicator
This branch includes the following new commits:
new fc6292b Revert "fixup: Add format_status/2 callbacks..."
new cbe90e3 Revert "fixup: Add support for pluguable sanitizer module..."
new 8eee6ae Revert "fixup whitespace for format_status/2"
new 4b08f74 Revert "fixup: Fix format_status dispattch in couch_db_engine"
new acb25cf Revert "Add format_status/2 callbacks"
new 5e54ec7 Revert "Add support for pluguable sanitizer module for logger"
new 9d2e7af Strip proxy_url in replicator
The 7 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] 03/07: Revert "fixup whitespace for format_status/2"
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 8eee6ae2546e98c05a3b83a0e1b8105461b9ba01
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:23 2021 -0700
Revert "fixup whitespace for format_status/2"
This reverts commit 59e96d9477d0b13dd801e8c8958a37634d7c46d4.
---
src/couch/src/couch_event_sup.erl | 2 +-
src/couch_event/src/couch_event_os_listener.erl | 2 +-
src/couch_mrview/src/couch_mrview_update_notifier.erl | 2 +-
src/couch_replicator/src/couch_replicator_httpc_pool.erl | 2 +-
src/couch_stats/src/couch_stats_process_tracker.erl | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/couch/src/couch_event_sup.erl b/src/couch/src/couch_event_sup.erl
index c44453b..da59453 100644
--- a/src/couch/src/couch_event_sup.erl
+++ b/src/couch/src/couch_event_sup.erl
@@ -77,4 +77,4 @@ code_change(_OldVsn, State, _Extra) ->
format_status(normal, [_PDict, State]) ->
[{data, [{"State", State}]}];
format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+ {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_event/src/couch_event_os_listener.erl b/src/couch_event/src/couch_event_os_listener.erl
index 9fdf4cc..3908477 100644
--- a/src/couch_event/src/couch_event_os_listener.erl
+++ b/src/couch_event/src/couch_event_os_listener.erl
@@ -81,4 +81,4 @@ format_status(normal, [_PDict, State]) ->
[{data, [{"State", State}]}];
format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+ {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_mrview/src/couch_mrview_update_notifier.erl b/src/couch_mrview/src/couch_mrview_update_notifier.erl
index 6c9c1ad..f23dd39 100644
--- a/src/couch_mrview/src/couch_mrview_update_notifier.erl
+++ b/src/couch_mrview/src/couch_mrview_update_notifier.erl
@@ -51,4 +51,4 @@ code_change(_OldVsn, State, _Extra) ->
format_status(normal, [_PDict, State]) ->
State;
format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+ {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_replicator/src/couch_replicator_httpc_pool.erl b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
index 867c1a3..d93136f 100644
--- a/src/couch_replicator/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
@@ -225,4 +225,4 @@ format_status_test_() ->
ok
end).
--endif.
+-endif.
\ No newline at end of file
diff --git a/src/couch_stats/src/couch_stats_process_tracker.erl b/src/couch_stats/src/couch_stats_process_tracker.erl
index 7a63b23..1334337 100644
--- a/src/couch_stats/src/couch_stats_process_tracker.erl
+++ b/src/couch_stats/src/couch_stats_process_tracker.erl
@@ -86,4 +86,4 @@ format_status(normal, [_PDict, State]) ->
[{data, [{"State", State}]}];
format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+ {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
[couchdb] 05/07: Revert "Add format_status/2 callbacks"
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit acb25cffb1a9fa28348a9c6f24f01b7c1e80d330
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:26 2021 -0700
Revert "Add format_status/2 callbacks"
This reverts commit 134dca46bfb6987c836c023149173e9c4b9b1bf3.
---
src/couch/src/couch_bt_engine.erl | 8 ----
src/couch/src/couch_db_engine.erl | 14 -------
src/couch/src/couch_db_updater.erl | 6 ---
src/couch/src/couch_drv.erl | 6 +--
src/couch/src/couch_event_sup.erl | 8 +---
src/couch/src/couch_file.erl | 7 +---
src/couch/src/couch_httpd_vhost.erl | 7 +---
src/couch/src/couch_multidb_changes.erl | 9 +----
src/couch/src/couch_native_process.erl | 7 +---
src/couch/src/couch_os_process.erl | 8 +---
src/couch/src/couch_proc_manager.erl | 11 +-----
src/couch/src/couch_server.erl | 7 +---
src/couch/src/couch_stream.erl | 7 +---
src/couch/src/couch_task_status.erl | 8 +---
src/couch/src/couch_uuids.erl | 7 +---
src/couch/src/couch_work_queue.erl | 9 +----
src/couch_epi/src/couch_epi_codechange_monitor.erl | 7 +---
src/couch_epi/src/couch_epi_module_keeper.erl | 7 +---
src/couch_event/src/couch_event_os_listener.erl | 10 +----
src/couch_event/src/couch_event_server.erl | 10 +----
src/couch_index/src/couch_index.erl | 26 +-----------
src/couch_index/src/couch_index_compactor.erl | 9 +----
src/couch_index/src/couch_index_server.erl | 9 +----
src/couch_index/src/couch_index_updater.erl | 9 +----
src/couch_mrview/src/couch_mrview_index.erl | 8 ----
.../src/couch_mrview_update_notifier.erl | 7 +---
src/couch_peruser/src/couch_peruser.erl | 10 +----
.../src/couch_replicator_auth_session.erl | 11 ++----
.../src/couch_replicator_clustering.erl | 9 +----
.../src/couch_replicator_db_changes.erl | 10 +----
.../src/couch_replicator_doc_processor.erl | 9 +----
.../src/couch_replicator_httpc_pool.erl | 46 +---------------------
.../src/couch_replicator_notifier.erl | 8 +---
.../src/couch_replicator_rate_limiter.erl | 9 +----
.../src/couch_replicator_scheduler.erl | 15 +++----
.../src/couch_replicator_scheduler_job.erl | 25 +++---------
.../src/couch_replicator_worker.erl | 27 +++----------
src/couch_stats/src/couch_stats_aggregator.erl | 8 +---
.../src/couch_stats_process_tracker.erl | 9 +----
src/ddoc_cache/src/ddoc_cache_entry.erl | 9 +----
src/ddoc_cache/src/ddoc_cache_lru.erl | 10 +----
src/ddoc_cache/src/ddoc_cache_opener.erl | 10 +----
src/dreyfus/src/dreyfus_index.erl | 7 +---
src/dreyfus/src/dreyfus_index_manager.erl | 9 +----
src/global_changes/src/global_changes_server.erl | 9 +----
src/ioq/src/ioq.erl | 8 +---
src/jwtf/src/jwtf_keystore.erl | 8 +---
src/ken/src/ken_server.erl | 8 +---
src/mem3/src/mem3_cluster.erl | 9 +----
src/mem3/src/mem3_nodes.erl | 7 +---
src/mem3/src/mem3_reshard.erl | 9 +----
src/mem3/src/mem3_reshard_dbdoc.erl | 9 +----
src/mem3/src/mem3_seeds.erl | 8 +---
src/mem3/src/mem3_shards.erl | 7 +---
src/mem3/src/mem3_sync.erl | 7 +---
src/mem3/src/mem3_sync_event.erl | 7 +---
src/mem3/src/mem3_sync_nodes.erl | 8 +---
src/rexi/src/rexi_buffer.erl | 7 +---
src/smoosh/src/smoosh_channel.erl | 7 +---
src/smoosh/src/smoosh_server.erl | 9 +----
60 files changed, 73 insertions(+), 526 deletions(-)
diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index ff0469d..48e751a 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -23,7 +23,6 @@
terminate/2,
handle_db_updater_call/2,
handle_db_updater_info/2,
- format_status/2,
incref/1,
decref/1,
@@ -193,13 +192,6 @@ handle_db_updater_info({'DOWN', Ref, _, _, _}, #st{fd_monitor=Ref} = St) ->
{stop, normal, St#st{fd=undefined, fd_monitor=closed}}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
incref(St) ->
{ok, St#st{fd_monitor = erlang:monitor(process, St#st.fd)}}.
diff --git a/src/couch/src/couch_db_engine.erl b/src/couch/src/couch_db_engine.erl
index ae258ff..918dabc 100644
--- a/src/couch/src/couch_db_engine.erl
+++ b/src/couch/src/couch_db_engine.erl
@@ -172,14 +172,6 @@
{stop, Reason::any(), NewDbHandle::db_handle()}.
-% This is called in the context of couch_db_updater:format_status/2
-% This function is used to clean up its internal state to reduce
-% amount of data we log and to remove sensitive data
-% (see http://erlang.org/doc/man/gen_server.html#Module:format_status-2)
--callback format_status(Opt :: normal | terminate, State :: term()) ->
- Status :: term().
-
-
% These functions are called by any process opening or closing
% a database. As such they need to be able to handle being
% called concurrently. For example, the legacy engine uses these
@@ -707,7 +699,6 @@
terminate/2,
handle_db_updater_call/3,
handle_db_updater_info/2,
- format_status/2,
incref/1,
decref/1,
@@ -789,11 +780,6 @@ init(Engine, DbPath, Options) ->
end.
-format_status(Opt, [PDict, #db{} = Db]) ->
- #db{engine = {Engine, EngineState}} = Db,
- Engine:format_status(Opt, [PDict, EngineState]).
-
-
terminate(Reason, #db{} = Db) ->
#db{engine = {Engine, EngineState}} = Db,
Engine:terminate(Reason, EngineState).
diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 263fa4a..535acfa 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -16,7 +16,6 @@
-export([add_sizes/3, upgrade_sizes/1]).
-export([init/1,terminate/2,handle_call/3,handle_cast/2,code_change/3,handle_info/2]).
--export([format_status/2]).
-include_lib("couch/include/couch_db.hrl").
-include("couch_db_int.hrl").
@@ -244,11 +243,6 @@ handle_info(Msg, Db) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-format_status(Opt, Args) ->
- couch_db_engine:format_status(Opt, Args).
-
-
sort_and_tag_grouped_docs(Client, GroupedDocs) ->
% These groups should already be sorted but sometimes clients misbehave.
% The merge_updates function will fail and the database can end up with
diff --git a/src/couch/src/couch_drv.erl b/src/couch/src/couch_drv.erl
index 53a5350..f2ff2ac 100644
--- a/src/couch/src/couch_drv.erl
+++ b/src/couch/src/couch_drv.erl
@@ -14,7 +14,7 @@
-behaviour(gen_server).
-vsn(1).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3, format_status/2]).
+ code_change/3]).
-export([start_link/0]).
@@ -52,10 +52,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
% private API
util_driver_dir() ->
diff --git a/src/couch/src/couch_event_sup.erl b/src/couch/src/couch_event_sup.erl
index da59453..32f1b9b 100644
--- a/src/couch/src/couch_event_sup.erl
+++ b/src/couch/src/couch_event_sup.erl
@@ -21,8 +21,7 @@
-include_lib("couch/include/couch_db.hrl").
-export([start_link/3,start_link/4, stop/1]).
--export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2,code_change/3,
- format_status/2]).
+-export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2,code_change/3]).
%
% Instead calling the
@@ -73,8 +72,3 @@ handle_info({gen_event_EXIT, _Handler, Reason}, State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 10d1342..b1e3555 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -624,12 +624,9 @@ handle_info({'DOWN', Ref, process, _Pid, _Info}, #file{db_monitor=Ref}=File) ->
false -> {noreply, File}
end.
-
-format_status(normal, [PDict, #file{} = File]) ->
+format_status(_Opt, [PDict, #file{} = File]) ->
{_Fd, FilePath} = couch_util:get_value(couch_file_fd, PDict),
- [{data, [{"State", File}, {"InitialFilePath", FilePath}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+ [{data, [{"State", File}, {"InitialFilePath", FilePath}]}].
find_header(Fd, Block) ->
case (catch load_header(Fd, Block)) of
diff --git a/src/couch/src/couch_httpd_vhost.erl b/src/couch/src/couch_httpd_vhost.erl
index 742a4f7..574dba9 100644
--- a/src/couch/src/couch_httpd_vhost.erl
+++ b/src/couch/src/couch_httpd_vhost.erl
@@ -21,8 +21,7 @@
-export([urlsplit_netloc/2, redirect_to_vhost/2]).
-export([host/1, split_host_port/1]).
--export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3,
- format_status/2]).
+-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
% config_listener api
-export([handle_config_change/5, handle_config_terminate/3]).
@@ -380,10 +379,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
handle_config_change("vhosts", _, _, _, _) ->
{ok, ?MODULE:reload()};
diff --git a/src/couch/src/couch_multidb_changes.erl b/src/couch/src/couch_multidb_changes.erl
index 0cf86ba..e2bbda3 100644
--- a/src/couch/src/couch_multidb_changes.erl
+++ b/src/couch/src/couch_multidb_changes.erl
@@ -24,8 +24,7 @@
handle_call/3,
handle_info/2,
handle_cast/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -175,12 +174,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% Private functions
-spec register_with_event_server(pid()) -> reference().
diff --git a/src/couch/src/couch_native_process.erl b/src/couch/src/couch_native_process.erl
index 1f6fadc..eee8b28 100644
--- a/src/couch/src/couch_native_process.erl
+++ b/src/couch/src/couch_native_process.erl
@@ -42,7 +42,7 @@
-vsn(1).
-export([start_link/0,init/1,terminate/2,handle_call/3,handle_cast/2,code_change/3,
- handle_info/2,format_status/2]).
+ handle_info/2]).
-export([set_timeout/2, prompt/2]).
-define(STATE, native_proc_state).
@@ -125,11 +125,6 @@ handle_info({'EXIT',_,Reason}, State) ->
terminate(_Reason, _State) -> ok.
code_change(_OldVersion, State, _Extra) -> {ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
run(#evstate{list_pid=Pid}=State, [<<"list_row">>, Row]) when is_pid(Pid) ->
Pid ! {self(), list_row, Row},
receive
diff --git a/src/couch/src/couch_os_process.erl b/src/couch/src/couch_os_process.erl
index a217d6f..63a2414 100644
--- a/src/couch/src/couch_os_process.erl
+++ b/src/couch/src/couch_os_process.erl
@@ -17,8 +17,7 @@
-export([start_link/1, start_link/2, start_link/3, stop/1]).
-export([set_timeout/2, prompt/2, killer/1]).
-export([send/2, writeline/2, readline/1, writejson/2, readjson/1]).
--export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2, code_change/3,
- format_status/2]).
+-export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2, code_change/3]).
-include_lib("couch/include/couch_db.hrl").
@@ -257,11 +256,6 @@ code_change(_, {os_proc, Cmd, Port, W, R, Timeout} , _) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
killer(KillCmd) ->
receive _ ->
os:cmd(KillCmd)
diff --git a/src/couch/src/couch_proc_manager.erl b/src/couch/src/couch_proc_manager.erl
index 5691ab1..0daef3e 100644
--- a/src/couch/src/couch_proc_manager.erl
+++ b/src/couch/src/couch_proc_manager.erl
@@ -31,8 +31,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -270,14 +269,6 @@ handle_info(_Msg, State) ->
code_change(_OldVsn, #state{}=State, _Extra) ->
{ok, State}.
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
handle_config_terminate(_, stop, _) ->
ok;
handle_config_terminate(_Server, _Reason, _State) ->
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 1601bc9..feeebdf 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -18,7 +18,7 @@
-export([open/2,create/2,delete/2,get_version/0,get_version/1,get_git_sha/0,get_uuid/0]).
-export([all_databases/0, all_databases/2]).
-export([init/1, handle_call/3,sup_start_link/1]).
--export([handle_cast/2,code_change/3,handle_info/2,terminate/2,format_status/2]).
+-export([handle_cast/2,code_change/3,handle_info/2,terminate/2]).
-export([dev_start/0,is_admin/2,has_admins/0,get_stats/0]).
-export([close_db_if_idle/1]).
-export([delete_compaction_files/1]).
@@ -314,11 +314,6 @@ terminate(Reason, Srv) ->
end, nil, couch_dbs(Srv)),
ok.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
handle_config_change("couchdb", "database_dir", _, _, _) ->
exit(whereis(couch_server), config_change),
remove_handler;
diff --git a/src/couch/src/couch_stream.erl b/src/couch/src/couch_stream.erl
index 45d6e31..2ab46d7 100644
--- a/src/couch/src/couch_stream.erl
+++ b/src/couch/src/couch_stream.erl
@@ -36,8 +36,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -294,10 +293,6 @@ handle_info({'DOWN', Ref, _, _, _}, #stream{opener_monitor=Ref} = State) ->
handle_info(_Info, State) ->
{noreply, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
do_seek({Engine, EngineState}, Offset) ->
{ok, NewState} = Engine:seek(EngineState, Offset),
diff --git a/src/couch/src/couch_task_status.erl b/src/couch/src/couch_task_status.erl
index 367a97c..74247d6 100644
--- a/src/couch/src/couch_task_status.erl
+++ b/src/couch/src/couch_task_status.erl
@@ -29,7 +29,7 @@
-export([all/0, add_task/1, update/1, get/1, set_update_frequency/1]).
-export([is_task_added/0]).
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
-include_lib("couch/include/couch_db.hrl").
@@ -155,12 +155,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
timestamp() ->
timestamp(os:timestamp()).
diff --git a/src/couch/src/couch_uuids.erl b/src/couch/src/couch_uuids.erl
index b89e812..b9c03b5 100644
--- a/src/couch/src/couch_uuids.erl
+++ b/src/couch/src/couch_uuids.erl
@@ -19,7 +19,7 @@
-export([start/0, stop/0]).
-export([new/0, random/0]).
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
% config_listener api
@@ -80,11 +80,6 @@ handle_info(_Info, State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
handle_config_change("uuids", _, _, _, _) ->
{ok, gen_server:cast(?MODULE, change)};
handle_config_change(_, _, _, _, _) ->
diff --git a/src/couch/src/couch_work_queue.erl b/src/couch/src/couch_work_queue.erl
index 9851656..5d747de 100644
--- a/src/couch/src/couch_work_queue.erl
+++ b/src/couch/src/couch_work_queue.erl
@@ -21,7 +21,7 @@
% gen_server callbacks
-export([init/1, terminate/2]).
--export([handle_call/3, handle_cast/2, code_change/3, handle_info/2, format_status/2]).
+-export([handle_call/3, handle_cast/2, code_change/3, handle_info/2]).
-record(q, {
queue = queue:new(),
@@ -130,13 +130,6 @@ handle_call(size, _From, Q) ->
{reply, Q#q.size, Q}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
deliver_queue_items(Max, Q) ->
#q{
queue = Queue,
diff --git a/src/couch_epi/src/couch_epi_codechange_monitor.erl b/src/couch_epi/src/couch_epi_codechange_monitor.erl
index ef28913..7384804 100644
--- a/src/couch_epi/src/couch_epi_codechange_monitor.erl
+++ b/src/couch_epi/src/couch_epi_codechange_monitor.erl
@@ -25,7 +25,7 @@
%% ------------------------------------------------------------------
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3, format_status/2]).
+ terminate/2, code_change/3]).
%% ------------------------------------------------------------------
%% API Function Definitions
@@ -58,11 +58,6 @@ code_change(_OldVsn, Keeper, _Extra) ->
couch_epi_module_keeper:reload(Keeper),
{ok, Keeper}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% ------------------------------------------------------------------
%% Internal Function Definitions
%% ------------------------------------------------------------------
diff --git a/src/couch_epi/src/couch_epi_module_keeper.erl b/src/couch_epi/src/couch_epi_module_keeper.erl
index 960aea1..36376fe 100644
--- a/src/couch_epi/src/couch_epi_module_keeper.erl
+++ b/src/couch_epi/src/couch_epi_module_keeper.erl
@@ -28,7 +28,7 @@
%% ------------------------------------------------------------------
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3, format_status/2]).
+ terminate/2, code_change/3]).
-record(state, {
codegen, module, key, type, handle, hash, kind,
@@ -86,11 +86,6 @@ code_change(_OldVsn, State0, _Extra) ->
{_Res, State1} = reload_if_updated(State0),
{ok, State1}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% ------------------------------------------------------------------
%% Internal Function Definitions
%% ------------------------------------------------------------------
diff --git a/src/couch_event/src/couch_event_os_listener.erl b/src/couch_event/src/couch_event_os_listener.erl
index 3908477..4de0a44 100644
--- a/src/couch_event/src/couch_event_os_listener.erl
+++ b/src/couch_event/src/couch_event_os_listener.erl
@@ -25,8 +25,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -75,10 +74,3 @@ handle_info(Msg, Pid) ->
code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_event/src/couch_event_server.erl b/src/couch_event/src/couch_event_server.erl
index 6e58b64..321e8fa 100644
--- a/src/couch_event/src/couch_event_server.erl
+++ b/src/couch_event/src/couch_event_server.erl
@@ -25,8 +25,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -111,13 +110,6 @@ code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
notify_listeners(ByDbName, DbName, Event) ->
Msg = {'$couch_event', DbName, Event},
notify_listeners(khash:get(ByDbName, all_dbs), Msg),
diff --git a/src/couch_index/src/couch_index.erl b/src/couch_index/src/couch_index.erl
index 1c49196..cfe0d9e 100644
--- a/src/couch_index/src/couch_index.erl
+++ b/src/couch_index/src/couch_index.erl
@@ -23,7 +23,7 @@
-export([compact/1, compact/2, get_compactor_pid/1]).
%% gen_server callbacks
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -375,30 +375,6 @@ handle_info({'DOWN', _, _, _Pid, _}, #st{mod=Mod, idx_state=IdxState}=State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(Opt, [PDict, State]) ->
- #st{
- mod = Mod,
- idx_state = IdxState
- } = State,
- case erlang:function_exported(Mod, format_status, 2) of
- true ->
- case Mod:format_status(Opt, [PDict, IdxState]) of
- [{data, [{"State", ModState}]}] ->
- [{data, [{"State", State#st{idx_state = ModState}}]}];
- {ModState, #{module := _} = Opts} ->
- {State#st{idx_state = ModState}, Opts};
- ModState ->
- {State#st{idx_state = ModState}, #{
- module => Mod,
- dictionary => PDict
- }}
- end;
- false when Opt == normal ->
- [{data, [{"State", State}]}];
- false ->
- {State, #{module => ?MODULE}}
- end.
-
maybe_restart_updater(#st{waiters=[]}) ->
ok;
maybe_restart_updater(#st{idx_state=IdxState}=State) ->
diff --git a/src/couch_index/src/couch_index_compactor.erl b/src/couch_index/src/couch_index_compactor.erl
index 706d3ea..8849cf6 100644
--- a/src/couch_index/src/couch_index_compactor.erl
+++ b/src/couch_index/src/couch_index_compactor.erl
@@ -18,7 +18,7 @@
-export([start_link/2, run/2, cancel/1, is_running/1, get_compacting_pid/1]).
%% gen_server callbacks
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -105,13 +105,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
compact(Parent, Mod, IdxState) ->
DbName = Mod:get(db_name, IdxState),
%% We use with_db here to make sure we hold db open
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 8a5c378..6bebff2 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -18,7 +18,7 @@
-export([start_link/0, validate/2, get_index/4, get_index/3, get_index/2]).
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
% Exported for callbacks
@@ -204,13 +204,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
handle_config_change("couchdb", "index_dir", RootDir, _, RootDir) ->
{ok, RootDir};
handle_config_change("couchdb", "view_index_dir", RootDir, _, RootDir) ->
diff --git a/src/couch_index/src/couch_index_updater.erl b/src/couch_index/src/couch_index_updater.erl
index 52cf1d1..fb15db0 100644
--- a/src/couch_index/src/couch_index_updater.erl
+++ b/src/couch_index/src/couch_index_updater.erl
@@ -21,7 +21,7 @@
-export([update/3]).
%% gen_server callbacks
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
-include_lib("couch/include/couch_db.hrl").
@@ -126,13 +126,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
update(Idx, Mod, IdxState) ->
DbName = Mod:get(db_name, IdxState),
IndexName = Mod:get(idx_name, IdxState),
diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index 5485282..68f1d23 100644
--- a/src/couch_mrview/src/couch_mrview_index.erl
+++ b/src/couch_mrview/src/couch_mrview_index.erl
@@ -20,7 +20,6 @@
-export([index_file_exists/1]).
-export([update_local_purge_doc/2, verify_index_exists/2]).
-export([ensure_local_purge_docs/2]).
--export([format_status/2]).
-include_lib("couch/include/couch_db.hrl").
-include_lib("couch_mrview/include/couch_mrview.hrl").
@@ -316,10 +315,3 @@ update_local_purge_doc(Db, State, PSeq) ->
BaseDoc
end,
couch_db:update_doc(Db, Doc, []).
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
diff --git a/src/couch_mrview/src/couch_mrview_update_notifier.erl b/src/couch_mrview/src/couch_mrview_update_notifier.erl
index f23dd39..803d397 100644
--- a/src/couch_mrview/src/couch_mrview_update_notifier.erl
+++ b/src/couch_mrview/src/couch_mrview_update_notifier.erl
@@ -15,7 +15,7 @@
-behaviour(gen_event).
-export([start_link/1, notify/1]).
--export([init/1, terminate/2, handle_event/2, handle_call/2, handle_info/2, code_change/3, format_status/2, stop/1]).
+-export([init/1, terminate/2, handle_event/2, handle_call/2, handle_info/2, code_change/3, stop/1]).
-include_lib("couch/include/couch_db.hrl").
@@ -47,8 +47,3 @@ handle_info({'EXIT', Pid, Reason}, Pid) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-format_status(normal, [_PDict, State]) ->
- State;
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_peruser/src/couch_peruser.erl b/src/couch_peruser/src/couch_peruser.erl
index 8e7da45..886fb4f 100644
--- a/src/couch_peruser/src/couch_peruser.erl
+++ b/src/couch_peruser/src/couch_peruser.erl
@@ -19,7 +19,7 @@
% gen_server callbacks
-export([start_link/0, init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3, format_status/2]).
+ terminate/2, code_change/3]).
-export([init_changes_handler/1, changes_handler/3]).
@@ -410,11 +410,3 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
diff --git a/src/couch_replicator/src/couch_replicator_auth_session.erl b/src/couch_replicator/src/couch_replicator_auth_session.erl
index 072550a..30f499a 100644
--- a/src/couch_replicator/src/couch_replicator_auth_session.erl
+++ b/src/couch_replicator/src/couch_replicator_auth_session.erl
@@ -183,16 +183,13 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {[
+format_status(_Opt, [_PDict, State]) ->
+ [
{epoch, State#state.epoch},
{user, State#state.user},
- {session_url, couch_util:url_strip_password(State#state.session_url)},
+ {session_url, State#state.session_url},
{refresh_tstamp, State#state.refresh_tstamp}
- ], #{module => ?MODULE, dictionary => PDict}}.
+ ].
%% Private helper functions
diff --git a/src/couch_replicator/src/couch_replicator_clustering.erl b/src/couch_replicator/src/couch_replicator_clustering.erl
index 616ab39..18de1e8 100644
--- a/src/couch_replicator/src/couch_replicator_clustering.erl
+++ b/src/couch_replicator/src/couch_replicator_clustering.erl
@@ -40,8 +40,7 @@
handle_call/3,
handle_info/2,
handle_cast/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -171,12 +170,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% Internal functions
diff --git a/src/couch_replicator/src/couch_replicator_db_changes.erl b/src/couch_replicator/src/couch_replicator_db_changes.erl
index 0105a03..92b0222 100644
--- a/src/couch_replicator/src/couch_replicator_db_changes.erl
+++ b/src/couch_replicator/src/couch_replicator_db_changes.erl
@@ -24,8 +24,7 @@
handle_call/3,
handle_info/2,
handle_cast/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -84,13 +83,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
-spec restart_mdb_changes(#state{}) -> #state{}.
restart_mdb_changes(#state{mdb_changes = nil} = State) ->
Suffix = <<"_replicator">>,
diff --git a/src/couch_replicator/src/couch_replicator_doc_processor.erl b/src/couch_replicator/src/couch_replicator_doc_processor.erl
index 8437933..6778d53 100644
--- a/src/couch_replicator/src/couch_replicator_doc_processor.erl
+++ b/src/couch_replicator/src/couch_replicator_doc_processor.erl
@@ -25,8 +25,7 @@
handle_call/3,
handle_info/2,
handle_cast/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -258,12 +257,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% Doc processor gen_server private helper functions
% Handle doc update -- add to ets, then start a worker to try to turn it into
diff --git a/src/couch_replicator/src/couch_replicator_httpc_pool.erl b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
index d93136f..90234a6 100644
--- a/src/couch_replicator/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
@@ -20,7 +20,7 @@
% gen_server API
-export([init/1, handle_call/3, handle_info/2, handle_cast/2]).
--export([code_change/3, terminate/2, format_status/2]).
+-export([code_change/3, terminate/2]).
-include_lib("couch/include/couch_db.hrl").
@@ -145,28 +145,6 @@ code_change(_OldVsn, #state{}=State, _Extra) ->
terminate(_Reason, _State) ->
ok.
-
-format_status(normal, [_PDict, #state{} = State]) ->
- #state{
- url = Url,
- proxy_url = ProxyUrl
- } = State,
- [{data, [{"State", State#state{
- url = couch_util:url_strip_password(Url),
- proxy_url = couch_util:url_strip_password(ProxyUrl)
- }}]}];
-
-format_status(terminate, [PDict, #state{} = State]) ->
- #state{
- url = Url,
- proxy_url = ProxyUrl
- } = State,
- {State#state{
- url = couch_util:url_strip_password(Url),
- proxy_url = couch_util:url_strip_password(ProxyUrl)
- }, #{module => ?MODULE, dictionary => PDict}}.
-
-
monitor_client(Callers, Worker, {ClientPid, _}) ->
[{Worker, erlang:monitor(process, ClientPid)} | Callers].
@@ -204,25 +182,3 @@ release_worker_internal(Worker, State) ->
false ->
State#state{callers = NewCallers0}
end.
-
-
--ifdef(TEST).
-
--include_lib("couch/include/couch_eunit.hrl").
-
-format_status_test_() ->
- ?_test(begin
- State = #state{
- url = "https://username1:password1@$ACCOUNT2.cloudant.com/db",
- proxy_url = "https://username2:password2@proxy.thing.com:8080/"
- },
- [{data, [{"State", ScrubbedN}]}] = format_status(normal, [[], State]),
- ?assertEqual("https://username1:*****@$ACCOUNT2.cloudant.com/db", ScrubbedN#state.url),
- ?assertEqual("https://username2:*****@proxy.thing.com:8080/", ScrubbedN#state.proxy_url),
- {ScrubbedT, _} = format_status(terminate, [[], State]),
- ?assertEqual("https://username1:*****@$ACCOUNT2.cloudant.com/db", ScrubbedT#state.url),
- ?assertEqual("https://username2:*****@proxy.thing.com:8080/", ScrubbedT#state.proxy_url),
- ok
- end).
-
--endif.
\ No newline at end of file
diff --git a/src/couch_replicator/src/couch_replicator_notifier.erl b/src/couch_replicator/src/couch_replicator_notifier.erl
index f098212..f7640a3 100644
--- a/src/couch_replicator/src/couch_replicator_notifier.erl
+++ b/src/couch_replicator/src/couch_replicator_notifier.erl
@@ -19,7 +19,7 @@
-export([start_link/1, stop/1, notify/1]).
% gen_event callbacks
--export([init/1, terminate/2, code_change/3, format_status/2]).
+-export([init/1, terminate/2, code_change/3]).
-export([handle_event/2, handle_call/2, handle_info/2]).
-include_lib("couch/include/couch_db.hrl").
@@ -56,9 +56,3 @@ handle_info(_Msg, State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/couch_replicator/src/couch_replicator_rate_limiter.erl b/src/couch_replicator/src/couch_replicator_rate_limiter.erl
index 0cee6f9..b7b7094 100644
--- a/src/couch_replicator/src/couch_replicator_rate_limiter.erl
+++ b/src/couch_replicator/src/couch_replicator_rate_limiter.erl
@@ -51,8 +51,7 @@
handle_call/3,
handle_info/2,
handle_cast/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -162,12 +161,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% Private functions
-spec update_success(any(), interval(), msec(), msec()) -> interval().
diff --git a/src/couch_replicator/src/couch_replicator_scheduler.erl b/src/couch_replicator/src/couch_replicator_scheduler.erl
index 7812dad..641443a 100644
--- a/src/couch_replicator/src/couch_replicator_scheduler.erl
+++ b/src/couch_replicator/src/couch_replicator_scheduler.erl
@@ -343,15 +343,12 @@ terminate(_Reason, _State) ->
ok.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {[
- {max_jobs, State#state.max_jobs},
- {running_jobs, running_job_count()},
- {pending_jobs, pending_job_count()}
- ], #{module => ?MODULE, dictionary => PDict}}.
+format_status(_Opt, [_PDict, State]) ->
+ [
+ {max_jobs, State#state.max_jobs},
+ {running_jobs, running_job_count()},
+ {pending_jobs, pending_job_count()}
+ ].
%% config listener functions
diff --git a/src/couch_replicator/src/couch_replicator_scheduler_job.erl b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
index be72aae..0b33419 100644
--- a/src/couch_replicator/src/couch_replicator_scheduler_job.erl
+++ b/src/couch_replicator/src/couch_replicator_scheduler_job.erl
@@ -411,10 +411,8 @@ terminate_cleanup(State) ->
code_change(_OldVsn, #rep_state{}=State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", state_strip_creds(State)}]}];
-format_status(terminate, [PDict, State]) ->
+format_status(_Opt, [_PDict, State]) ->
#rep_state{
source = Source,
target = Target,
@@ -432,7 +430,7 @@ format_status(terminate, [PDict, State]) ->
doc_id = DocId,
db_name = DbName
} = RepDetails,
- {[
+ [
{rep_id, RepId},
{source, couch_replicator_api_wrap:db_uri(Source)},
{target, couch_replicator_api_wrap:db_uri(Target)},
@@ -445,7 +443,7 @@ format_status(terminate, [PDict, State]) ->
{committed_seq, CommitedSeq},
{current_through_seq, ThroughSeq},
{highest_seq_done, HighestSeqDone}
- ], #{module => ?MODULE, dictionary => PDict}}.
+ ].
startup_jitter() ->
@@ -1074,7 +1072,7 @@ scheduler_job_format_status_test() ->
current_through_seq = <<"4">>,
highest_seq_done = <<"5">>
},
- {Format, _} = format_status(terminate, [pdict, State]),
+ Format = format_status(opts_ignored, [pdict, State]),
?assertEqual("http://u:*****@h1/d1/", proplists:get_value(source, Format)),
?assertEqual("http://u:*****@h2/d2/", proplists:get_value(target, Format)),
?assertEqual({"base", "+ext"}, proplists:get_value(rep_id, Format)),
@@ -1086,20 +1084,7 @@ scheduler_job_format_status_test() ->
?assertEqual(<<"2">>, proplists:get_value(source_seq, Format)),
?assertEqual(<<"3">>, proplists:get_value(committed_seq, Format)),
?assertEqual(<<"4">>, proplists:get_value(current_through_seq, Format)),
- ?assertEqual(<<"5">>, proplists:get_value(highest_seq_done, Format)),
- [{data, [{"State", #rep_state{
- rep_details = #rep{
- source = #httpdb{url = RSource},
- target = #httpdb{url = RTarget}
- },
- source = #httpdb{url = FSource},
- target = #httpdb{url = FTarget}
- }}]}] = format_status(normal, [pdict, State]),
- ?assertEqual("http://u:*****@h1/d1/", FSource),
- ?assertEqual("http://u:*****@h2/d2/", FTarget),
- ?assertEqual("http://u:*****@h1/d1/", RSource),
- ?assertEqual("http://u:*****@h2/d2/", RTarget),
- ok.
+ ?assertEqual(<<"5">>, proplists:get_value(highest_seq_done, Format)).
-endif.
diff --git a/src/couch_replicator/src/couch_replicator_worker.erl b/src/couch_replicator/src/couch_replicator_worker.erl
index 184240b..eb8beaa 100644
--- a/src/couch_replicator/src/couch_replicator_worker.erl
+++ b/src/couch_replicator/src/couch_replicator_worker.erl
@@ -185,17 +185,7 @@ handle_info({'EXIT', Pid, Reason}, State) ->
terminate(_Reason, _State) ->
ok.
-format_status(normal, [_PDict, State]) ->
- #state{
- source = Source,
- target = Target
- } = State,
- [{data, [{"State", State#state{
- source = couch_replicator_api_wrap:db_uri(Source),
- target = couch_replicator_api_wrap:db_uri(Target)
- }}]}];
-
-format_status(terminate, [PDict, State]) ->
+format_status(_Opt, [_PDict, State]) ->
#state{
cp = MainJobPid,
loop = LoopPid,
@@ -205,7 +195,7 @@ format_status(terminate, [PDict, State]) ->
pending_fetch = PendingFetch,
batch = #batch{size = BatchSize}
} = State,
- {[
+ [
{main_pid, MainJobPid},
{loop, LoopPid},
{source, couch_replicator_api_wrap:db_uri(Source)},
@@ -213,7 +203,7 @@ format_status(terminate, [PDict, State]) ->
{num_readers, length(Readers)},
{pending_fetch, PendingFetch},
{batch_size, BatchSize}
- ], #{module => ?MODULE, dictionary => PDict}}.
+ ].
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
@@ -488,20 +478,13 @@ replication_worker_format_status_test() ->
pending_fetch = nil,
batch = #batch{size = 5}
},
- {Format, _} = format_status(terminate, [pdict, State]),
+ Format = format_status(opts_ignored, [pdict, State]),
?assertEqual(self(), proplists:get_value(main_pid, Format)),
?assertEqual(self(), proplists:get_value(loop, Format)),
?assertEqual("http://u:*****@h/d1", proplists:get_value(source, Format)),
?assertEqual("http://u:*****@h/d2", proplists:get_value(target, Format)),
?assertEqual(3, proplists:get_value(num_readers, Format)),
?assertEqual(nil, proplists:get_value(pending_fetch, Format)),
- ?assertEqual(5, proplists:get_value(batch_size, Format)),
- [{data, [{"State", #state{
- source = Source,
- target = Target
- }}]}] = format_status(normal, [pdict, State]),
- ?assertEqual("http://u:*****@h/d1", Source),
- ?assertEqual("http://u:*****@h/d2", Target),
- ok.
+ ?assertEqual(5, proplists:get_value(batch_size, Format)).
-endif.
diff --git a/src/couch_stats/src/couch_stats_aggregator.erl b/src/couch_stats/src/couch_stats_aggregator.erl
index 4ec3f2e..0416636 100644
--- a/src/couch_stats/src/couch_stats_aggregator.erl
+++ b/src/couch_stats/src/couch_stats_aggregator.erl
@@ -27,8 +27,7 @@
handle_cast/2,
handle_info/2,
code_change/3,
- terminate/2,
- format_status/2
+ terminate/2
]).
@@ -89,11 +88,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
comparison_set(Metrics) ->
sets:from_list(
[{Name, proplists:get_value(type, Props)} || {Name, Props} <- Metrics]
diff --git a/src/couch_stats/src/couch_stats_process_tracker.erl b/src/couch_stats/src/couch_stats_process_tracker.erl
index 1334337..fef955e 100644
--- a/src/couch_stats/src/couch_stats_process_tracker.erl
+++ b/src/couch_stats/src/couch_stats_process_tracker.erl
@@ -25,8 +25,7 @@
handle_cast/2,
handle_info/2,
code_change/3,
- terminate/2,
- format_status/2
+ terminate/2
]).
-record(st, {
@@ -81,9 +80,3 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
\ No newline at end of file
diff --git a/src/ddoc_cache/src/ddoc_cache_entry.erl b/src/ddoc_cache/src/ddoc_cache_entry.erl
index 01faaa3..4cc3d7e 100644
--- a/src/ddoc_cache/src/ddoc_cache_entry.erl
+++ b/src/ddoc_cache/src/ddoc_cache_entry.erl
@@ -34,8 +34,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -283,12 +282,6 @@ code_change(_, St, _) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
spawn_opener(Key) ->
{Pid, _} = erlang:spawn_monitor(?MODULE, do_open, [Key]),
Pid.
diff --git a/src/ddoc_cache/src/ddoc_cache_lru.erl b/src/ddoc_cache/src/ddoc_cache_lru.erl
index 92ff544..28a8a64 100644
--- a/src/ddoc_cache/src/ddoc_cache_lru.erl
+++ b/src/ddoc_cache/src/ddoc_cache_lru.erl
@@ -28,8 +28,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -228,13 +227,6 @@ code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
-
handle_db_event(ShardDbName, created, St) ->
gen_server:cast(?MODULE, {evict, mem3:dbname(ShardDbName)}),
{ok, St};
diff --git a/src/ddoc_cache/src/ddoc_cache_opener.erl b/src/ddoc_cache/src/ddoc_cache_opener.erl
index a9d43b1..52de542 100644
--- a/src/ddoc_cache/src/ddoc_cache_opener.erl
+++ b/src/ddoc_cache/src/ddoc_cache_opener.erl
@@ -25,8 +25,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -65,10 +64,3 @@ handle_info(Msg, St) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [_PDict, State]) ->
- {State, #{module => ?MODULE}}.
\ No newline at end of file
diff --git a/src/dreyfus/src/dreyfus_index.erl b/src/dreyfus/src/dreyfus_index.erl
index 1da034e..2bf560f 100644
--- a/src/dreyfus/src/dreyfus_index.erl
+++ b/src/dreyfus/src/dreyfus_index.erl
@@ -29,7 +29,7 @@
% gen_server api.
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3,format_status/2]).
+ code_change/3]).
% private definitions.
-record(state, {
@@ -244,11 +244,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% private functions.
open_index(DbName, #index{analyzer=Analyzer, sig=Sig}) ->
diff --git a/src/dreyfus/src/dreyfus_index_manager.erl b/src/dreyfus/src/dreyfus_index_manager.erl
index 8c7ec32..47f2542 100644
--- a/src/dreyfus/src/dreyfus_index_manager.erl
+++ b/src/dreyfus/src/dreyfus_index_manager.erl
@@ -27,7 +27,7 @@
% gen_server api.
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3, format_status/2]).
+ code_change/3]).
-export([handle_db_event/3]).
@@ -113,13 +113,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, nil, _Extra) ->
{ok, nil}.
-
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% private functions
handle_db_event(DbName, created, _St) ->
diff --git a/src/global_changes/src/global_changes_server.erl b/src/global_changes/src/global_changes_server.erl
index 69c55ef..7e30625 100644
--- a/src/global_changes/src/global_changes_server.erl
+++ b/src/global_changes/src/global_changes_server.erl
@@ -25,8 +25,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
-export([
@@ -145,12 +144,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
flush_updates(State) ->
DocIds = sets:to_list(State#state.pending_updates),
diff --git a/src/ioq/src/ioq.erl b/src/ioq/src/ioq.erl
index a4fa811..99b3ce3 100644
--- a/src/ioq/src/ioq.erl
+++ b/src/ioq/src/ioq.erl
@@ -15,8 +15,7 @@
-behaviour(config_listener).
-export([start_link/0, call/3]).
--export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2,
- format_status/2]).
+-export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2]).
% config_listener api
-export([handle_config_change/5, handle_config_terminate/3]).
@@ -139,11 +138,6 @@ code_change(_Vsn, State, _Extra) ->
terminate(_Reason, _State) ->
ok.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
enqueue_request(#request{priority=compaction}=Request, #state{}=State) ->
State#state{background=queue:in(Request, State#state.background)};
enqueue_request(#request{priority=shard_sync}=Request, #state{}=State) ->
diff --git a/src/jwtf/src/jwtf_keystore.erl b/src/jwtf/src/jwtf_keystore.erl
index aba6842..be261e6 100644
--- a/src/jwtf/src/jwtf_keystore.erl
+++ b/src/jwtf/src/jwtf_keystore.erl
@@ -24,7 +24,7 @@
% gen_server api.
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- code_change/3, terminate/2, format_status/2]).
+ code_change/3, terminate/2]).
% config_listener api
-export([handle_config_change/5, handle_config_terminate/3]).
@@ -87,12 +87,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% config listener callback
handle_config_change("jwt_keys", ConfigKey, _ConfigValue, _, _) ->
diff --git a/src/ken/src/ken_server.erl b/src/ken/src/ken_server.erl
index ebf026e..b33d01f 100644
--- a/src/ken/src/ken_server.erl
+++ b/src/ken/src/ken_server.erl
@@ -16,7 +16,7 @@
-behaviour(gen_server).
-vsn(1).
-export([init/1, terminate/2]).
--export([handle_call/3, handle_cast/2, handle_info/2, code_change/3, format_status/2]).
+-export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]).
% Public interface
-export([start_link/0]).
@@ -122,12 +122,6 @@ init(_) ->
terminate(_Reason, _State) ->
ok.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
handle_call({set_batch_size, BS}, _From, #state{batch_size = Old} = State) ->
{reply, Old, State#state{batch_size = BS}, 0};
diff --git a/src/mem3/src/mem3_cluster.erl b/src/mem3/src/mem3_cluster.erl
index 996b480..7e3d477 100644
--- a/src/mem3/src/mem3_cluster.erl
+++ b/src/mem3/src/mem3_cluster.erl
@@ -41,8 +41,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -120,12 +119,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% Internal functions
-spec cluster_changed(#state{}) -> #state{}.
diff --git a/src/mem3/src/mem3_nodes.erl b/src/mem3/src/mem3_nodes.erl
index 8c0c81e..dd5be1a 100644
--- a/src/mem3/src/mem3_nodes.erl
+++ b/src/mem3/src/mem3_nodes.erl
@@ -14,7 +14,7 @@
-behaviour(gen_server).
-vsn(1).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3, format_status/2]).
+ code_change/3]).
-export([start_link/0, get_nodelist/0, get_node_info/2]).
@@ -87,11 +87,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, #state{}=State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% internal functions
initialize_nodelist() ->
diff --git a/src/mem3/src/mem3_reshard.erl b/src/mem3/src/mem3_reshard.erl
index 65e3533..620b1bc 100644
--- a/src/mem3/src/mem3_reshard.erl
+++ b/src/mem3/src/mem3_reshard.erl
@@ -47,8 +47,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -397,12 +396,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% Private API
validate_and_start_job(#shard{} = Source, Split) ->
diff --git a/src/mem3/src/mem3_reshard_dbdoc.erl b/src/mem3/src/mem3_reshard_dbdoc.erl
index 483b8fc..4a0a35c 100644
--- a/src/mem3/src/mem3_reshard_dbdoc.erl
+++ b/src/mem3/src/mem3_reshard_dbdoc.erl
@@ -24,8 +24,7 @@
handle_call/3,
handle_cast/2,
handle_info/2,
- code_change/3,
- format_status/2
+ code_change/3
]).
@@ -102,12 +101,6 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% Private
update_shard_map(Source, Target) ->
diff --git a/src/mem3/src/mem3_seeds.erl b/src/mem3/src/mem3_seeds.erl
index 2c3c185..f1aceb9 100644
--- a/src/mem3/src/mem3_seeds.erl
+++ b/src/mem3/src/mem3_seeds.erl
@@ -19,8 +19,7 @@
handle_cast/2,
handle_info/2,
code_change/3,
- terminate/2,
- format_status/2
+ terminate/2
]).
-export([
@@ -91,11 +90,6 @@ terminate(_Reason, _St) ->
code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% internal functions
start_replication([]) ->
diff --git a/src/mem3/src/mem3_shards.erl b/src/mem3/src/mem3_shards.erl
index 7d830d9..4f33237 100644
--- a/src/mem3/src/mem3_shards.erl
+++ b/src/mem3/src/mem3_shards.erl
@@ -16,7 +16,7 @@
-behaviour(config_listener).
-export([init/1, terminate/2, code_change/3]).
--export([handle_call/3, handle_cast/2, handle_info/2, format_status/2]).
+-export([handle_call/3, handle_cast/2, handle_info/2]).
-export([handle_config_change/5, handle_config_terminate/3]).
-export([start_link/0]).
@@ -286,11 +286,6 @@ terminate(_Reason, #st{changes_pid=Pid}) ->
code_change(_OldVsn, #st{}=St, _Extra) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
%% internal functions
start_changes_listener(SinceSeq) ->
diff --git a/src/mem3/src/mem3_sync.erl b/src/mem3/src/mem3_sync.erl
index 98d06e8..cfed6a4 100644
--- a/src/mem3/src/mem3_sync.erl
+++ b/src/mem3/src/mem3_sync.erl
@@ -14,7 +14,7 @@
-behaviour(gen_server).
-vsn(1).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3, format_status/2]).
+ code_change/3]).
-export([start_link/0, get_active/0, get_queue/0, push/1, push/2,
remove_node/1, remove_shard/1, initial_sync/1, get_backlog/0, nodes_db/0,
@@ -166,11 +166,6 @@ code_change(_, #state{waiting = WaitingList} = State, _) when is_list(WaitingLis
code_change(_, State, _) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
maybe_resubmit(State, #job{name=DbName, node=Node} = Job) ->
case lists:member(DbName, local_dbs()) of
true ->
diff --git a/src/mem3/src/mem3_sync_event.erl b/src/mem3/src/mem3_sync_event.erl
index b0921df..7bca230 100644
--- a/src/mem3/src/mem3_sync_event.erl
+++ b/src/mem3/src/mem3_sync_event.erl
@@ -15,7 +15,7 @@
-vsn(1).
-export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2,
- code_change/3, format_status/2]).
+ code_change/3]).
init(_) ->
net_kernel:monitor_nodes(true),
@@ -55,11 +55,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
drain_nodeups(Acc) ->
receive
{nodeup, Node} ->
diff --git a/src/mem3/src/mem3_sync_nodes.erl b/src/mem3/src/mem3_sync_nodes.erl
index 8f8d293..0a4bffc 100644
--- a/src/mem3/src/mem3_sync_nodes.erl
+++ b/src/mem3/src/mem3_sync_nodes.erl
@@ -19,7 +19,7 @@
-export([add/1]).
-export([init/1, terminate/2, code_change/3]).
--export([handle_call/3, handle_cast/2, handle_info/2, format_status/2]).
+-export([handle_call/3, handle_cast/2, handle_info/2]).
-export([monitor_sync/1]).
@@ -98,12 +98,6 @@ code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
start_sync(Nodes) ->
{Pid, _} = spawn_monitor(?MODULE, monitor_sync, [Nodes]),
Pid.
diff --git a/src/rexi/src/rexi_buffer.erl b/src/rexi/src/rexi_buffer.erl
index cf55c00..d16dc8b 100644
--- a/src/rexi/src/rexi_buffer.erl
+++ b/src/rexi/src/rexi_buffer.erl
@@ -16,7 +16,7 @@
% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3, format_status/2]).
+ terminate/2, code_change/3]).
-export ([
send/2,
@@ -95,11 +95,6 @@ code_change(_OldVsn, {state, Buffer, Sender, Count}, _Extra) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
should_drop(#state{count = Count, max_count = Max}) ->
Count >= Max.
diff --git a/src/smoosh/src/smoosh_channel.erl b/src/smoosh/src/smoosh_channel.erl
index d6a0a3f..2bc98be 100644
--- a/src/smoosh/src/smoosh_channel.erl
+++ b/src/smoosh/src/smoosh_channel.erl
@@ -21,7 +21,7 @@
% gen_server api.
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- code_change/3, terminate/2, format_status/2]).
+ code_change/3, terminate/2]).
% records.
@@ -190,11 +190,6 @@ terminate(_Reason, _State) ->
code_change(_OldVsn, #state{}=State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% private functions.
add_to_queue(Key, Priority, State) ->
diff --git a/src/smoosh/src/smoosh_server.erl b/src/smoosh/src/smoosh_server.erl
index dcea72b..6269608 100644
--- a/src/smoosh/src/smoosh_server.erl
+++ b/src/smoosh/src/smoosh_server.erl
@@ -25,8 +25,7 @@
sync_enqueue/1,
sync_enqueue/2,
handle_db_event/3,
- status/0,
- format_status/2
+ status/0
]).
-define(SECONDS_PER_MINUTE, 60).
@@ -223,12 +222,6 @@ code_change(_OldVsn, {state, DbChannels, ViewChannels, Tab,
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
-format_status(normal, [_PDict, State]) ->
- [{data, [{"State", State}]}];
-
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
-
% private functions.
get_channel_status(#channel{name=Name, pid=P}, Acc0) when is_pid(P) ->
[couchdb] 04/07: Revert "fixup: Fix format_status dispattch in
couch_db_engine"
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 4b08f74af8a195728e9f848b7fb53a827584ba05
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:24 2021 -0700
Revert "fixup: Fix format_status dispattch in couch_db_engine"
This reverts commit 453f32ff521bd8c8181cecea5bd3f2c22be4518d.
---
src/couch/src/couch_db_engine.erl | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/couch/src/couch_db_engine.erl b/src/couch/src/couch_db_engine.erl
index b45fe0a..ae258ff 100644
--- a/src/couch/src/couch_db_engine.erl
+++ b/src/couch/src/couch_db_engine.erl
@@ -790,13 +790,8 @@ init(Engine, DbPath, Options) ->
format_status(Opt, [PDict, #db{} = Db]) ->
- #db{engine = {Engine, EngineState0}} = Db,
- case Engine:format_status(Opt, [PDict, EngineState0]) of
- [{data, [{"State", EngineState1}]}] ->
- [{data, [{"State", Db#db{engine = {Engine, EngineState1}}}]}];
- {EngineState1, Ctx} ->
- {Db#db{engine = {Engine, EngineState1}}, Ctx#{module => ?MODULE}}
- end.
+ #db{engine = {Engine, EngineState}} = Db,
+ Engine:format_status(Opt, [PDict, EngineState]).
terminate(Reason, #db{} = Db) ->
[couchdb] 02/07: Revert "fixup: Add support for pluguable sanitizer
module..."
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit cbe90e37feceac6bdf5a83ca5e783ca1028d9a74
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:20 2021 -0700
Revert "fixup: Add support for pluguable sanitizer module..."
This reverts commit 5ae5d70a15fbe1056ad6bbdb3681598efe18da82.
---
src/couch_log/src/couch_log_config.erl | 2 +-
src/couch_log/src/couch_log_formatter.erl | 2 +-
src/couch_log/test/eunit/couch_log_config_test.erl | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/couch_log/src/couch_log_config.erl b/src/couch_log/src/couch_log_config.erl
index 3dfbcb5..1d7452d 100644
--- a/src/couch_log/src/couch_log_config.erl
+++ b/src/couch_log/src/couch_log_config.erl
@@ -108,4 +108,4 @@ transform(strip_last_msg, _) ->
true;
transform(sanitizer_module, ModuleStr) ->
- list_to_atom(ModuleStr).
+ list_to_atom(ModuleStr).
\ No newline at end of file
diff --git a/src/couch_log/src/couch_log_formatter.erl b/src/couch_log/src/couch_log_formatter.erl
index 51e85c3..c90f0d0 100644
--- a/src/couch_log/src/couch_log_formatter.erl
+++ b/src/couch_log/src/couch_log_formatter.erl
@@ -573,4 +573,4 @@ maybe_sanitize_reason(Term, #{sanitizer := undefined}) ->
maybe_sanitize_reason(Term, #{sanitizer := Module} = Opts) ->
Module:sanitize_reason(Term, Opts);
maybe_sanitize_reason(Term, _) ->
- Term.
+ Term.
\ No newline at end of file
diff --git a/src/couch_log/test/eunit/couch_log_config_test.erl b/src/couch_log/test/eunit/couch_log_config_test.erl
index bc1faad..b2746ac 100644
--- a/src/couch_log/test/eunit/couch_log_config_test.erl
+++ b/src/couch_log/test/eunit/couch_log_config_test.erl
@@ -157,4 +157,4 @@ check_sanitizer_module() ->
config:delete("log", "sanitizer_module"),
couch_log_test_util:wait_for_config(),
?assertEqual(undefined, couch_log_config:get(sanitizer_module))
- end).
+ end).
\ No newline at end of file
[couchdb] 06/07: Revert "Add support for pluguable sanitizer module
for logger"
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 5e54ec714d9be6c84e3372e09a6f31ab80d46da0
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:27 2021 -0700
Revert "Add support for pluguable sanitizer module for logger"
This reverts commit eb9cfc8ee88d56e68e1d9c7b97e00403cddc4644.
---
src/couch_log/src/couch_log_config.erl | 8 +-
src/couch_log/src/couch_log_config_dyn.erl | 3 +-
src/couch_log/src/couch_log_formatter.erl | 262 ++++++---------------
src/couch_log/src/couch_log_sup.erl | 2 -
src/couch_log/test/eunit/couch_log_config_test.erl | 17 +-
.../test/eunit/couch_log_formatter_test.erl | 135 -----------
6 files changed, 77 insertions(+), 350 deletions(-)
diff --git a/src/couch_log/src/couch_log_config.erl b/src/couch_log/src/couch_log_config.erl
index 1d7452d..a7a469c 100644
--- a/src/couch_log/src/couch_log_config.erl
+++ b/src/couch_log/src/couch_log_config.erl
@@ -50,8 +50,7 @@ entries() ->
{level, "level", "info"},
{level_int, "level", "info"},
{max_message_size, "max_message_size", "16000"},
- {strip_last_msg, "strip_last_msg", "true"},
- {sanitizer_module, "sanitizer_module", "undefined"}
+ {strip_last_msg, "strip_last_msg", "true"}
].
@@ -105,7 +104,4 @@ transform(strip_last_msg, "false") ->
false;
transform(strip_last_msg, _) ->
- true;
-
-transform(sanitizer_module, ModuleStr) ->
- list_to_atom(ModuleStr).
\ No newline at end of file
+ true.
\ No newline at end of file
diff --git a/src/couch_log/src/couch_log_config_dyn.erl b/src/couch_log/src/couch_log_config_dyn.erl
index 731ab84..b39dcf2 100644
--- a/src/couch_log/src/couch_log_config_dyn.erl
+++ b/src/couch_log/src/couch_log_config_dyn.erl
@@ -26,5 +26,4 @@
get(level) -> info;
get(level_int) -> 2;
get(max_message_size) -> 16000;
-get(strip_last_msg) -> true;
-get(sanitizer_module) -> undefined.
+get(strip_last_msg) -> true.
diff --git a/src/couch_log/src/couch_log_formatter.erl b/src/couch_log/src/couch_log_formatter.erl
index c90f0d0..26997a8 100644
--- a/src/couch_log/src/couch_log_formatter.erl
+++ b/src/couch_log/src/couch_log_formatter.erl
@@ -68,51 +68,44 @@ format(Event) ->
do_format({error, _GL, {Pid, "** Generic server " ++ _, Args}}) ->
%% gen_server terminate
- [Name, LastMsg0, State0, Reason | Extra] = Args,
+ [Name, LastMsg0, State, Reason | Extra] = Args,
LastMsg = case couch_log_config:get(strip_last_msg) of
true ->
redacted;
false ->
LastMsg0
end,
- Opts = ctx_opts(gen_server, State0),
- State = format_state(State0, Opts),
MsgFmt = "gen_server ~w terminated with reason: ~s~n" ++
" last msg: ~p~n state: ~p~n extra: ~p",
- MsgArgs = [Name, format_reason(Reason, Opts), LastMsg, State, Extra],
+ MsgArgs = [Name, format_reason(Reason), LastMsg, State, Extra],
format(error, Pid, MsgFmt, MsgArgs);
do_format({error, _GL, {Pid, "** State machine " ++ _, Args}}) ->
%% gen_fsm terminate
- [Name, LastMsg0, StateName, State0, Reason | Extra] = Args,
+ [Name, LastMsg0, StateName, State, Reason | Extra] = Args,
LastMsg = case couch_log_config:get(strip_last_msg) of
true ->
redacted;
false ->
LastMsg0
end,
- Opts = ctx_opts(gen_fsm, State0),
- State = format_state(State0, Opts),
MsgFmt = "gen_fsm ~w in state ~w terminated with reason: ~s~n" ++
" last msg: ~p~n state: ~p~n extra: ~p",
- MsgArgs = [Name, StateName, format_reason(Reason, Opts),
- LastMsg, State, Extra],
+ MsgArgs = [Name, StateName, format_reason(Reason), LastMsg, State, Extra],
format(error, Pid, MsgFmt, MsgArgs);
do_format({error, _GL, {Pid, "** gen_event handler" ++ _, Args}}) ->
%% gen_event handler terminate
- [ID, Name, LastMsg0, State0, Reason] = Args,
+ [ID, Name, LastMsg0, State, Reason] = Args,
LastMsg = case couch_log_config:get(strip_last_msg) of
true ->
redacted;
false ->
LastMsg0
end,
- Opts = ctx_opts(gen_event, State0),
- State = format_state(State0, Opts),
MsgFmt = "gen_event ~w installed in ~w terminated with reason: ~s~n" ++
" last msg: ~p~n state: ~p",
- MsgArgs = [ID, Name, format_reason(Reason, Opts), LastMsg, State],
+ MsgArgs = [ID, Name, format_reason(Reason), LastMsg, State],
format(error, Pid, MsgFmt, MsgArgs);
do_format({error, _GL, {emulator, "~s~n", [Msg]}}) when is_list(Msg) ->
@@ -132,14 +125,13 @@ do_format({error_report, _GL, {Pid, supervisor_report, D}}) ->
case lists:sort(D) of
[{errorContext, Ctx}, {offender, Off},
{reason, Reason}, {supervisor, Name}] ->
- Opts = ctx_opts(supervisor, Off),
- Offender = format_offender(Off, Opts),
+ Offender = format_offender(Off),
MsgFmt = "Supervisor ~w had child ~s exit " ++
"with reason ~s in context ~w",
Args = [
supervisor_name(Name),
Offender,
- format_reason(Reason, Opts),
+ format_reason(Reason),
Ctx
],
format(error, Pid, MsgFmt, Args);
@@ -163,9 +155,8 @@ do_format({info_msg, _GL, {Pid, Fmt, Args}}) ->
do_format({info_report, _GL, {Pid, std_info, D}}) when is_list(D) ->
case lists:sort(D) of
[{application, App}, {exited, Reason}, {type, _Type}] ->
- Opts = ctx_opts(application, App),
MsgFmt = "Application ~w exited with reason: ~s",
- format(info, Pid, MsgFmt, [App, format_reason(Reason, Opts)]);
+ format(info, Pid, MsgFmt, [App, format_reason(Reason)]);
_ ->
format(info, Pid, print_silly_list(D))
end;
@@ -179,8 +170,7 @@ do_format({info_report, _GL, {Pid, progress, D}}) ->
MsgFmt = "Application ~w started on node ~w",
format(info, Pid, MsgFmt, [App, Node]);
[{started, Started}, {supervisor, Name}] ->
- Opts = ctx_opts(supervisor_progress, Started),
- MFA = format_mfa(get_value(mfargs, Started), Opts),
+ MFA = format_mfa(get_value(mfargs, Started)),
ChildPid = get_value(pid, Started),
MsgFmt = "Supervisor ~w started ~s at pid ~w",
format(debug, Pid, MsgFmt, [supervisor_name(Name), MFA, ChildPid]);
@@ -193,7 +183,6 @@ do_format(Event) ->
format_crash_report(Report, Neighbours) ->
- Opts = ctx_opts(crash_report, Report),
Pid = get_value(pid, Report),
Name = case get_value(registered_name, Report) of
undefined ->
@@ -202,7 +191,7 @@ format_crash_report(Report, Neighbours) ->
io_lib:format("~s (~w)", [Atom, Pid])
end,
{Class, Reason, Trace} = get_value(error_info, Report),
- ReasonStr = format_reason({Reason, Trace}, Opts),
+ ReasonStr = format_reason({Reason, Trace}),
Type = case Class of
exit -> "exited";
_ -> "crashed"
@@ -218,7 +207,7 @@ format_crash_report(Report, Neighbours) ->
end.
-format_offender(Off, Opts) ->
+format_offender(Off) ->
case get_value(mfargs, Off) of
undefined ->
%% supervisor_bridge
@@ -226,7 +215,7 @@ format_offender(Off, Opts) ->
io_lib:format("at module ~w at ~w", Args);
MFArgs ->
%% regular supervisor
- MFA = format_mfa(MFArgs, Opts),
+ MFA = format_mfa(MFArgs),
%% In 2014 the error report changed from `name' to
%% `id', so try that first.
@@ -240,59 +229,57 @@ format_offender(Off, Opts) ->
io_lib:format("~p started with ~s at ~w", Args)
end.
-format_reason(Reason) ->
- format_reason(Reason, #{}).
-format_reason({'function not exported', [{M, F, A} | Trace]}, Opts) ->
- ["call to unexported function ", format_mfa({M, F, A}, Opts),
+format_reason({'function not exported', [{M, F, A} | Trace]}) ->
+ ["call to unexported function ", format_mfa({M, F, A}),
" at ", format_trace(Trace)];
-format_reason({'function not exported' = C, [{M, F, A, _Props} | Rest]}, Opts) ->
+format_reason({'function not exported' = C, [{M, F, A, _Props} | Rest]}) ->
%% Drop line number from undefined function
- format_reason({C, [{M, F, A} | Rest]}, Opts);
+ format_reason({C, [{M, F, A} | Rest]});
-format_reason({undef, [MFA | Trace]}, Opts) ->
- ["call to undefined function ", format_mfa(MFA, Opts),
+format_reason({undef, [MFA | Trace]}) ->
+ ["call to undefined function ", format_mfa(MFA),
" at ", format_trace(Trace)];
-format_reason({bad_return, {MFA, Val}}, Opts) ->
- ["bad return value ", print_val(Val, Opts), " from ", format_mfa(MFA, Opts)];
+format_reason({bad_return, {MFA, Val}}) ->
+ ["bad return value ", print_val(Val), " from ", format_mfa(MFA)];
-format_reason({bad_return_value, Val}, Opts) ->
- ["bad return value ", print_val(Val, Opts)];
+format_reason({bad_return_value, Val}) ->
+ ["bad return value ", print_val(Val)];
-format_reason({{bad_return_value, Val}, MFA}, Opts) ->
- ["bad return value ", print_val(Val, Opts), " at ", format_mfa(MFA, Opts)];
+format_reason({{bad_return_value, Val}, MFA}) ->
+ ["bad return value ", print_val(Val), " at ", format_mfa(MFA)];
-format_reason({{badrecord, Record}, Trace}, Opts) ->
- ["bad record ", print_val(Record, Opts), " at ", format_trace(Trace)];
+format_reason({{badrecord, Record}, Trace}) ->
+ ["bad record ", print_val(Record), " at ", format_trace(Trace)];
-format_reason({{case_clause, Val}, Trace}, Opts) ->
- ["no case clause matching ", print_val(Val, Opts), " at ", format_trace(Trace)];
+format_reason({{case_clause, Val}, Trace}) ->
+ ["no case clause matching ", print_val(Val), " at ", format_trace(Trace)];
-format_reason({function_clause, [MFA | Trace]}, Opts) ->
- ["no function clause matching ", format_mfa(MFA, Opts),
+format_reason({function_clause, [MFA | Trace]}) ->
+ ["no function clause matching ", format_mfa(MFA),
" at ", format_trace(Trace)];
-format_reason({if_clause, Trace}, _Opts) ->
+format_reason({if_clause, Trace}) ->
["no true branch found while evaluating if expression at ",
format_trace(Trace)];
-format_reason({{try_clause, Val}, Trace}, Opts) ->
- ["no try clause matching ", print_val(Val, Opts), " at ", format_trace(Trace)];
+format_reason({{try_clause, Val}, Trace}) ->
+ ["no try clause matching ", print_val(Val), " at ", format_trace(Trace)];
-format_reason({badarith, Trace}, _Opts) ->
+format_reason({badarith, Trace}) ->
["bad arithmetic expression at ", format_trace(Trace)];
-format_reason({{badmatch, Val}, Trace}, Opts) ->
- ["no match of right hand value ", print_val(Val, Opts),
+format_reason({{badmatch, Val}, Trace}) ->
+ ["no match of right hand value ", print_val(Val),
" at ", format_trace(Trace)];
-format_reason({emfile, Trace}, _Opts) ->
+format_reason({emfile, Trace}) ->
["maximum number of file descriptors exhausted, check ulimit -n; ",
format_trace(Trace)];
-format_reason({system_limit, [{M, F, A} | Trace]}, Opts) ->
+format_reason({system_limit, [{M, F, A} | Trace]}) ->
Limit = case {M, F} of
{erlang, open_port} ->
"maximum number of ports exceeded";
@@ -305,71 +292,68 @@ format_reason({system_limit, [{M, F, A} | Trace]}, Opts) ->
{ets, new} ->
"maximum number of ETS tables exceeded";
_ ->
- format_mfa({M, F, A}, Opts)
+ format_mfa({M, F, A})
end,
["system limit: ", Limit, " at ", format_trace(Trace)];
-format_reason({badarg, [MFA | Trace]}, Opts) ->
- ["bad argument in call to ", format_mfa(MFA, Opts),
+format_reason({badarg, [MFA | Trace]}) ->
+ ["bad argument in call to ", format_mfa(MFA),
" at ", format_trace(Trace)];
-format_reason({{badarg, Stack}, _}, Opts) ->
- format_reason({badarg, Stack}, Opts);
+format_reason({{badarg, Stack}, _}) ->
+ format_reason({badarg, Stack});
-format_reason({{badarity, {Fun, Args}}, Trace}, _Opts) ->
+format_reason({{badarity, {Fun, Args}}, Trace}) ->
{arity, Arity} = lists:keyfind(arity, 1, erlang:fun_info(Fun)),
MsgFmt = "function called with wrong arity of ~w instead of ~w at ",
[io_lib:format(MsgFmt, [length(Args), Arity]), format_trace(Trace)];
-format_reason({noproc, MFA}, Opts) ->
- ["no such process or port in call to ", format_mfa(MFA, Opts)];
+format_reason({noproc, MFA}) ->
+ ["no such process or port in call to ", format_mfa(MFA)];
-format_reason({{badfun, Term}, Trace}, Opts) ->
- ["bad function ", print_val(Term, Opts), " called at ", format_trace(Trace)];
+format_reason({{badfun, Term}, Trace}) ->
+ ["bad function ", print_val(Term), " called at ", format_trace(Trace)];
-format_reason({Reason, [{M, F, A} | _] = Trace}, Opts)
+format_reason({Reason, [{M, F, A} | _] = Trace})
when is_atom(M), is_atom(F), is_integer(A) ->
- [format_reason(Reason, Opts), " at ", format_trace(Trace)];
+ [format_reason(Reason), " at ", format_trace(Trace)];
-format_reason({Reason, [{M, F, A} | _] = Trace}, Opts)
+format_reason({Reason, [{M, F, A} | _] = Trace})
when is_atom(M), is_atom(F), is_list(A) ->
- [format_reason(Reason, Opts), " at ", format_trace(Trace)];
+ [format_reason(Reason), " at ", format_trace(Trace)];
-format_reason({Reason, [{M, F, A, Props} | _] = Trace}, Opts)
+format_reason({Reason, [{M, F, A, Props} | _] = Trace})
when is_atom(M), is_atom(F), is_integer(A), is_list(Props) ->
- [format_reason(Reason, Opts), " at ", format_trace(Trace)];
+ [format_reason(Reason), " at ", format_trace(Trace)];
-format_reason({Reason, [{M, F, A, Props} | _] = Trace}, Opts)
+format_reason({Reason, [{M, F, A, Props} | _] = Trace})
when is_atom(M), is_atom(F), is_list(A), is_list(Props) ->
- [format_reason(Reason, Opts), " at ", format_trace(Trace)];
+ [format_reason(Reason), " at ", format_trace(Trace)];
-format_reason(Reason, Opts) ->
- {Str, _} = couch_log_trunc_io:print(maybe_sanitize_reason(Reason, Opts), 500),
+format_reason(Reason) ->
+ {Str, _} = couch_log_trunc_io:print(Reason, 500),
Str.
-format_mfa(MFA) ->
- format_mfa(MFA, #{}).
-
-format_mfa({M, F, A}, Opts) when is_list(A) ->
- {FmtStr, Args} = format_args(A, [], [], Opts),
+format_mfa({M, F, A}) when is_list(A) ->
+ {FmtStr, Args} = format_args(A, [], []),
io_lib:format("~w:~w(" ++ FmtStr ++ ")", [M, F | Args]);
-format_mfa({M, F, A}, _Opts) when is_integer(A) ->
+format_mfa({M, F, A}) when is_integer(A) ->
io_lib:format("~w:~w/~w", [M, F, A]);
-format_mfa({M, F, A, Props}, Opts) when is_list(Props) ->
+format_mfa({M, F, A, Props}) when is_list(Props) ->
case get_value(line, Props) of
undefined ->
- format_mfa({M, F, A}, Opts);
+ format_mfa({M, F, A});
Line ->
- [format_mfa({M, F, A}, Opts), io_lib:format("(line:~w)", [Line])]
+ [format_mfa({M, F, A}), io_lib:format("(line:~w)", [Line])]
end;
-format_mfa(Trace, _Opts) when is_list(Trace) ->
+format_mfa(Trace) when is_list(Trace) ->
format_trace(Trace);
-format_mfa(Other, _Opts) ->
+format_mfa(Other) ->
io_lib:format("~w", [Other]).
@@ -393,15 +377,12 @@ trace_mfa(Other) ->
format_mfa(Other).
-format_args(Args, Format, Acc) ->
- format_args(Args, Format, Acc, #{}).
-
-format_args([], FmtAcc, ArgsAcc, _Opts) ->
+format_args([], FmtAcc, ArgsAcc) ->
{string:join(lists:reverse(FmtAcc), ", "), lists:reverse(ArgsAcc)};
-format_args([H|T], FmtAcc, ArgsAcc, Opts) ->
- {Str, _} = couch_log_trunc_io:print(maybe_sanitize_term(H, Opts), 100),
- format_args(T, ["~s" | FmtAcc], [Str | ArgsAcc], Opts).
+format_args([H|T], FmtAcc, ArgsAcc) ->
+ {Str, _} = couch_log_trunc_io:print(H, 100),
+ format_args(T, ["~s" | FmtAcc], [Str | ArgsAcc]).
maybe_truncate(Fmt, Args) ->
@@ -446,8 +427,8 @@ print_silly_list([H | T], Fmt, Acc) ->
print_silly_list(T, ["~p" | Fmt], [H | Acc]).
-print_val(Val, Opts) ->
- {Str, _} = couch_log_trunc_io:print(maybe_sanitize_term(Val, Opts), 500),
+print_val(Val) ->
+ {Str, _} = couch_log_trunc_io:print(Val, 500),
Str.
@@ -477,100 +458,3 @@ get_value(Key, List, Default) ->
supervisor_name({local, Name}) -> Name;
supervisor_name(Name) -> Name.
-
-
-format_state({State, #{module := _}}, Opts) ->
- maybe_sanitize_state(State, Opts);
-format_state(State, Opts) ->
- maybe_sanitize_state(State, Opts).
-
-ctx_opts(supervisor_progress, Child) ->
- Opts = ctx_opts(supervisor, Child),
- Opts#{kind => supervisor_progress};
-ctx_opts(supervisor, Off) ->
- Id = get_value(id, Off),
- Sanitizer = couch_log_config:get(sanitizer_module),
- case get_value(mfargs, Off) of
- undefined ->
- %% supervisor_bridge
- case get_value(mod, Off) of
- undefined ->
- #{
- kind => supervisor,
- id => Id,
- sanitizer => Sanitizer
- };
- M ->
- #{
- kind => supervisor,
- id => Id,
- module => M,
- sanitizer => Sanitizer
- }
- end;
- {M, _F, _A} ->
- %% regular supervisor
- #{
- kind => supervisor,
- id => Id,
- module => M,
- sanitizer => Sanitizer
- }
- end;
-ctx_opts(crash_report, Report) ->
- Dictionary = get_value(dictionary, Report, []),
- InitialCall = get_value('$initial_call', Dictionary),
- #{
- kind => crash_report,
- id => get_value(registered_name, Report),
- dictionary => Dictionary,
- initial_call => InitialCall,
- sanitizer => couch_log_config:get(sanitizer_module)
- };
-ctx_opts(application, App) ->
- #{
- kind => application,
- application => App,
- sanitizer => couch_log_config:get(sanitizer_module)
- };
-ctx_opts(Kind, {_State, #{module := _} = Opts}) ->
- Opts#{
- kind => Kind,
- sanitizer => couch_log_config:get(sanitizer_module)
- };
-ctx_opts(gen_server, [
- {data, [{"State", _State}]},
- {supervisor, [{"Callback", Module}]}]) ->
- %% technically we can get `id` from `_State` it should be `element(2, State)`
- %% see https://github.com/erlang/otp/blob/master/lib/stdlib/src/supervisor.erl#L127
- #{
- kind => supervisor,
- module => Module,
- sanitizer => couch_log_config:get(sanitizer_module)
- };
-ctx_opts(Kind, _State) ->
- #{
- kind => Kind,
- sanitizer => couch_log_config:get(sanitizer_module)
- }.
-
-maybe_sanitize_term(Term, #{sanitizer := undefined}) ->
- Term;
-maybe_sanitize_term(Term, #{sanitizer := Module} = Opts) ->
- Module:sanitize_term(Term, Opts);
-maybe_sanitize_term(Term, _) ->
- Term.
-
-maybe_sanitize_state(Term, #{sanitizer := undefined}) ->
- Term;
-maybe_sanitize_state(Term, #{sanitizer := Module} = Opts) ->
- Module:sanitize_state(Term, Opts);
-maybe_sanitize_state(Term, _) ->
- Term.
-
-maybe_sanitize_reason(Term, #{sanitizer := undefined}) ->
- Term;
-maybe_sanitize_reason(Term, #{sanitizer := Module} = Opts) ->
- Module:sanitize_reason(Term, Opts);
-maybe_sanitize_reason(Term, _) ->
- Term.
\ No newline at end of file
diff --git a/src/couch_log/src/couch_log_sup.erl b/src/couch_log/src/couch_log_sup.erl
index 605303d..fc1ac78 100644
--- a/src/couch_log/src/couch_log_sup.erl
+++ b/src/couch_log/src/couch_log_sup.erl
@@ -65,8 +65,6 @@ handle_config_change("log", Key, _, _, S) ->
couch_log_config:reconfigure();
"strip_last_msg" ->
couch_log_config:reconfigure();
- "sanitizer_module" ->
- couch_log_config:reconfigure();
_ ->
% Someone may have changed the config for
% the writer so we need to re-initialize.
diff --git a/src/couch_log/test/eunit/couch_log_config_test.erl b/src/couch_log/test/eunit/couch_log_config_test.erl
index b2746ac..a4c4bcf 100644
--- a/src/couch_log/test/eunit/couch_log_config_test.erl
+++ b/src/couch_log/test/eunit/couch_log_config_test.erl
@@ -27,8 +27,7 @@ couch_log_config_test_() ->
fun check_bad_level/0,
fun check_bad_max_message_size/0,
fun check_strip_last_msg/0,
- fun check_bad_strip_last_msg/0,
- fun check_sanitizer_module/0
+ fun check_bad_strip_last_msg/0
]
}.
@@ -144,17 +143,3 @@ check_bad_strip_last_msg() ->
couch_log_test_util:wait_for_config(),
?assertEqual(true, couch_log_config:get(strip_last_msg))
end).
-
-check_sanitizer_module() ->
- % Default is undefined
- ?assertEqual(undefined, couch_log_config:get(sanitizer_module)),
-
- couch_log_test_util:with_config_listener(fun() ->
- config:set("log", "sanitizer_module", "mymodule"),
- couch_log_test_util:wait_for_config(),
- ?assertEqual(mymodule, couch_log_config:get(sanitizer_module)),
-
- config:delete("log", "sanitizer_module"),
- couch_log_test_util:wait_for_config(),
- ?assertEqual(undefined, couch_log_config:get(sanitizer_module))
- end).
\ No newline at end of file
diff --git a/src/couch_log/test/eunit/couch_log_formatter_test.erl b/src/couch_log/test/eunit/couch_log_formatter_test.erl
index a71187f..24de346 100644
--- a/src/couch_log/test/eunit/couch_log_formatter_test.erl
+++ b/src/couch_log/test/eunit/couch_log_formatter_test.erl
@@ -16,21 +16,6 @@
-include("couch_log.hrl").
-include_lib("eunit/include/eunit.hrl").
--export([
- sanitize_term/2,
- sanitize_reason/2,
- sanitize_state/2
-]).
-
-
-sanitize_term(Term, #{dictionary := PDict, kind := Kind}) ->
- {Kind, {sanitized_term, Term}, {sanitized_pdict, PDict}}.
-
-sanitize_reason(Term, #{dictionary := PDict, kind := Kind}) ->
- {sanitized_reason, Kind, Term, PDict}.
-
-sanitize_state(Term, #{dictionary := PDict, kind := Kind}) ->
- {sanitized_state, Kind, Term, PDict}.
truncate_fmt_test() ->
Msg = [0 || _ <- lists:seq(1, 1048576)],
@@ -992,123 +977,3 @@ do_matches(#log_entry{msg = Msg} = E, [Pattern | RestPatterns]) ->
?assertEqual(nomatch, Err2)
end,
do_matches(E, RestPatterns).
-
-sanitizer_test_() ->
- {setup,
- fun() ->
- Ctx = couch_log_test_util:start(),
- couch_log_test_util:with_config_listener(fun() ->
- config:set("log", "sanitizer_module", atom_to_list(?MODULE)),
- couch_log_test_util:wait_for_config()
- end),
- Ctx
- end,
- fun couch_log_test_util:stop/1,
- [
- {"gen_server", fun check_gen_server_with_ctx/0},
- {"gen_fsm", fun check_gen_fsm_with_ctx/0},
- {"gen_event", fun check_gen_event_with_ctx/0}
- ]
- }.
-
-check_gen_server_with_ctx() ->
- {gen_server, ?_test(begin
- Pid = self(),
- Ctx = #{dictionary => [{key, value}], module => ?MODULE},
- Event = {
- error,
- erlang:group_leader(),
- {
- Pid,
- "** Generic server and some stuff",
- [
- a_gen_server,
- {foo, bar},
- {server_state, Ctx},
- some_reason
- ]
- }
- },
- Formatted = do_format(Event),
- ?assertMatch(
- #log_entry{
- level = error,
- pid = Pid
- },
- Formatted
- ),
- do_matches(Formatted, [
- "gen_server a_gen_server terminated",
- "with reason: {sanitized_reason,gen_server,some_reason,\\[{key,value}\\]}",
- "last msg: redacted",
- "state: {sanitized_state,gen_server,server_state,\\[{key,value}\\]}",
- "extra: \\[\\]"
- ])
-end)}.
-
-check_gen_fsm_with_ctx() ->
- Pid = self(),
- Ctx = #{dictionary => [{key, value}], module => ?MODULE},
- Event = {
- error,
- erlang:group_leader(),
- {
- Pid,
- "** State machine did a thing",
- [
- a_gen_fsm,
- {foo, bar},
- state_name,
- {current_state, Ctx},
- some_reason
- ]
- }
- },
- Formatted = do_format(Event),
- ?assertMatch(
- #log_entry{
- level = error,
- pid = Pid
- },
- Formatted
- ),
- do_matches(Formatted, [
- "gen_fsm a_gen_fsm in state state_name",
- "with reason: {sanitized_reason,gen_fsm,some_reason,\\[{key,value}\\]}",
- "last msg: redacted",
- "state: {sanitized_state,gen_fsm,current_state,\\[{key,value}\\]}",
- "extra: \\[\\]"
- ]).
-
-check_gen_event_with_ctx() ->
- Pid = self(),
- Ctx = #{dictionary => [{key, value}], module => ?MODULE},
- Event = {
- error,
- erlang:group_leader(),
- {
- Pid,
- "** gen_event handler did a thing",
- [
- handler_id,
- a_gen_event,
- {foo,bat},
- {current_state, Ctx},
- some_reason
- ]
- }
- },
- Formatted = do_format(Event),
- ?assertMatch(
- #log_entry{
- level = error,
- pid = Pid
- },
- Formatted
- ),
- do_matches(Formatted, [
- "gen_event handler_id installed in a_gen_event",
- "reason: {sanitized_reason,gen_event,some_reason,\\[{key,value}\\]}",
- "last msg: redacted",
- "state: {sanitized_state,gen_event,current_state,\\[{key,value}\\]}"
- ]).
[couchdb] 07/07: Strip proxy_url in replicator
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 9d2e7af040873830ca3bd387f4ef23b31c4ad10b
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:46:57 2021 -0700
Strip proxy_url in replicator
---
.../src/couch_replicator_httpc_pool.erl | 31 +++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/couch_replicator/src/couch_replicator_httpc_pool.erl b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
index 90234a6..dc9a749 100644
--- a/src/couch_replicator/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
@@ -20,7 +20,7 @@
% gen_server API
-export([init/1, handle_call/3, handle_info/2, handle_cast/2]).
--export([code_change/3, terminate/2]).
+-export([code_change/3, terminate/2, format_status/2]).
-include_lib("couch/include/couch_db.hrl").
@@ -145,6 +145,16 @@ code_change(_OldVsn, #state{}=State, _Extra) ->
terminate(_Reason, _State) ->
ok.
+format_status(_Opt, [_PDict, State]) ->
+ #state{
+ url = Url,
+ proxy_url = ProxyUrl
+ } = State,
+ [{data, [{"State", State#state{
+ url = couch_util:url_strip_password(Url),
+ proxy_url = couch_util:url_strip_password(ProxyUrl)
+ }}]}].
+
monitor_client(Callers, Worker, {ClientPid, _}) ->
[{Worker, erlang:monitor(process, ClientPid)} | Callers].
@@ -182,3 +192,22 @@ release_worker_internal(Worker, State) ->
false ->
State#state{callers = NewCallers0}
end.
+
+
+-ifdef(TEST).
+
+-include_lib("couch/include/couch_eunit.hrl").
+
+format_status_test_() ->
+ ?_test(begin
+ State = #state{
+ url = "https://username1:password1@$ACCOUNT2.cloudant.com/db",
+ proxy_url = "https://username2:password2@proxy.thing.com:8080/"
+ },
+ [{data, [{"State", ScrubbedN}]}] = format_status(normal, [[], State]),
+ ?assertEqual("https://username1:*****@$ACCOUNT2.cloudant.com/db", ScrubbedN#state.url),
+ ?assertEqual("https://username2:*****@proxy.thing.com:8080/", ScrubbedN#state.proxy_url),
+ ok
+ end).
+
+-endif.
\ No newline at end of file
[couchdb] 01/07: Revert "fixup: Add format_status/2 callbacks..."
Posted by ii...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch clean-up-logs-3.x.v2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit fc6292b14cc3e84938b644057c42567fa54f06a7
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Mar 16 08:43:13 2021 -0700
Revert "fixup: Add format_status/2 callbacks..."
This reverts commit 80c964e0e393e4d08bbc379c187bcc36d81c7443.
---
src/couch_replicator/src/couch_replicator_auth_session.erl | 3 +--
src/ddoc_cache/src/ddoc_cache_opener.erl | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/couch_replicator/src/couch_replicator_auth_session.erl b/src/couch_replicator/src/couch_replicator_auth_session.erl
index a376dcd..072550a 100644
--- a/src/couch_replicator/src/couch_replicator_auth_session.erl
+++ b/src/couch_replicator/src/couch_replicator_auth_session.erl
@@ -184,8 +184,7 @@ code_change(_OldVsn, State, _Extra) ->
format_status(normal, [_PDict, State]) ->
- SessionUrl = couch_util:url_strip_password(State#state.session_url),
- [{data, [{"State", State#state{session_url = SessionUrl}}]}];
+ [{data, [{"State", State}]}];
format_status(terminate, [PDict, State]) ->
{[
diff --git a/src/ddoc_cache/src/ddoc_cache_opener.erl b/src/ddoc_cache/src/ddoc_cache_opener.erl
index e4b49c2..a9d43b1 100644
--- a/src/ddoc_cache/src/ddoc_cache_opener.erl
+++ b/src/ddoc_cache/src/ddoc_cache_opener.erl
@@ -70,5 +70,5 @@ code_change(_OldVsn, State, _Extra) ->
format_status(normal, [_PDict, State]) ->
[{data, [{"State", State}]}];
-format_status(terminate, [PDict, State]) ->
- {State, #{module => ?MODULE, dictionary => PDict}}.
+format_status(terminate, [_PDict, State]) ->
+ {State, #{module => ?MODULE}}.
\ No newline at end of file