diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2022-11-17 12:21:16 -0500 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2022-11-17 13:01:47 -0500 |
commit | 571549ad0e33501e7c0ea05de9882a20750192aa (patch) | |
tree | f48737932d0be4f13fe5ac9760508def2ab4d198 | |
parent | 62d92766e8b8042c2f3627c3ac3e2365410c7912 (diff) | |
download | couchdb-571549ad0e33501e7c0ea05de9882a20750192aa.tar.gz |
Add a proper reshard jobs ioq class
This lets users bypass it just like any other ioq classes.
Improving on https://github.com/apache/couchdb/pull/4267
-rw-r--r-- | src/docs/src/config/ioq.rst | 5 | ||||
-rw-r--r-- | src/ioq/src/ioq.erl | 5 | ||||
-rw-r--r-- | src/mem3/src/mem3_reshard_index.erl | 3 | ||||
-rw-r--r-- | src/mem3/src/mem3_reshard_job.erl | 2 |
4 files changed, 12 insertions, 3 deletions
diff --git a/src/docs/src/config/ioq.rst b/src/docs/src/config/ioq.rst index ef931b383..f96022590 100644 --- a/src/docs/src/config/ioq.rst +++ b/src/docs/src/config/ioq.rst @@ -75,6 +75,10 @@ according to the settings described below. Disk IO issued by compaction jobs. + .. config:option:: reshard :: Bypass Disk IO for resharding jobs + + Disk IO issued by resharding jobs. + Without any configuration CouchDB will enqueue all classes of IO. The default.ini configuration file that ships with CouchDB activates a bypass for each of the interactive IO classes and only background IO goes into the @@ -87,6 +91,7 @@ according to the settings described below. view_update = true shard_sync = false compaction = false + reshard = false Recommendations =============== diff --git a/src/ioq/src/ioq.erl b/src/ioq/src/ioq.erl index 038d63bae..f5d3a0491 100644 --- a/src/ioq/src/ioq.erl +++ b/src/ioq/src/ioq.erl @@ -76,6 +76,7 @@ bypass(Priority) -> read -> config:get_boolean("ioq.bypass", "read", true); write -> config:get_boolean("ioq.bypass", "write", true); view_update -> config:get_boolean("ioq.bypass", "view_update", true); + reshard -> config:get_boolean("ioq.bypass", "reshard", false); shard_sync -> config:get_boolean("ioq.bypass", "shard_sync", false); compaction -> config:get_boolean("ioq.bypass", "compaction", false); _ -> config:get("ioq.bypass", atom_to_list(Priority)) =:= "true" @@ -103,6 +104,8 @@ io_class(_, {search, _}) -> search; io_class(_, {search, _, _}) -> search; +io_class(_, {reshard, _}) -> + reshard; io_class(_, _) -> other. @@ -182,6 +185,8 @@ 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) -> State#state{background = queue:in(Request, State#state.background)}; +enqueue_request(#request{priority = reshard} = Request, #state{} = State) -> + State#state{background = queue:in(Request, State#state.background)}; enqueue_request(#request{} = Request, #state{} = State) -> State#state{interactive = queue:in(Request, State#state.interactive)}. diff --git a/src/mem3/src/mem3_reshard_index.erl b/src/mem3/src/mem3_reshard_index.erl index 54cb08ebe..d45701362 100644 --- a/src/mem3/src/mem3_reshard_index.erl +++ b/src/mem3/src/mem3_reshard_index.erl @@ -104,8 +104,7 @@ hastings_indices(DbName, Doc) -> end. build_index({?MRVIEW, DbName, MRSt} = Ctx, Try) -> - IdxName = couch_mrview_index:get(idx_name, MRSt), - ioq:set_io_priority({view_compact, DbName, IdxName}), + ioq:set_io_priority({reshard, DbName}), await_retry( couch_index_server:get_index(couch_mrview_index, MRSt), fun couch_index:get_state/2, diff --git a/src/mem3/src/mem3_reshard_job.erl b/src/mem3/src/mem3_reshard_job.erl index 1be74dfba..25ff1cf19 100644 --- a/src/mem3/src/mem3_reshard_job.erl +++ b/src/mem3/src/mem3_reshard_job.erl @@ -367,7 +367,7 @@ initial_copy_impl(#job{source = Source, target = Targets0} = Job) -> #shard{name = SourceName} = Source, Targets = [{R, N} || #shard{range = R, name = N} <- Targets0], TMap = maps:from_list(Targets), - ioq:set_io_priority({db_compact, SourceName}), + ioq:set_io_priority({reshard, SourceName}), LogMsg1 = "~p initial_copy started ~s", LogArgs1 = [?MODULE, shardsstr(Source, Targets0)], couch_log:notice(LogMsg1, LogArgs1), |