You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2025/06/06 00:15:17 UTC

(couchdb-ioq) branch cache-io-priority-encoding created (now f051c7f)

This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a change to branch cache-io-priority-encoding
in repository https://gitbox.apache.org/repos/asf/couchdb-ioq.git


      at f051c7f  Cache shard info for IOQ2 priority

This branch includes the following new commits:

     new f051c7f  Cache shard info for IOQ2 priority

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-ioq) 01/01: Cache shard info for IOQ2 priority

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a commit to branch cache-io-priority-encoding
in repository https://gitbox.apache.org/repos/asf/couchdb-ioq.git

commit f051c7f0195ea4d124a80df117bdf702a937db98
Author: Russell Branca <ch...@apache.org>
AuthorDate: Thu Jun 5 17:15:00 2025 -0700

    Cache shard info for IOQ2 priority
---
 src/ioq_server2.erl | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/ioq_server2.erl b/src/ioq_server2.erl
index 39aa8f4..ce15b2b 100644
--- a/src/ioq_server2.erl
+++ b/src/ioq_server2.erl
@@ -533,9 +533,7 @@ add_request_dimensions(Request, {Class, Shard0, GroupId}) ->
         {db_meta, security} ->
             {undefined, undefined, undefined};
         _ ->
-            Shard1 = filename:rootname(Shard0),
-            {User0, DbName0} = shard_info(Shard1),
-            {Shard1, User0, DbName0}
+            extract_shard_info(Shard0)
     end,
     Request#ioq_request{
         shard = Shard,
@@ -548,6 +546,19 @@ add_request_dimensions(Request, undefined) ->
     Request#ioq_request{class=other}.
 
 
+extract_shard_info(Shard0) ->
+    case erlang:get({io_priority_cache, Shard0}, undefined) of
+        undefined ->
+            Shard1 = filename:rootname(Shard0),
+            {User, Dbname} = shard_info(Shard1),
+            Info = {Shard1, User, Dbname},
+            erlang:put({io_priority_cache, Shard0}, Info),
+            Info;
+        Info ->
+            Info
+    end.
+
+
 -spec shard_info(dbname()) -> {any(), any()}.
 shard_info(Shard) ->
     try split(Shard) of