ChinmaySKulkarni 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_r403197300
##########
File path:
phoenix-pherf/src/main/java/org/apache/phoenix/pherf/workload/MultiThreadedRunner.java
##########
@@ -88,13 +90,21 @@
*/
@Override
public Void call() throws Exception {
- LOGGER.info("\n\nThread Starting " + threadName + " ; " +
query.getStatement() + " for "
- + numberOfExecutions + "times\n\n");
+ LOGGER.info("\n\nThread Starting " + threadName + " ; '" +
query.getStatement() + "' for "
+ + numberOfExecutions + " times\n\n");
Long start = EnvironmentEdgeManager.currentTimeMillis();
- for (long i = numberOfExecutions; (i > 0 &&
((EnvironmentEdgeManager.currentTimeMillis() - start)
- < executionDurationInMs)); i--) {
+ for (long i = 0; i < numberOfExecutions; i++) {
+
+ if ((EnvironmentEdgeManager.currentTimeMillis() - start) >=
executionDurationInMs) {
Review comment:
Again here we should be calling `EnvironmentEdgeManager.currentTimeMillis()
- start` once only, otherwise you're checking one thing and logging something
slightly different. Maybe just do:
```java
long timeElapsed = EnvironmentEdgeManager.currentTimeMillis() - start
```
and use `timeElapsed` for both the if condition check and the log line
----------------------------------------------------------------
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