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

yanxinyi pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 12f9f9e0701d5bf629ca278430a95838b22fcfba
Author: Xinyi Yan <[email protected]>
AuthorDate: Mon Sep 28 11:48:39 2020 -0700

    PHOENIX-6159 Phoenix-pherf writes the result file even disableRuntimeResult 
flag is true
    
    Signed-off-by: Xinyi Yan <[email protected]>
---
 .../phoenix/pherf/workload/MultiThreadedRunner.java    | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
index b4562e3..c4c38bd 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
@@ -57,7 +57,7 @@ class MultiThreadedRunner implements Callable<Void> {
     private final Scenario scenario;
     private final WorkloadExecutor workloadExecutor;
     private final XMLConfigParser parser;
-    
+    private final boolean writeRuntimeResults;
 
     /**
      * MultiThreadedRunner
@@ -83,6 +83,7 @@ class MultiThreadedRunner implements Callable<Void> {
                this.resultManager = new 
ResultManager(dataModelResult.getName(), writeRuntimeResults);
                this.workloadExecutor = workloadExecutor;
                this.parser = parser;
+               this.writeRuntimeResults = writeRuntimeResults;
     }
 
     /**
@@ -105,16 +106,25 @@ class MultiThreadedRunner implements Callable<Void> {
                 if (!timedQuery(i+1)) {
                     break;
                 }
-                if ((EnvironmentEdgeManager.currentTimeMillis() - 
lastResultWritten) > 1000) {
+                if (writeRuntimeResults &&
+                        (EnvironmentEdgeManager.currentTimeMillis() - 
lastResultWritten) > 1000) {
                     resultManager.write(dataModelResult, ruleApplier);
                     lastResultWritten = 
EnvironmentEdgeManager.currentTimeMillis();
                 }
             }
         }
 
+        if (!writeRuntimeResults) {
+            long duration = EnvironmentEdgeManager.currentTimeMillis() - 
threadStartTime;
+            LOGGER.info("The read query " + query.getStatement() + " for this 
thread in ("
+                    + duration + ") Ms");
+        }
+
         // Make sure all result have been dumped before exiting
-        synchronized (workloadExecutor) {
-            resultManager.flush();
+        if (writeRuntimeResults) {
+            synchronized (workloadExecutor) {
+                resultManager.flush();
+            }
         }
 
         LOGGER.info("\n\nThread exiting." + threadName + "\n\n");

Reply via email to