jacoblukose commented on code in PR #2930:
URL: https://github.com/apache/helix/pull/2930#discussion_r1833995330


##########
helix-core/src/main/java/org/apache/helix/manager/zk/ZkBaseDataAccessor.java:
##########
@@ -423,6 +423,16 @@ public boolean update(String path, DataUpdater<T> updater, 
int options) {
    * sync update
    */
   public AccessResult doUpdate(String path, DataUpdater<T> updater, int 
options) {
+    return doUpdate(path, updater, options, ZkClient.TTL_NOT_SET);
+  }
+
+  /**
+   * sync update with ttl
+   *
+   * ttl is only used when creating new znode, hence if znode is already 
created with a ttl, further
+   * update operations will not update the znode ttl even if ttl is provided 
in the options
+   */
+  public AccessResult doUpdate(String path, DataUpdater<T> updater, int 
options, long ttl) {

Review Comment:
   @junkaixue @xyuanlu thanks for the questions. The ask is internal, @xyuanlu 
you can read up in https://jira01.corp.linkedin.com:8443/browse/DEPEND-55695. 
On a high level, I have also mentioned the ask in PR description. We have a 
usecase, to use the ZkBucketDataAccessor class, however the same is not 
equipped to work the ttl func of zk. So this PR, basically add the ttl support 
to ZkBucketDataAccessor and other corresponding changes. 
   
   Now to the q on why `doUpdate` need a ttl value to be passed in is because, 
`ZkBucketDataAccessor.compressedBucketWrite()` fn relies on 
`ZkBaseDataAccessor.doUpdate()` fn call. Now if the znode doesnt exist if we 
look at the internal logic of  `ZkBaseDataAccessor.doUpdate()` fn, it make a 
call to `ZkBaseDataAccessor.doCreate`, as we want to support ttl, we need to 
pass in the ttl value to the inside `doCreate` fn as well. Hence I overloaded 
the existing `doUpdate` fn to pass in ttl.  Also please note for the public 
facing `update()` call there is no option to pass in ttl, it will have a 
default of `ZkClient.TTL_NOT_SET`. 
   
   On the other q of access scope being public for the new overloaded 
`doUpdate` method, its only used by the `ZkBucketDataAccessor` class hence, I 
have changed to package-private. I cannot change to private, because then there 
is no access possible from `ZkBucketDataAccessor` to call 
`ZkBaseDataAccessor.doUpdate()`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to