christinefeng commented on a change in pull request #749: PHOENIX-4521: Allow 
Pherf scenario to define per query max allowed query execution duration after 
which thread is interrupted
URL: https://github.com/apache/phoenix/pull/749#discussion_r404281150
 
 

 ##########
 File path: 
phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
 ##########
 @@ -148,34 +161,52 @@ private void timedQuery() throws Exception {
             boolean isQuery = statement.execute();
             if (isQuery) {
                 rs = statement.getResultSet();
-                while (rs.next()) {
-                    if (null != query.getExpectedAggregateRowCount()) {
-                        if (rs.getLong(1) != 
query.getExpectedAggregateRowCount())
-                            throw new RuntimeException(
-                                    "Aggregate count " + rs.getLong(1) + " 
does not match expected "
-                                            + 
query.getExpectedAggregateRowCount());
-                    }
-
-                    if (isSelectCountStatement) {
-                        resultRowCount = rs.getLong(1);
-                    } else {
-                        resultRowCount++;
-                    }
-                }
+                Pair<Long, Boolean> r = getResults(rs, queryIteration, 
isSelectCountStatement);
+                resultRowCount = r.getKey();
+                timedOut = r.getValue();
             } else {
                 conn.commit();
             }
         } catch (Exception e) {
-            LOGGER.error("Exception while executing query", e);
+            LOGGER.error("Exception while executing query " + queryIteration, 
e);
             exception = e.getMessage();
             throw e;
         } finally {
             getThreadTime().getRunTimesInMs().add(new RunTime(exception, 
startDate, resultRowCount,
-                    (int) (EnvironmentEdgeManager.currentTimeMillis() - 
start)));
+                    (int) (EnvironmentEdgeManager.currentTimeMillis() - 
start), timedOut));
 
 Review comment:
   The RunTime constructor actually takes an int argument for elapsedTimeinMs 
for some reason

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to