You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/11/17 17:22:09 UTC
[couchdb] branch add-a-proper-resharding-ioq-class created (now 335edeb18)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch add-a-proper-resharding-ioq-class
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at 335edeb18 Add a proper reshard jobs ioq class
This branch includes the following new commits:
new 335edeb18 Add a proper reshard jobs ioq class
The 1 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] 01/01: Add a proper reshard jobs ioq class
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch add-a-proper-resharding-ioq-class
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 335edeb1837efe51705414e9e14809bc2aa2a18f
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Thu Nov 17 12:21:16 2022 -0500
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
---
src/docs/src/config/ioq.rst | 5 +++++
src/ioq/src/ioq.erl | 5 +++++
src/mem3/src/mem3_reshard_index.erl | 3 +--
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),