You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2021/03/05 22:44:26 UTC
[GitHub] [helix] NealSun96 commented on a change in pull request #1663: Track failures for async read/write in ZkClient
NealSun96 commented on a change in pull request #1663:
URL: https://github.com/apache/helix/pull/1663#discussion_r588767038
##########
File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/callback/ZkAsyncCallbacks.java
##########
@@ -50,6 +50,10 @@ public void processResult(int rc, String path, Object ctx, byte[] data, Stat sta
if (_data != null && ctx != null && ctx instanceof ZkAsyncCallMonitorContext) {
((ZkAsyncCallMonitorContext) ctx).setBytes(_data.length);
}
+ } else if(rc != Code.NONODE.intValue()) {
+ if (ctx instanceof ZkAsyncCallMonitorContext) {
Review comment:
We could condense the two if lines into one && condition.
##########
File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/callback/ZkAsyncCallbacks.java
##########
@@ -67,6 +71,10 @@ public void handle() {
public void processResult(int rc, String path, Object ctx, Stat stat) {
if (rc == 0) {
_stat = stat;
+ } else {
+ if (ctx instanceof ZkAsyncCallMonitorContext) {
Review comment:
`else if` would work here
##########
File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/callback/ZkAsyncCallMonitorContext.java
##########
@@ -62,4 +62,18 @@ void recordAccess(String path) {
}
}
}
+
+ /**
+ * Record the operation failure into the specified ZkClient monitor.
+ * @param path The monitored path
+ */
+ void recordFailure(String path) {
+ if (_monitor != null) {
+ if (_isRead) {
+ _monitor.recordFailure(path, ZkClientMonitor.AccessType.READ);
Review comment:
We could condense the lines to `_isRead ? ZkClientMonitor.AccessType.READ : ZkClientMonitor.AccessType.WRITE`
----------------------------------------------------------------
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: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org