This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch add-reshard-ioq-priority in repository https://gitbox.apache.org/repos/asf/couchdb-ioq.git
commit 33e84022caf46ca675292ad1df7adf1a582ae662 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Thu Nov 17 13:44:51 2022 -0500 Add a proper reshard ioq class This mirrors the upstream PR https://github.com/apache/couchdb/pull/4270 --- include/ioq.hrl | 4 +++- operator_guide.md | 2 ++ priv/stats_descriptions.cfg | 12 ++++++++++++ src/ioq_server.erl | 6 ++++++ src/ioq_server2.erl | 5 +++-- test/ioq_tests.erl | 2 +- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/include/ioq.hrl b/include/ioq.hrl index 9e9bf67..7c4a4a4 100644 --- a/include/ioq.hrl +++ b/include/ioq.hrl @@ -44,7 +44,8 @@ {other, 1.0}, {interactive, 1.0}, {system, 1.0}, - {search, 1.0} + {search, 1.0}, + {reshard, 0.001} ]). @@ -72,6 +73,7 @@ | system | search | internal_repl + | reshard | other | customer | db_meta diff --git a/operator_guide.md b/operator_guide.md index 81acdcc..43abee0 100644 --- a/operator_guide.md +++ b/operator_guide.md @@ -46,6 +46,8 @@ that the mapping of IOQ classes to class priorities is not 1:1. | internal_repl | replication | IO requests related to internal | | | | replication. | | | | | +| reshard | reshard | IO requests related to resharding jobs | +| | | | | low | low | IO requests related to requests made by | | | | users via the http layer where the | | | | "x-cloudant-priority: low" header is set. | diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg index 44bb128..a02931c 100644 --- a/priv/stats_descriptions.cfg +++ b/priv/stats_descriptions.cfg @@ -62,6 +62,10 @@ {type, counter}, {desc, <<"IO related to internal system activities">>} ]}. +{[couchdb, io_queue, reshard], [ + {type, counter}, + {desc, <<"IO related to resharding jobs">>} +]}. {[couchdb, io_queue, other], [ {type, counter}, {desc, <<"IO related to internal replication">>} @@ -126,6 +130,10 @@ {type, counter}, {desc, <<"bypassed IO related to internal system activities">>} ]}. +{[couchdb, io_queue_bypassed, reshard], [ + {type, counter}, + {desc, <<"bypassed IO related to resharding jobs">>} +]}. {[couchdb, io_queue_bypassed, other], [ {type, counter}, {desc, <<"bypassed IO related to internal replication">>} @@ -214,6 +222,10 @@ {type, counter}, {desc, <<"IO related to internal system activities">>} ]}. +{[couchdb, io_queue2, reshard, count], [ + {type, counter}, + {desc, <<"IO related to resharding jobs">>} +]}. {[couchdb, io_queue2, other, count], [ {type, counter}, {desc, <<"IO related to internal replication">>} diff --git a/src/ioq_server.erl b/src/ioq_server.erl index 78f16ca..b23dc10 100644 --- a/src/ioq_server.erl +++ b/src/ioq_server.erl @@ -228,6 +228,8 @@ analyze_priority({view_compact, _Shard, _GroupId}) -> {view_compact, nil}; analyze_priority({internal_repl, _Shard}) -> {internal_repl, nil}; +analyze_priority({reshard, _Shard}) -> + {reshard, nil}; analyze_priority({system, _Shard}) -> {system, nil}; analyze_priority({low, _Shard}) -> @@ -257,6 +259,8 @@ enqueue_request(#request{class = view_compact} = Req, State) -> State#state{qC = update_queue(Req, State#state.qC, State#state.dedupe)}; enqueue_request(#request{class = internal_repl} = Req, State) -> State#state{qR = update_queue(Req, State#state.qR, State#state.dedupe)}; +enqueue_request(#request{class = reshard} = Req, State) -> + State#state{qR = update_queue(Req, State#state.qR, State#state.dedupe)}; enqueue_request(#request{class = low} = Req, State) -> State#state{qL = update_queue(Req, State#state.qL, State#state.dedupe)}; enqueue_request(Req, State) -> @@ -473,6 +477,8 @@ make_key(interactive, {append_bin, _}) -> <<"writes">>; make_key(system, _) -> <<"system">>; +make_key(reshard, _) -> + <<"reshard">>; make_key(search, _) -> <<"search">>; make_key(_, _) -> diff --git a/src/ioq_server2.erl b/src/ioq_server2.erl index 85ffa2c..f7c3907 100644 --- a/src/ioq_server2.erl +++ b/src/ioq_server2.erl @@ -776,6 +776,7 @@ queue_depths_test_() -> #ioq_request{user=Foo, class=view_update}, #ioq_request{user=Foo, class=view_update}, #ioq_request{user=Foo, class=view_update}, + #ioq_request{user=Foo, class=reshard}, #ioq_request{user=Bar, class=interactive}, #ioq_request{user=Bar, class=db_update}, @@ -788,7 +789,7 @@ queue_depths_test_() -> {replication, 3}, {low, 1}, {channels, {[ - {<<"foo">>, [2,1,4]}, + {<<"foo">>, [3,1,4]}, {<<"bar">>, [1,3,1]} ]}} ], @@ -1028,7 +1029,7 @@ check_call(Server, Call, Priority) -> io_classes() -> [interactive, view_update, db_compact, view_compact, - internal_repl, other, db_meta]. + internal_repl, other, db_meta, reshard]. shards() -> diff --git a/test/ioq_tests.erl b/test/ioq_tests.erl index 51bc0d3..2e866a4 100644 --- a/test/ioq_tests.erl +++ b/test/ioq_tests.erl @@ -55,7 +55,7 @@ check_call(Server, Call, Priority) -> ?_assertEqual({reply, Call}, ioq:call(Server, Call, Priority)). io_classes() -> [interactive, view_update, db_compact, view_compact, - internal_repl, other, search, system]. + internal_repl, other, search, system, reshard]. shards() -> [
