You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/10/21 08:41:45 UTC

[GitHub] [incubator-kyuubi] cfmcgrady commented on a diff in pull request #3662: [KYUUBI #2887] Add a POLLING balance policy for spark engine pool

cfmcgrady commented on code in PR #3662:
URL: https://github.com/apache/incubator-kyuubi/pull/3662#discussion_r1001527445


##########
kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala:
##########
@@ -290,6 +296,11 @@ class ZookeeperDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient {
     secretNode.start()
   }
 
+  def getAndIncrement(path: String): Int = {
+    val dai = new DistributedAtomicInteger(zkClient, path, new RetryForever(1000))
+    dai.increment().preValue().intValue()

Review Comment:
   from class `DistributedAtomicInteger` Java API documentation:
   
   > The various increment methods return an [AtomicValue](https://curator.apache.org/apidocs/org/apache/curator/framework/recipes/atomic/AtomicValue.html) object. You must always check [AtomicValue.succeeded()](https://curator.apache.org/apidocs/org/apache/curator/framework/recipes/atomic/AtomicValue.html#succeeded()). None of the methods (other than get()) are guaranteed to succeed.
   
   we need to retry `dai.increment()`



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org