Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/2148#discussion_r120131449
--- Diff: storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
---
@@ -299,6 +313,33 @@ public void doExecutorHeartbeats() {
}
}
+ public Map<String, Long> getCurrentBlobVersions() throws IOException {
+ Map<String, Long> results = new HashMap();
+ Map<String, Map<String, Object>> blobstoreMap = (Map<String,
Map<String, Object>>)
workerState.getTopologyConf().get(Config.TOPOLOGY_BLOBSTORE_MAP);
+ if (blobstoreMap != null) {
+ String stormRoot =
ConfigUtils.supervisorStormDistRoot(workerState.getTopologyConf(),
workerState.getTopologyId());
+ for (Map.Entry<String, Map<String, Object>> entry :
blobstoreMap.entrySet()) {
+ String keyName = entry.getKey();
+ String localFileName = keyName;
+ Map<String, Object> blobInfo = blobstoreMap.get(keyName);
+ if (blobInfo != null && blobInfo.containsKey("localname"))
{
+ localFileName = (String) blobInfo.get("localname");
+ }
+ String blobPath = new File(stormRoot,
localFileName).getCanonicalPath();
+ File versionFile = new
File(blobPath.replaceAll(".[0-9]+$", DEFAULT_BLOB_VERSION_SUFFIX));
+ results.put(localFileName,
Utils.getVersionFromBlobVersionFile(versionFile));
+ }
+ }
+ return results;
+ }
+
+ public void updateBlobUpdates() throws IOException {
+ Map<String, Long> latestBlobVersions = getCurrentBlobVersions();
+ workerState.blobToLastKnownVersion.putAll(latestBlobVersions);
--- End diff --
We need some kind of synchronization here. Perhaps we can just make
`blobToLastKnownVersion` a ConcurrentMap. That should be enough.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---