You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ag...@apache.org on 2022/03/30 20:21:08 UTC

[storm] branch master updated: STORM-3838 prevent topology from setting storm.workers.artifacts.dir (#3459)

This is an automated email from the ASF dual-hosted git repository.

agresch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 87efcea  STORM-3838 prevent topology from setting storm.workers.artifacts.dir (#3459)
87efcea is described below

commit 87efcea9d74e26e7e8879eed4d200871cf13db3e
Author: Aaron Gresch <ag...@gmail.com>
AuthorDate: Wed Mar 30 15:20:59 2022 -0500

    STORM-3838 prevent topology from setting storm.workers.artifacts.dir (#3459)
    
    * STORM-3838 prevent topology from setting storm.workers.artifacts.dir
---
 .../java/org/apache/storm/daemon/nimbus/Nimbus.java     |  6 +++++-
 .../java/org/apache/storm/daemon/nimbus/NimbusTest.java | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
index f95c5ff..a37d4c1 100644
--- a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
+++ b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
@@ -1132,7 +1132,11 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
      * @param topoConf initial topology conf
      * @param topology  the Storm topology
      */
-    private static Map<String, Object> normalizeConf(Map<String, Object> conf, Map<String, Object> topoConf, StormTopology topology) {
+    static Map<String, Object> normalizeConf(Map<String, Object> conf, Map<String, Object> topoConf, StormTopology topology) {
+
+        // clear any values from the topoConf that it should not be setting.
+        topoConf.remove(Config.STORM_WORKERS_ARTIFACTS_DIR);
+
         //ensure that serializations are same for all tasks no matter what's on
         // the supervisors. this also allows you to declare the serializations as a sequence
         List<Map<String, Object>> allConfs = new ArrayList<>();
diff --git a/storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusTest.java b/storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusTest.java
index 8f5d4fd..42c8847 100644
--- a/storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusTest.java
+++ b/storm-server/src/test/java/org/apache/storm/daemon/nimbus/NimbusTest.java
@@ -88,4 +88,21 @@ public class NimbusTest {
 
         }
     }
+
+    @Test
+    public void validateNoTopoConfOverrides() {
+        StormTopology topology = new StormTopology();
+        topology.set_spouts(new HashMap<>());
+        topology.set_bolts(new HashMap<>());
+        topology.set_state_spouts(new HashMap<>());
+
+        Map<String, Object> conf = new HashMap<>();
+        conf.put(Config.STORM_MESSAGING_NETTY_AUTHENTICATION, false);
+
+        conf.put(Config.STORM_WORKERS_ARTIFACTS_DIR, "a");
+        Map<String, Object> topoConf = new HashMap<>();
+        topoConf.put(Config.STORM_WORKERS_ARTIFACTS_DIR, "b");
+        Map<String, Object> normalized = Nimbus.normalizeConf(conf, topoConf, topology);
+        Assert.assertNull(normalized.get(Config.STORM_WORKERS_ARTIFACTS_DIR));
+    }
 }