You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Kezhu Wang (Jira)" <ji...@apache.org> on 2023/09/25 04:07:00 UTC

[jira] [Commented] (ZOOKEEPER-4747) Java api lacks synchronous version of sync() call

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-4747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768500#comment-17768500 ] 

Kezhu Wang commented on ZOOKEEPER-4747:
---------------------------------------

If ZOOKEEPER-22 is shipped in future, then synchronous {{sync}} could be a simple fire-and-forget wrapper of this asynchronous counterpart and provides clean cue to clients to not worry the callback. So I think it could be still useful in present of ZOOKEEPER-22.

> Java api lacks synchronous version of sync() call
> -------------------------------------------------
>
>                 Key: ZOOKEEPER-4747
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4747
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Kezhu Wang
>            Assignee: Kezhu Wang
>            Priority: Major
>             Fix For: 3.10.0
>
>
> Ideally, it should be redundant just as what [~breed] says in ZOOKEEPER-1167.
> {quote}
> it wasn't an oversight. there is no reason for a synchronous version. because of the ordering guarantees, if you issue an asynchronous sync, the next call, whether synchronous or asynchronous will see the updated state.
> {quote}
> But in case of connection loss and absent of ZOOKEEPER-22, client has to check result of asynchronous sync before next call. So, currently, we can't simply issue an fire-and-forget asynchronous sync and an read to gain strong consistent. Then in a synchronous call chain, client has to convert asynchronous {{sync}} to synchronous to gain strong consistent. This is what I do in [EagerACLFilterTest::syncClient|https://github.com/apache/zookeeper/blob/f42c01de73867ffbc12707b3e9f9cd7f847fe462/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/EagerACLFilterTest.java#L98], it is apparently unfriendly to end users.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)