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

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

{quote} This is what I do in EagerACLFilterTest::syncClient, it is apparently 
unfriendly to end users. {quote}

This may not be a good example as it is a test code to enforce some 
"happen-before" relationship. But it does not affect the discussion.

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

Reply via email to