Github user dasahcc commented on a diff in the pull request:
https://github.com/apache/helix/pull/169#discussion_r177527284
--- Diff:
helix-core/src/main/java/org/apache/helix/common/caches/BasicClusterDataCache.java
---
@@ -104,6 +108,52 @@ public void refresh(HelixDataAccessor accessor) {
}
}
+ /**
+ * Selective update Helix Cache by version
+ * @param accessor the HelixDataAccessor
+ * @param reloadKeys keys needs to be reload
+ * @param cachedKeys keys already exists in the cache
+ * @param cachedPropertyMap cached map of propertykey -> property object
+ * @param <T> the type of metadata
+ * @return
+ */
+ public static <T extends HelixProperty> Map<PropertyKey, T>
updateReloadProperties(
+ HelixDataAccessor accessor, List<PropertyKey> reloadKeys,
List<PropertyKey> cachedKeys,
+ Map<PropertyKey, T> cachedPropertyMap) {
+ // All new entries from zk not cached locally yet should be read from
ZK.
+ Map<PropertyKey, T> refreshedPropertyMap = Maps.newHashMap();
+ List<HelixProperty.Stat> stats = accessor.getPropertyStats(cachedKeys);
+ for (int i = 0; i < cachedKeys.size(); i++) {
--- End diff --
deleted the node has been removed for previous preprocess. The cached key
will only retain the keys from reload keys from ZK.
---