Marcosrico commented on code in PR #2619:
URL: https://github.com/apache/helix/pull/2619#discussion_r1339023455
##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java:
##########
@@ -81,14 +112,100 @@ public int countDirectChildren(final String key) {
throw new MetaClientException("Not implemented yet.");
}
- @Override
- public List<T> get(List<String> keys) {
- throw new MetaClientException("Not implemented yet.");
+ private void populateAllCache() {
+ // TODO: Concurrently populate children and data cache.
+ if (!_cacheClient.exists(_rootEntry)) {
+ LOG.warn("Root entry: {} does not exist.", _rootEntry);
+ // Let the other threads know that the cache is populated.
+ _initializedCache.countDown();
Review Comment:
otherwise populateAllCache will return without counting down the latch so
the cacheEventChange handler thread will wait indefinitely. We can have it
twice or have it in the connect method (from previous impl)
##########
meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java:
##########
@@ -81,14 +109,94 @@ public int countDirectChildren(final String key) {
throw new MetaClientException("Not implemented yet.");
}
- @Override
- public List<T> get(List<String> keys) {
- throw new MetaClientException("Not implemented yet.");
+ private void populateAllCache() {
+ // TODO: Concurrently populate children and data cache.
+ if (_cacheData) {
+ try {
+ List<String> children = _cacheClient.getChildren(_rootEntry);
+ for (String child : children) {
+ String childPath = _rootEntry + "/" + child;
+ T dataRecord = _cacheClient.readData(childPath, true);
+ getDataCacheMap().put(childPath, dataRecord);
+ }
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
}
- @Override
- public List<Stat> exists(List<String> keys) {
- throw new MetaClientException("Not implemented yet.");
+ private class CacheUpdateRunnable implements Runnable {
+ private final String path;
+ private final ChildChangeListener.ChangeType changeType;
+
+ public CacheUpdateRunnable(String path, ChildChangeListener.ChangeType
changeType) {
Review Comment:
Added todo a little lower :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]