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_r402652946
##########
File path: phoenix-pherf/src/it/java/org/apache/phoenix/pherf/PherfMainIT.java
##########
@@ -43,4 +64,83 @@ public void testPherfMain() throws Exception {
future.get();
}
}
+
+ @Test
+ public void testQueryTimeout() throws Exception {
+ // Timeout of 0 ms means every query execution should time out
+ String[] args = {"-q", "-l",
+ "-drop", "all",
+ "-schemaFile", ".*timeout_test_schema.sql",
+ "-scenarioFile", ".*timeout_test_scenario.xml" };
+ Pherf p = new Pherf(args);
+ p.run();
+
+ CSVFileResultHandler rh = new CSVFileResultHandler();
+ rh.setResultFileDetails(ResultFileDetails.CSV_DETAILED_PERFORMANCE);
+ rh.setResultFileName("COMBINED");
+ List<Result> resultList = rh.read();
+ for (Result r : resultList) {
+ HashMap<String, String> resultsMap = mapResults(r);
+ if (resultsMap.get("QUERY_ID").equals("q1")) {
+ assertEquals(resultsMap.get("TIMED_OUT"), "true");
+ }
+ }
+ }
+
+ @Test
+ public void testLargeQueryTimeout() throws Exception {
+ // Timeout of max_long ms means every query execution should time out
+ String[] args = {"-q", "-l",
+ "-drop", "all",
+ "-schemaFile", ".*timeout_test_schema.sql",
+ "-scenarioFile", ".*timeout_test_scenario.xml" };
+ Pherf p = new Pherf(args);
+ p.run();
+
+ CSVFileResultHandler rh = new CSVFileResultHandler();
+ rh.setResultFileDetails(ResultFileDetails.CSV_DETAILED_PERFORMANCE);
+ rh.setResultFileName("COMBINED");
+ List<Result> resultList = rh.read();
+ for (Result r : resultList) {
+ HashMap<String, String> resultsMap = mapResults(r);
+ if (resultsMap.get("QUERY_ID").equals("q2")) {
+ assertEquals(resultsMap.get("TIMED_OUT"), "false");
+ }
+ }
+ }
+
+ @Test
+ public void testNoQueryTimeout() throws Exception {
+ // Missing timeout attribute means every query execution should time
out
Review comment:
fix comment
----------------------------------------------------------------
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