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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4742f32b25 [ASTERIXDB-3278][API] Add buffercache hit ratio to metrics
     new 6295e2a949 Merge branch 'trinity' into 'master'
4742f32b25 is described below

commit 4742f32b2574f72a99137fbc85b36cdf2cea0324
Author: Ian Maxon <ian@maxons.email>
AuthorDate: Sun Nov 12 20:40:35 2023 -0800

    [ASTERIXDB-3278][API] Add buffercache hit ratio to metrics
    
    - user model changes: yes
    - storage format changes: no
    - interface changes: no
    
    Details:
    Move the buffercache hit ratio information to the metrics and
    always collect it, not just when profiling
    
    Change-Id: I568a2df4594bdde19932ba72362c9c61a96a9182
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17858
    Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Ian Maxon <ima...@uci.edu>
    Reviewed-by: Wail Alkowaileet <wael....@gmail.com>
---
 .../asterix/translator/IStatementExecutor.java       | 11 ++++++++++-
 .../apache/asterix/translator/ResultMetadata.java    | 13 +++++++++++--
 .../api/http/server/NCQueryServiceServlet.java       |  1 +
 .../api/http/server/QueryResultApiServlet.java       |  3 ++-
 .../asterix/api/http/server/QueryServiceServlet.java |  7 ++++---
 .../apache/asterix/app/result/JobResultCallback.java |  5 +++++
 .../apache/asterix/app/result/ResponseMetrics.java   |  9 ++++++++-
 .../asterix/app/result/fields/MetricsPrinter.java    | 12 ++++++++++--
 .../asterix/app/translator/QueryTranslator.java      |  1 +
 .../cache-residency/cache-residency.001.post.http    | 20 ++++++++++++++++++++
 .../cache-residency/cache-residency.002.post.http    | 20 ++++++++++++++++++++
 .../cache-residency/cache-residency.001.regexjson    | 19 +++++++++++++++++++
 .../cache-residency/cache-residency.002.regexjson    | 20 ++++++++++++++++++++
 .../request-param-validation-400-BAD.01.regexjson    |  1 +
 .../warnings-limit/warnings-limit.06.regexadm        |  1 +
 .../src/test/resources/runtimets/testsuite_sqlpp.xml |  5 +++++
 .../control/common/job/profiling/StatsCollector.java |  3 ++-
 .../java/org/apache/hyracks/control/nc/Task.java     | 10 ----------
 18 files changed, 140 insertions(+), 21 deletions(-)

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
index e10046e55f..93f5990845 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
@@ -106,7 +106,7 @@ public interface IStatementExecutor {
     }
 
     class Stats implements Serializable {
-        private static final long serialVersionUID = 5885273238208454611L;
+        private static final long serialVersionUID = 5885273238208454612L;
 
         public enum ProfileType {
             COUNTS("counts"),
@@ -138,6 +138,7 @@ public interface IStatementExecutor {
         private ProfileType profileType;
         private long totalWarningsCount;
         private long compileTime;
+        private double bufferCacheHitRatio;
 
         public long getCount() {
             return count;
@@ -204,6 +205,14 @@ public interface IStatementExecutor {
         public long getCompileTime() {
             return compileTime;
         }
+
+        public void setBufferCacheHitRatio(double bufferCacheHitRatio) {
+            this.bufferCacheHitRatio = bufferCacheHitRatio;
+        }
+
+        public double getBufferCacheHitRatio() {
+            return bufferCacheHitRatio;
+        }
     }
 
     class Profile implements Serializable {
diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java
index 60f4939a43..f47fce12f5 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ResultMetadata.java
@@ -27,13 +27,14 @@ import org.apache.hyracks.api.result.IResultMetadata;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ResultMetadata implements IResultMetadata {
-    private static final long serialVersionUID = 1905367559307369034L;
+    private static final long serialVersionUID = 1905367559307369035L;
 
     private final SessionConfig.OutputFormat format;
     private long jobDuration;
     private long processedObjects;
-    private ObjectNode profile;
     private long diskIoCount;
+    private double bufferCacheHitRatio;
+    private ObjectNode profile;
     private Set<Warning> warnings;
     private long totalWarningsCount;
     private transient List<Object> outputTypes;
@@ -59,6 +60,14 @@ public class ResultMetadata implements IResultMetadata {
         this.jobDuration = jobDuration;
     }
 
+    public void setBufferCacheHitRatio(double bufferCacheHitRatio) {
+        this.bufferCacheHitRatio = bufferCacheHitRatio;
+    }
+
+    public double getBufferCacheHitRatio() {
+        return bufferCacheHitRatio;
+    }
+
     public void setWarnings(Set<Warning> warnings) {
         this.warnings = warnings;
     }
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
index cb5a3a5fae..a5e13c1f2e 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/NCQueryServiceServlet.java
@@ -207,6 +207,7 @@ public class NCQueryServiceServlet extends 
QueryServiceServlet {
         stats.updateTotalWarningsCount(responseStats.getTotalWarningsCount());
         stats.setCompileTime(responseStats.getCompileTime());
         stats.setQueueWaitTime(responseStats.getQueueWaitTime());
+        stats.setBufferCacheHitRatio(responseStats.getBufferCacheHitRatio());
     }
 
     private static void 
updatePropertiesFromCC(IStatementExecutor.StatementProperties 
statementProperties,
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryResultApiServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryResultApiServlet.java
index 680feeb178..ad2a5b5fd5 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryResultApiServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryResultApiServlet.java
@@ -102,7 +102,8 @@ public class QueryResultApiServlet extends 
AbstractQueryApiServlet {
                 printer.printResults();
                 ResponseMetrics metrics = ResponseMetrics.of(System.nanoTime() 
- elapsedStart,
                         metadata.getJobDuration(), stats.getCount(), 
stats.getSize(), metadata.getProcessedObjects(), 0,
-                        metadata.getTotalWarningsCount(), 
stats.getCompileTime(), stats.getQueueWaitTime());
+                        metadata.getTotalWarningsCount(), 
stats.getCompileTime(), stats.getQueueWaitTime(),
+                        stats.getBufferCacheHitRatio());
                 printer.addFooterPrinter(new MetricsPrinter(metrics, 
HttpUtil.getPreferredCharset(request)));
                 if (metadata.getJobProfile() != null) {
                     printer.addFooterPrinter(new 
ProfilePrinter(metadata.getJobProfile()));
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
index 6678c52851..f28579d188 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceServlet.java
@@ -357,9 +357,10 @@ public class QueryServiceServlet extends 
AbstractQueryApiServlet {
             // in case of ASYNC delivery, the status is printed by query 
translator
             responsePrinter.addFooterPrinter(new 
StatusPrinter(executionState.getResultStatus()));
         }
-        final ResponseMetrics metrics = ResponseMetrics.of(System.nanoTime() - 
elapsedStart, executionState.duration(),
-                stats.getCount(), stats.getSize(), 
stats.getProcessedObjects(), errorCount,
-                stats.getTotalWarningsCount(), stats.getCompileTime(), 
stats.getQueueWaitTime());
+        final ResponseMetrics metrics =
+                ResponseMetrics.of(System.nanoTime() - elapsedStart, 
executionState.duration(), stats.getCount(),
+                        stats.getSize(), stats.getProcessedObjects(), 
errorCount, stats.getTotalWarningsCount(),
+                        stats.getCompileTime(), stats.getQueueWaitTime(), 
stats.getBufferCacheHitRatio());
         responsePrinter.addFooterPrinter(new MetricsPrinter(metrics, 
resultCharset));
         if (isPrintingProfile(stats)) {
             responsePrinter.addFooterPrinter(new 
ProfilePrinter(stats.getJobProfile()));
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java
index ebf169fc65..d1a1008f05 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/JobResultCallback.java
@@ -71,6 +71,8 @@ public class JobResultCallback implements IJobResultCallback {
     private void aggregateJobStats(JobId jobId, ResultMetadata metadata) {
         long processedObjects = 0;
         long aggregateTotalWarningsCount = 0;
+        long pagesRead = 0;
+        long nonPagedReads = 0;
         Set<Warning> AggregateWarnings = new HashSet<>();
         IJobManager jobManager =
                 ((ClusterControllerService) 
appCtx.getServiceContext().getControllerService()).getJobManager();
@@ -83,6 +85,8 @@ public class JobResultCallback implements IJobResultCallback {
                 final Collection<TaskProfile> jobletTasksProfile = 
jp.getTaskProfiles().values();
                 for (TaskProfile tp : jobletTasksProfile) {
                     processedObjects += 
tp.getStatsCollector().getAggregatedStats().getInputTupleCounter().get();
+                    pagesRead += 
tp.getStatsCollector().getAggregatedStats().getPageReads().get();
+                    nonPagedReads += 
tp.getStatsCollector().getAggregatedStats().coldReadCounter().get();
                     aggregateTotalWarningsCount += tp.getTotalWarningsCount();
                     Set<Warning> taskWarnings = tp.getWarnings();
                     if (AggregateWarnings.size() < maxWarnings && 
!taskWarnings.isEmpty()) {
@@ -96,6 +100,7 @@ public class JobResultCallback implements IJobResultCallback 
{
             
metadata.setQueueWaitTimeInNanos(run.getJobProfile().getQueueWaitTimeInNanos());
         }
         metadata.setProcessedObjects(processedObjects);
+        metadata.setBufferCacheHitRatio(pagesRead > 0 ? (pagesRead - 
nonPagedReads) / pagesRead : Double.NaN);
         metadata.setWarnings(AggregateWarnings);
         metadata.setTotalWarningsCount(aggregateTotalWarningsCount);
         if (run != null && run.getFlags() != null && 
run.getFlags().contains(JobFlag.PROFILE_RUNTIME)) {
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResponseMetrics.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResponseMetrics.java
index 08e7702429..5f709375fd 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResponseMetrics.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResponseMetrics.java
@@ -30,12 +30,14 @@ public class ResponseMetrics {
     private long diskIoCount;
     private long compileTime;
     private long queueWaitTime;
+    private double bufferCacheHitRatio;
 
     private ResponseMetrics() {
     }
 
     public static ResponseMetrics of(long elapsedTime, long executionTime, 
long resultCount, long resultSize,
-            long processedObjects, long errorCount, long warnCount, long 
compileTime, long queueWaitTime) {
+            long processedObjects, long errorCount, long warnCount, long 
compileTime, long queueWaitTime,
+            double bufferCacheHitRatio) {
         ResponseMetrics metrics = new ResponseMetrics();
         metrics.elapsedTime = elapsedTime;
         metrics.executionTime = executionTime;
@@ -46,6 +48,7 @@ public class ResponseMetrics {
         metrics.warnCount = warnCount;
         metrics.compileTime = compileTime;
         metrics.queueWaitTime = queueWaitTime;
+        metrics.bufferCacheHitRatio = bufferCacheHitRatio;
         return metrics;
     }
 
@@ -84,4 +87,8 @@ public class ResponseMetrics {
     public long getQueueWaitTime() {
         return queueWaitTime;
     }
+
+    public double getBufferCacheHitRatio() {
+        return bufferCacheHitRatio;
+    }
 }
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/MetricsPrinter.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/MetricsPrinter.java
index e001d296ba..93fb6d4b86 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/MetricsPrinter.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/fields/MetricsPrinter.java
@@ -38,7 +38,8 @@ public class MetricsPrinter implements IResponseFieldPrinter {
         RESULT_SIZE("resultSize"),
         ERROR_COUNT("errorCount"),
         PROCESSED_OBJECTS_COUNT("processedObjects"),
-        WARNING_COUNT("warningCount");
+        WARNING_COUNT("warningCount"),
+        BUFFERCACHE_HIT_RATIO("bufferCacheHitRatio");
 
         private final String str;
 
@@ -84,9 +85,16 @@ public class MetricsPrinter implements IResponseFieldPrinter 
{
         pw.print("\n\t");
         final boolean hasErrors = metrics.getErrorCount() > 0;
         final boolean hasWarnings = metrics.getWarnCount() > 0;
+        final boolean usedCache = 
!(Double.isNaN(metrics.getBufferCacheHitRatio()));
         ResultUtil.printField(pw, Metrics.PROCESSED_OBJECTS_COUNT.str(), 
metrics.getProcessedObjects(),
-                hasWarnings || hasErrors);
+                usedCache || hasWarnings || hasErrors);
         pw.print("\n");
+        if (usedCache) {
+            pw.print("\t");
+            String pctValue = String.format("%.2f%%", 
metrics.getBufferCacheHitRatio() * 100);
+            ResultUtil.printField(pw, Metrics.BUFFERCACHE_HIT_RATIO.str(), 
pctValue, hasWarnings || hasErrors);
+            pw.print("\n");
+        }
         if (hasWarnings) {
             pw.print("\t");
             ResultUtil.printField(pw, Metrics.WARNING_COUNT.str(), 
metrics.getWarnCount(), hasErrors);
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index d8b5d846cb..8b635a2b22 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -4779,6 +4779,7 @@ public class QueryTranslator extends 
AbstractLangTranslator implements IStatemen
                         .getResultMetadata(jobId, rsId);
         stats.setProcessedObjects(resultMetadata.getProcessedObjects());
         stats.setQueueWaitTime(resultMetadata.getQueueWaitTimeInNanos());
+        stats.setBufferCacheHitRatio(resultMetadata.getBufferCacheHitRatio());
         if (jobFlags.contains(JobFlag.PROFILE_RUNTIME)) {
             stats.setJobProfile(resultMetadata.getJobProfile());
             
apiFramework.generateOptimizedLogicalPlanWithProfile(resultMetadata.getJobProfile());
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.001.post.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.001.post.http
new file mode 100644
index 0000000000..0edc12a570
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.001.post.http
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/query/service
+--body={"statement": "from [1, 2] as v select v;"}
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.002.post.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.002.post.http
new file mode 100644
index 0000000000..9bf09363b6
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/cache-residency/cache-residency.002.post.http
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/query/service
+--body={"statement": "SELECT COUNT(*) FROM Metadata.`Dataset`"}
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.001.regexjson
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.001.regexjson
new file mode 100644
index 0000000000..173a9a50c8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.001.regexjson
@@ -0,0 +1,19 @@
+{
+       "requestID": "R{.*}",
+       "signature": {
+               "*": "*"
+       },
+       "type": "application/x-adm",
+       "results": [ "{ \"v\": 1 }\n", "{ \"v\": 2 }\n" ],
+       "plans": "R{.*}",
+       "status": "success",
+       "metrics": {
+               "elapsedTime": "R{.*}",
+               "executionTime": "R{.*}",
+               "compileTime": "R{.*}",
+               "queueWaitTime": "R{.*}",
+               "resultCount": 2,
+               "resultSize": 32,
+               "processedObjects": 0
+       }
+}
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.002.regexjson
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.002.regexjson
new file mode 100644
index 0000000000..8f5cf761e1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cache-residency/cache-residency.002.regexjson
@@ -0,0 +1,20 @@
+{
+       "requestID": "R{.*}",
+       "signature": {
+               "*": "*"
+       },
+       "type": "application/x-adm",
+       "results": [ "{ \"$1\": 17 }\n" ],
+       "plans": "R{.*}",
+       "status": "success",
+       "metrics": {
+               "elapsedTime": "R{.*}",
+               "executionTime": "R{.*}",
+               "compileTime": "R{.*}",
+               "queueWaitTime": "R{.*}",
+               "resultCount": 1,
+               "resultSize": 18,
+               "processedObjects": 17,
+               "bufferCacheHitRatio": "100.00%"
+       }
+}
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param-validation-400-BAD/request-param-validation-400-BAD.01.regexjson
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param-validation-400-BAD/request-param-validation-400-BAD.01.regexjson
index bd58b527ca..823515ba08 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param-validation-400-BAD/request-param-validation-400-BAD.01.regexjson
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param-validation-400-BAD/request-param-validation-400-BAD.01.regexjson
@@ -11,6 +11,7 @@
                "resultCount": 0,
                "resultSize": 0,
                "processedObjects": 0,
+               "bufferCacheHitRatio": "0.00%",
                "errorCount": 1
        }
 }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/warnings/warnings-limit/warnings-limit.06.regexadm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/warnings/warnings-limit/warnings-limit.06.regexadm
index 7b689f64bd..39fdb09f4e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/warnings/warnings-limit/warnings-limit.06.regexadm
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/warnings/warnings-limit/warnings-limit.06.regexadm
@@ -17,6 +17,7 @@
 \s*\Q"resultCount": \E[0-9]+\Q,\E
 \s*\Q"resultSize": \E[0-9]+\Q,\E
 \s*\Q"processedObjects": \E[0-9]+\Q,\E
+\s*\Q"bufferCacheHitRatio": "\E[^"]+\Q",\E
 \s*\Q"warningCount": 2\E
 \s*\Q}\E
 \s*\Q}\E\s*
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 81f40c7233..4bc82f4679 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -100,6 +100,11 @@
         <output-dir 
compare="Text">request-param-validation-400-BAD</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="api">
+      <compilation-unit name="cache-residency">
+        <output-dir compare="Text">cache-residency</output-dir>
+      </compilation-unit>
+    </test-case>
     <test-case FilePath="api">
       <compilation-unit name="request-param">
         <output-dir compare="Text">request-param</output-dir>
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/StatsCollector.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/StatsCollector.java
index 76c8017e95..26c664a444 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/StatsCollector.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/StatsCollector.java
@@ -31,7 +31,7 @@ import org.apache.hyracks.api.job.profiling.NoOpOperatorStats;
 import org.apache.hyracks.api.job.profiling.OperatorStats;
 
 public class StatsCollector implements IStatsCollector {
-    private static final long serialVersionUID = 6858817639895434573L;
+    private static final long serialVersionUID = 6858817639895434574L;
 
     private final Map<String, IOperatorStats> operatorStatsMap = new 
LinkedHashMap<>();
 
@@ -66,6 +66,7 @@ public class StatsCollector implements IStatsCollector {
             
aggregatedStats.getInputTupleCounter().update(stats.getInputTupleCounter().get());
             
aggregatedStats.getTimeCounter().update(stats.getTimeCounter().get());
             aggregatedStats.getPageReads().update(stats.getPageReads().get());
+            
aggregatedStats.coldReadCounter().update(stats.coldReadCounter().get());
         }
         return aggregatedStats;
     }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
index 900ac7e58c..0c5c23329f 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
@@ -515,9 +515,6 @@ public class Task implements IHyracksTaskContext, 
ICounterContext, Runnable {
 
     @Override
     public synchronized void subscribeThreadToStats(IThreadStatsCollector 
threadStatsCollector) {
-        if (!isRuntimeProfilingEnabled()) {
-            return;
-        }
         synchronized (threadStatsCollectors) {
             threadStatsCollectors.add(threadStatsCollector);
             final long threadId = Thread.currentThread().getId();
@@ -528,9 +525,6 @@ public class Task implements IHyracksTaskContext, 
ICounterContext, Runnable {
 
     @Override
     public synchronized void unsubscribeThreadFromStats() {
-        if (!isRuntimeProfilingEnabled()) {
-            return;
-        }
         synchronized (threadStatsCollectors) {
             threadStatsCollectors.forEach(IThreadStatsCollector::unsubscribe);
         }
@@ -572,8 +566,4 @@ public class Task implements IHyracksTaskContext, 
ICounterContext, Runnable {
         return "{ \"class\" : \"" + getClass().getSimpleName() + "\", \"node\" 
: \"" + ncs.getId() + "\" \"jobId\" : \""
                 + joblet.getJobId() + "\", \"taskId\" : \"" + taskAttemptId + 
"\" }";
     }
-
-    private boolean isRuntimeProfilingEnabled() {
-        return getJobFlags().contains(JobFlag.PROFILE_RUNTIME);
-    }
 }

Reply via email to