-
Notifications
You must be signed in to change notification settings - Fork 1k
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-6052 Include syscat time in mutation time #1546
Conversation
@virajjasani @tkhurana a draft PR for the fix. |
@mnpoonia would it make sense to introduce a separate metric to track the syscat time ? By clubbing the two metrics in one we will not know where we are spending time. |
@tkhurana i think it is upto us. Ultimately we care about how much time one mutation took. Now if we want to divide it in syscat and then htable.batch it is perfectly fine but not sure if we want to introduce a new metric. |
@tkhurana do you mind if we include syscat time in the mutation commit time in this jira and create a seperate jira to track syscat time seperately as well. |
I think this should be good. Thoughts @gjacoby126 @tkhurana? |
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
Outdated
Show resolved
Hide resolved
@mnpoonia You have changed the scope of this metric. Let us say you are batching 1000 upserts. Phoenix internally in the |
3ff36ac
to
32f7c2c
Compare
@tkhurana Thanks for pointing that out. I completely missed that part. Have reverted to old behaviour of mini batch mutation time. Also created a new metric for syscat time. Open for all suggestions to get it to closure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments. @mnpoonia
@@ -1198,6 +1199,7 @@ private void sendBatch(Map<TableRef, MultiRowMutationState> commitBatch, long[] | |||
Map<TableInfo, List<Mutation>> physicalTableMutationMap = Maps.newLinkedHashMap(); | |||
|
|||
// add tracing for this operation | |||
long startTime = EnvironmentEdgeManager.currentTimeMillis(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : the above L 1201 "add tracing" comment was for line L 1203 - maybe we can add your change just above that comment - to make the comment and code nearby as last time.
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
Outdated
Show resolved
Hide resolved
@@ -208,23 +209,23 @@ private MetricType(String shortName, String description, LogLevel logLevel, PDat | |||
public String description() { | |||
return description; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : there are various changes fixing the extra spaces not part of the change - should we skip this as part of this change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, good to keep only addition of MUTATION_SYSCAT_TIME
for this file and remove all other formatting changes.
@@ -1214,6 +1216,8 @@ private void sendBatch(Map<TableRef, MultiRowMutationState> commitBatch, long[] | |||
serverTimeStamps == null ? | |||
validateAndGetServerTimestamp(tableRef, multiRowMutationState) : | |||
serverTimeStamps[i++]; | |||
long syscatTime = EnvironmentEdgeManager.currentTimeMillis() - startTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mnpoonia This is not the only place where we call validateAndGetServerTimestamp. It is also called from here https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java#L895
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this is being called in a loop so you need to reset the value of startTime for every iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. instead of keeping the time here i pushed it down to the method validateAndGetServerTimestamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tkhurana Let me know if it looks good now.
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
Outdated
Show resolved
Hide resolved
} | ||
throw e; | ||
} finally { | ||
long endTime = EnvironmentEdgeManager.currentTimeMillis(); | ||
GLOBAL_MUTATION_SYSCAT_TIME.update(endTime - startTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good
@virajjasani @tkhurana I have addressed most of the review comments. Please have a look now. |
I think we should remove formatting changes from this PR, to have smooth backports (including internal forks) |
@@ -208,23 +209,23 @@ private MetricType(String shortName, String description, LogLevel logLevel, PDat | |||
public String description() { | |||
return description; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, good to keep only addition of MUTATION_SYSCAT_TIME
for this file and remove all other formatting changes.
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
Show resolved
Hide resolved
8761296
to
80063c4
Compare
80063c4
to
e16f4d6
Compare
@virajjasani I have removed all the whitespace and indentation changes. Please review now. |
PR for 5.1 branch |
No description provided.