-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
feat:RedisMetadataReport implementation #13303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you pls add some comment near these changes about its design?
![]()
|
Codecov Report
@@ Coverage Diff @@
## 3.3 #13303 +/- ##
=========================================
Coverage 40.67% 40.67%
=========================================
Files 1804 1805 +1
Lines 72861 75755 +2894
Branches 10428 10621 +193
=========================================
+ Hits 29637 30815 +1178
- Misses 38962 40625 +1663
- Partials 4262 4315 +53 see 1321 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
# Conflicts: # dubbo-metadata/dubbo-metadata-report-redis/src/main/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReport.java # dubbo-metadata/dubbo-metadata-report-redis/src/test/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReportTest.java
@@ -209,4 +228,266 @@ private String getMetadataStandalone(BaseMetadataIdentifier metadataIdentifier) | |||
throw new RpcException(msg, e); | |||
} | |||
} | |||
|
|||
@Override | |||
public boolean registerServiceAppMapping( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store class and application names using Redis hashes
key: dubbo:mapping
field: class
value: application_names
return false; | ||
} | ||
|
||
private boolean storeMappingStandalone(String key, String field, String value, String ticket) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use 'watch' to implement cas
} | ||
} | ||
|
||
private boolean storeMappingInCluster(String key, String field, String value, String ticket) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspired by the link: https://groups.google.com/g/jedis_redis/c/Z4-0065UFkg
|
||
@Override | ||
public Set<String> getServiceAppMapping(String serviceKey, MappingListener listener, URL url) { | ||
MappingDataListener mappingDataListener = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start one thread to subscribe dubbo:mapping:queues Whenever any server changes occur, it will publish serviceKey,then RedisMetadataReport.NotifySub#onMessage will retrieve the application names again.
} | ||
} | ||
|
||
class MappingDataListener extends Thread { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subscribe application names change message
return mappingDataListenerMap.get(buildPubSubKey()); | ||
} | ||
|
||
class NotifySub extends JedisPubSub { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listen application names change message and notify listener
@AlbumenJ PTAL |
@Nortyr Add them in the code :) |
@AlbumenJ i have add notes ,PTAL |
Kudos, SonarCloud Quality Gate passed! |
What is the purpose of the change
Fixes#12627,Implement the other functionalities in RedisMetadataReport.
previous pr link: #13238
Brief changelog
Verifying this change
Checklist