zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Nauroth <cnaur...@hortonworks.com>
Subject Re: ZooKeeper Sync API path parameter does not have any impact.
Date Wed, 07 Sep 2016 16:53:43 GMT
Yes, the sync operation really applies to the client’s entire view of ZooKeeper state, not
a specific path or sub-tree, so I would not expect to see any significant difference in time
for sync(/path1) vs. sync(/path2).  The presence of the path is only a client API convenience.

Expanding a bit on what Flavio already said, the reason a client calls sync is often because
it wants to read up-to-date state for a specific path.  If an application is doing this kind
of logic for multiple paths, then it can check the path in AsyncCallback.VoidCallback#processResult
and know that this is a completed sync in preparation for reading /path1 vs. /path2.

I woudn’t expect any of this to influence execution time of the sync operation though. 
If you do see a difference in execution time, then that’s likely just a coincidence.  (Maybe
it’s just a coincidence that there was more write activity at the time of calling sync(/path1)
vs. sync(/path2), and therefore one of those sync calls needed to do more work to catch up
with all of the transactions.)

--Chris Nauroth

On 9/7/16, 8:47 AM, "Mohammad arshad" <mohammad.arshad@huawei.com> wrote:

    So path is completely for ZooKeeper client. It has nothing to do with server. Therefore
whether I execute sync /path1 or sync /path2, sync request will complete in the same time.
    -----Original Message-----
    From: Flavio Junqueira [mailto:fpj@apache.org] 
    Sent: 07 September 2016 16:45
    To: user@zookeeper.apache.org
    Cc: dev@zookeeper.apache.org
    Subject: Re: ZooKeeper Sync API path parameter does not have any impact.
    The path parameter helps the app determine the path that the response is referring to.
A sync call is typically associated to a read request to a given path, so the path in the
sync call helps the application make the association to that path.
    > On 07 Sep 2016, at 11:35, Mohammad arshad <mohammad.arshad@huawei.com> wrote:
    > Hello Everyone
    > ZooKeeper sync API takes a path argument.
    > But it seems this path is no where used in the server code. Same path is returned
from the server to client again in SyncResponse.
    > Is the any other purpose of sync API path parameter.
    > Will there be any different impact for below sync commands form zk Cli?
    > sync /path1
    > sync /path2
    > Thanks
    > -Arshad

View raw message