Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2576 Resolve the cache invalidation of the partition->leader shard in ClientCache #2577

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
groups = new ConcurrentHashMap<>();
stores = new ConcurrentHashMap<>();
caches = new ConcurrentHashMap<>();
initialized.set(false);

Check warning on line 293 in hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java

View check run for this annotation

Codecov / codecov/patch

hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java#L293

Added line #L293 was not covered by tests
}

public Shard getLeader(int partitionId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@
public KVPair<Metapb.Partition, Metapb.Shard> getPartition(String graphName, byte[] key) throws
PDException {
// 先查cache,cache没有命中,在调用PD
KVPair<Metapb.Partition, Metapb.Shard> partShard = cache.getPartitionByKey(graphName, key);
int code = PartitionUtils.calcHashcode(key);
KVPair<Metapb.Partition, Metapb.Shard> partShard = this.getPartitionByCode(graphName, code);

Check warning on line 465 in hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java

View check run for this annotation

Codecov / codecov/patch

hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDClient.java#L464-L465

Added lines #L464 - L465 were not covered by tests
partShard = getKvPair(graphName, key, partShard);
return partShard;
}
Expand Down
Loading