summaryrefslogtreecommitdiff
path: root/src/ioq
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@gmail.com>2022-11-17 12:21:16 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2022-11-17 13:01:47 -0500
commit571549ad0e33501e7c0ea05de9882a20750192aa (patch)
treef48737932d0be4f13fe5ac9760508def2ab4d198 /src/ioq
parent62d92766e8b8042c2f3627c3ac3e2365410c7912 (diff)
downloadcouchdb-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
Diffstat (limited to 'src/ioq')
-rw-r--r--src/ioq/src/ioq.erl5
1 files changed, 5 insertions, 0 deletions
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)}.