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

vgalaxies pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new 85e096698 refact: enhance cache invalidation of the partition -> 
leader shard in ClientCache (#2588)
85e096698 is described below

commit 85e096698ad38b4c45056569a1dfd0a5398be557
Author: haohao0103 <[email protected]>
AuthorDate: Mon Jul 15 23:07:30 2024 +0800

    refact: enhance cache invalidation of the partition -> leader shard in 
ClientCache (#2588)
---
 .../src/main/java/org/apache/hugegraph/pd/client/ClientCache.java     | 1 +
 .../src/main/java/org/apache/hugegraph/pd/client/PDClient.java        | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
 
b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
index 0ebc28521..9e584583a 100644
--- 
a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
+++ 
b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
@@ -275,6 +275,7 @@ public class ClientCache {
         groups = new ConcurrentHashMap<>();
         stores = new ConcurrentHashMap<>();
         caches = new ConcurrentHashMap<>();
+        initialized.set(false);
     }
 
     public Shard getLeader(int partitionId) {
diff --git 
a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
 
b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
index b38610c49..17318595f 100644
--- 
a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
+++ 
b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java
@@ -461,7 +461,9 @@ public class PDClient {
      */
     public KVPair<Metapb.Partition, Metapb.Shard> getPartition(String 
graphName, byte[] key) throws
                                                                                
              PDException {
-        KVPair<Metapb.Partition, Metapb.Shard> partShard = 
cache.getPartitionByKey(graphName, key);
+
+        KVPair<Metapb.Partition, Metapb.Shard> partShard =
+                this.getPartitionByCode(graphName, 
PartitionUtils.calcHashcode(key));
         partShard = getKvPair(graphName, key, partShard);
         return partShard;
     }

Reply via email to