瀏覽代碼

HPCC-23882 Standalone roxie programs are defaulting to showing tracing

Also fixed config overriding of structured values.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 年之前
父節點
當前提交
1db5f69a93
共有 5 個文件被更改,包括 69 次插入34 次删除
  1. 2 0
      roxie/ccd/ccd.hpp
  2. 26 24
      roxie/ccd/ccdmain.cpp
  3. 24 1
      roxie/roxie/roxie.cpp
  4. 2 0
      system/jlib/jlog.cpp
  5. 15 9
      system/jlib/jptree.cpp

+ 2 - 0
roxie/ccd/ccd.hpp

@@ -699,4 +699,6 @@ public:
         aborted = true;
     }
 };
+
+extern int CCD_API roxie_main(int argc, const char *argv[], const char * defaultYaml);
 #endif

+ 26 - 24
roxie/ccd/ccdmain.cpp

@@ -524,30 +524,7 @@ void readStaticTopology()
     createStaticTopology(allRoles, traceLevel);
 }
 
-static constexpr const char * defaultYaml = R"!!(
-version: "1.0"
-roxie:
-  allFilesDynamic: true
-  localSlave: true
-  numChannels: 1
-  numServerThreads: 30
-  queueNames: roxie.roxie
-  serverPorts: "9876,0"
-  roxieMulticastEnabled: false
-  useAeron: false
-  RoxieFarmProcess:
-    - name: default
-      port: 9876
-      listenQueue: 200
-      numThreads: 0
-    - name: workunit
-      port: 0
-      numThreads: 0
-  logging:
-      detail: 100
-)!!";
-
-int STARTQUERY_API start_query(int argc, const char *argv[])
+int CCD_API roxie_main(int argc, const char *argv[], const char * defaultYaml)
 {
 #ifndef _CONTAINERIZED
     for (unsigned i=0;i<(unsigned)argc;i++) {
@@ -1411,3 +1388,28 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
 #endif
     return 0;
 }
+
+static constexpr const char * standaloneDefaultYaml = R"!!(
+version: "1.0"
+roxie:
+  allFilesDynamic: true
+  localSlave: true
+  numChannels: 1
+  numServerThreads: 30
+  queueNames: roxie.roxie
+  roxieMulticastEnabled: false
+  useAeron: false
+  RoxieFarmProcess:
+    - name: default
+      port: 9876
+      listenQueue: 200
+      numThreads: 0
+    - name: workunit
+      port: 0
+      numThreads: 0
+)!!";
+
+int STARTQUERY_API start_query(int argc, const char *argv[])
+{
+    return roxie_main(argc, argv, standaloneDefaultYaml);
+}

+ 24 - 1
roxie/roxie/roxie.cpp

@@ -44,6 +44,29 @@ static void roxie_server_usage()
     printf("\n");
 }
 
+static constexpr const char * defaultYaml = R"!!(
+version: "1.0"
+roxie:
+  allFilesDynamic: true
+  localSlave: true
+  numChannels: 1
+  numServerThreads: 30
+  queueNames: roxie.roxie
+  serverPorts: "9876,0"
+  roxieMulticastEnabled: false
+  useAeron: false
+  RoxieFarmProcess:
+    - name: default
+      port: 9876
+      listenQueue: 200
+      numThreads: 0
+    - name: workunit
+      port: 0
+      numThreads: 0
+  logging:
+      detail: 100
+)!!";
+
 int main(int argc, const char *argv[])
 {
     for (unsigned i=0; i<(unsigned)argc; i++)
@@ -55,5 +78,5 @@ int main(int argc, const char *argv[])
             return EXIT_SUCCESS;
         }
     }
-    return start_query(argc, argv);
+    return roxie_main(argc, argv, defaultYaml);
 }

+ 2 - 0
system/jlib/jlog.cpp

@@ -2390,6 +2390,8 @@ void setupContainerizedLogMsgHandler()
         if (logConfig->getPropBool(useSysLogpAtt, useSysLogDefault))
             UseSysLogForOperatorMessages();
     }
+    else
+        removeLog();
 }
 #endif
 

+ 15 - 9
system/jlib/jptree.cpp

@@ -7866,17 +7866,23 @@ static const char * extractOption(const char * option, const char * cur)
 
 static void applyCommandLineOption(IPropertyTree * config, const char * option, const char * value)
 {
-    if (islower(*option))
-    {
-        StringBuffer path;
-        path.append('@').append(option);
-        config->setProp(path, value);
-    }
-    else
+    const char *tail;
+    while ((tail = strchr(option, '.')) != nullptr)
     {
-        //MORE: Some magic syntax to select nested options and set them??
-        config->setProp(option, value);
+        StringAttr elemName(option, tail-option);
+        if (!config->hasProp(elemName))
+            config = config->addPropTree(elemName);
+        else
+        {
+            config = config->queryPropTree(elemName);
+            if (!config)
+                throw makeStringExceptionV(99, "Cannot overriding scalar configuration element %s with structure", elemName.get());
+        }
+        option = tail+1;
     }
+    StringBuffer path;
+    path.append('@').append(option);
+    config->setProp(path, value);
 }
 
 static void applyCommandLineOption(IPropertyTree * config, const char * option, std::initializer_list<const char *> ignoreOptions)