You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/07/01 16:11:40 UTC
[GitHub] [hive] belugabehr opened a new pull request #1197: HIVE-23793: Review of QueryInfo Class
belugabehr opened a new pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] dengzhhu653 commented on pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on pull request #1197:
URL: https://github.com/apache/hive/pull/1197#issuecomment-658787201
OK, changes look to me
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] dengzhhu653 commented on a change in pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on a change in pull request #1197:
URL: https://github.com/apache/hive/pull/1197#discussion_r454735696
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/QueryInfo.java
##########
@@ -70,36 +80,57 @@ public String getExecutionEngine() {
return executionEngine;
}
- public synchronized String getState() {
+ public String getState() {
return state;
}
+ /**
+ * The time the query began in milliseconds.
+ *
+ * @return The time the query began
+ */
public long getBeginTime() {
- return beginTime;
+ return TimeUnit.NANOSECONDS.toMillis(beginTime);
}
- public synchronized Long getEndTime() {
- return endTime;
+ /**
+ * Get the end time in milliseconds. Only valid if {@link #isRunning()}
+ * returns false.
+ *
+ * @return Query end time
+ */
+ public long getEndTime() {
+ return TimeUnit.NANOSECONDS.toMillis(endTime);
}
- public synchronized void updateState(String state) {
+ public void updateState(String state) {
this.state = state;
}
public String getOperationId() {
return operationId;
}
- public synchronized void setEndTime() {
- this.endTime = System.currentTimeMillis();
+ public void setEndTime() {
+ this.endTime = System.nanoTime();
}
- public synchronized void setRuntime(long runtime) {
- this.runtime = runtime;
+ /**
+ * Set the amount of time the query spent actually running in milliseconds.
+ *
+ * @param runtime The amount of time this query spent running
+ */
+ public void setRuntime(long runtime) {
+ this.runtime = TimeUnit.MILLISECONDS.toNanos(runtime);
Review comment:
the ```getRuntime``` returns value in milliseconds, maybe there is no need to transfer the ```runtime``` back and forth?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] github-actions[bot] closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr commented on a change in pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1197:
URL: https://github.com/apache/hive/pull/1197#discussion_r455070373
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/QueryInfo.java
##########
@@ -70,36 +80,57 @@ public String getExecutionEngine() {
return executionEngine;
}
- public synchronized String getState() {
+ public String getState() {
return state;
}
+ /**
+ * The time the query began in milliseconds.
+ *
+ * @return The time the query began
+ */
public long getBeginTime() {
- return beginTime;
+ return TimeUnit.NANOSECONDS.toMillis(beginTime);
}
- public synchronized Long getEndTime() {
- return endTime;
+ /**
+ * Get the end time in milliseconds. Only valid if {@link #isRunning()}
+ * returns false.
+ *
+ * @return Query end time
+ */
+ public long getEndTime() {
+ return TimeUnit.NANOSECONDS.toMillis(endTime);
}
- public synchronized void updateState(String state) {
+ public void updateState(String state) {
this.state = state;
}
public String getOperationId() {
return operationId;
}
- public synchronized void setEndTime() {
- this.endTime = System.currentTimeMillis();
+ public void setEndTime() {
+ this.endTime = System.nanoTime();
}
- public synchronized void setRuntime(long runtime) {
- this.runtime = runtime;
+ /**
+ * Set the amount of time the query spent actually running in milliseconds.
+ *
+ * @param runtime The amount of time this query spent running
+ */
+ public void setRuntime(long runtime) {
+ this.runtime = TimeUnit.MILLISECONDS.toNanos(runtime);
Review comment:
For simplicity sake, I wanted to keep all of the internal time values the same precision (nano):
```
/*
* Times are stored internally with nanosecond precision.
*/
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] github-actions[bot] commented on pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #1197:
URL: https://github.com/apache/hive/pull/1197#issuecomment-691752836
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] belugabehr commented on a change in pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1197:
URL: https://github.com/apache/hive/pull/1197#discussion_r454391934
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/QueryInfo.java
##########
@@ -17,48 +17,58 @@
*/
package org.apache.hadoop.hive.ql;
+import java.util.concurrent.TimeUnit;
+
/**
- * The class is synchronized, as WebUI may access information about a running query.
+ * Provide WebUI information about a running query. Class is thread safe so that
+ * multiple browser sessions can access the data simultaneously.
*/
public class QueryInfo {
private final String userName;
private final String executionEngine;
- private final long beginTime;
private final String operationId;
- private Long runtime; // tracks only running portion of the query.
- private Long endTime;
private String state;
private QueryDisplay queryDisplay;
+ /*
+ * Times are stored internally with nanosecond precision.
+ */
+ private final long beginTime;
+ private long runtime;
Review comment:
Thanks for the review.
`synchronized` and `volatile` are not interchangeable. This class doesn't need synchronization because all of its actions are so trivial, there is no issues with them happening concurrently: just assigning or reading a variable will not cause an issue with multiple threads. The classic `volatile` case is when a thread is spinning, waiting on some variable to change values. Without `volatile` the thread may cache the value and never stop spinning. There is no such use case here, it is for informational purposes only.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] github-actions[bot] closed pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #1197:
URL: https://github.com/apache/hive/pull/1197
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] dengzhhu653 commented on a change in pull request #1197: HIVE-23793: Review of QueryInfo Class
Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on a change in pull request #1197:
URL: https://github.com/apache/hive/pull/1197#discussion_r453406382
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/QueryInfo.java
##########
@@ -17,48 +17,58 @@
*/
package org.apache.hadoop.hive.ql;
+import java.util.concurrent.TimeUnit;
+
/**
- * The class is synchronized, as WebUI may access information about a running query.
+ * Provide WebUI information about a running query. Class is thread safe so that
+ * multiple browser sessions can access the data simultaneously.
*/
public class QueryInfo {
private final String userName;
private final String executionEngine;
- private final long beginTime;
private final String operationId;
- private Long runtime; // tracks only running portion of the query.
- private Long endTime;
private String state;
private QueryDisplay queryDisplay;
+ /*
+ * Times are stored internally with nanosecond precision.
+ */
+ private final long beginTime;
+ private long runtime;
Review comment:
Should the runtime, endTime, state better make them volatile if remove the synchronized?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org