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 <[email protected]> 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:[email protected]: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) ->
