-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #13303 +/- ##
==========================================
- Coverage 40.67% 40.66% -0.01%
==========================================
Files 1804 1805 +1
Lines 72861 75789 +2928
Branches 10428 10630 +202
==========================================
+ Hits 29637 30822 +1185
- Misses 38962 40654 +1692
- Partials 4262 4313 +51 ☔ View full report in Codecov by Sentry. |
# 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