Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-7528 Add metrics for overall wall clock query wait time in Phoenix client thread pool and total time spent in executing HBase scan tasks #2077

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sanjeet006py
Copy link
Contributor

Summary of the change:

  • Introducing two new metrics for tracking wall clock wait time of a query in Phoenix client thread pool and wall clock time spent in executing HBase scan tasks in Phoenix client thread pool.
  • Also, made the change to use JobCallable in RoundRobinResultItr. when submitting next batches of scans as scanner cache of previous batches of scan has been exhausted. By using JobCallable we can track total wall clock time spent by a query waiting in Phoenix client thread pool queue along with total wall clock time spent in executing tasks (end to end).

long vpk3 = 1000;
try(Connection conn = DriverManager.getConnection(getUrl())) {
PreparedStatement stmt = conn.prepareStatement(upsertRows);
stmt.execute(creatTableDdl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a slightly weird pattern. Creating a table with a PreparedStatement for upsert rows. Generally, we just do conn.createStatement().execute(ddl)

SecurityException, IllegalArgumentException, IllegalAccessException {
private void changeInternalStateForTesting(PhoenixResultSet rs,
ReadMetricQueue testMetricsQueue) throws
NoSuchFieldException, SecurityException, IllegalArgumentException,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just change it to throws Exception

@@ -1298,5 +1301,225 @@ public Connection call() throws Exception {
}
}

@Test
public void testPhoenixClientQueueWaitTimeAndEndToEndTime() throws SQLException,
NoSuchFieldException,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just change it to throws Exception

}
getRows += ")";
final String upsertRows = "UPSERT INTO " + tableName + " VALUES(?, ?, ?, ?, ?, ?)";
String creatTableDdl = "CREATE TABLE IF NOT EXISTS " + tableName + " (\n" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we put the table schema first and then the upsert statements and the select statements. This makes it easy to understand the code.

Comment on lines +1475 to +1476
int[] taskQueueWaitTime = {10, 5, 20, 7};
int[] taskEndToEndTime = {20, 15, 41, 16};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass these as parameters in the constructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants