asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Blow (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: [NO ISSUE] Trace AsterixHyracksIntegrationUtil to console; f...
Date Mon, 05 Feb 2018 21:56:56 GMT
Michael Blow has submitted this change and it was merged.

Change subject: [NO ISSUE] Trace AsterixHyracksIntegrationUtil to console; fix NC effective
map precedence
......................................................................


[NO ISSUE] Trace AsterixHyracksIntegrationUtil to console; fix NC effective map precedence

Change-Id: Ied091c2ab17f631df84eab40143180b3a9be09ed
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2363
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
---
M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
M hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
3 files changed, 41 insertions(+), 11 deletions(-)

Approvals:
  Jenkins: Verified
  Murtadha Hubail: Looks good to me, approved

Objections:
  Anon. E. Moose #1000171: Violations found
  Jenkins: Violations found



diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index ae82ea7..ee96d00 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -55,6 +55,7 @@
 import org.apache.hyracks.control.common.controllers.ControllerConfig;
 import org.apache.hyracks.control.common.controllers.NCConfig;
 import org.apache.hyracks.control.nc.NodeControllerService;
+import org.apache.hyracks.test.support.TestUtils;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -97,12 +98,13 @@
      * @param args unused
      */
     public static void main(String[] args) throws Exception {
+        TestUtils.redirectLoggingToConsole();
         AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil();
         try {
             integrationUtil.run(Boolean.getBoolean("cleanup.start"), Boolean.getBoolean("cleanup.shutdown"),
                     System.getProperty("external.lib", ""), System.getProperty("conf.path",
DEFAULT_CONF_FILE));
         } catch (Exception e) {
-            LOGGER.log(Level.WARN, "Unexpected exception", e);
+            LOGGER.fatal("Unexpected exception", e);
             System.exit(1);
         }
     }
@@ -125,7 +127,7 @@
         }
         final List<NodeControllerService> nodeControllers = new ArrayList<>();
         for (String nodeId : nodeNames) {
-            // mark this NC as virtual in the CC's config manager, so he doesn't try to contact
NCService...
+            // mark this NC as virtual, so that the CC doesn't try to start via NCService...
             configManager.set(nodeId, NCConfig.Option.NCSERVICE_PORT, NCConfig.NCSERVICE_PORT_DISABLED);
             final INCApplication ncApplication = createNCApplication();
             ConfigManager ncConfigManager;
@@ -363,7 +365,8 @@
     private static Path getProjectPath() {
         final String targetDir = "asterix-app";
         final BiPredicate<Path, BasicFileAttributes> matcher =
-                (path, attributes) -> path.getFileName().toString().equals(targetDir)
&& path.toFile().isDirectory();
+                (path, attributes) -> path.getFileName().toString().equals(targetDir)
&& path.toFile().isDirectory()
+                        && path.toFile().list((d, n) -> n.equals("pom.xml")).length
== 1;
         final Path currentPath = Paths.get(System.getProperty("user.dir"));
         try (Stream<Path> pathStream = Files.find(currentPath, 10, matcher)) {
             return pathStream.findFirst().orElse(currentPath);
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
index fd8c116..baff800 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
@@ -454,12 +454,10 @@
 
     private Map<IOption, Object> getNodeEffectiveMap(String nodeId) {
         ensureNode(nodeId);
-        CompositeMap<IOption, Object> nodeEffectiveMap = new CompositeMap<>();
-        nodeEffectiveMap.setMutator(new NoOpMapMutator());
-        nodeEffectiveMap.addComposited(nodeSpecificDefinedMap.get(nodeId));
-        nodeEffectiveMap.addComposited(nodeSpecificDefaultMap.get(nodeId));
-        nodeEffectiveMap.addComposited(definedMap);
-        return nodeEffectiveMap;
+        return new CompositeMap<>(
+                Stream.of(nodeSpecificDefinedMap.get(nodeId), nodeSpecificDefaultMap.get(nodeId),
definedMap)
+                        .toArray(Map[]::new),
+                new NoOpMapMutator());
     }
 
     public Ini toIni(boolean includeDefaults) {
@@ -570,8 +568,9 @@
         }
 
         @Override
-        public void resolveCollision(CompositeMap<IOption, Object> compositeMap, Map<IOption,
Object> map,
-                Map<IOption, Object> map1, Collection<IOption> collection) {
+        public void resolveCollision(CompositeMap<IOption, Object> composite, Map<IOption,
Object> existing,
+                Map<IOption, Object> added, Collection<IOption> intersect) {
+            LOGGER.debug("resolveCollision: {}, {}, {}, {}", composite, existing, added,
intersect);
             // no-op
         }
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
index 1814e85..d7578af 100644
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.Executors;
 
 import org.apache.hyracks.api.application.INCServiceContext;
@@ -41,6 +42,10 @@
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.nc.io.DefaultDeviceResolver;
 import org.apache.hyracks.control.nc.io.IOManager;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.ConsoleAppender;
+import org.apache.logging.log4j.core.config.Configuration;
 
 public class TestUtils {
     public static IHyracksTaskContext create(int frameSize) {
@@ -140,4 +145,27 @@
         }
         return ncNameToNcInfos;
     }
+
+    public static void redirectLoggingToConsole() {
+        final LoggerContext context = LoggerContext.getContext(false);
+        final Configuration config = context.getConfiguration();
+
+        Appender appender = config.getAppender("Console");
+        if (appender == null) {
+            Optional<Appender> result =
+                    config.getAppenders().values().stream().filter(a -> a instanceof ConsoleAppender).findFirst();
+            if (!result.isPresent()) {
+                System.err.println(
+                        "ERROR: cannot find appender named 'Console'; unable to find alternate
ConsoleAppender!");
+            } else {
+                appender = result.get();
+                System.err.println("ERROR: cannot find appender named 'Console'; using alternate
ConsoleAppender named "
+                        + appender.getName());
+            }
+        }
+        if (appender != null) {
+            config.getRootLogger().addAppender(appender, null, null);
+            context.updateLoggers();
+        }
+    }
 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2363
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ied091c2ab17f631df84eab40143180b3a9be09ed
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Murtadha Hubail <mhubail@apache.org>

Mime
View raw message