Tison,

Il giorno gio 16 giu 2022 alle ore 15:04 tison <[email protected]>
ha scritto:
>
> Hi ZooKeepers,
>
> When investigate this issue[1] I notice a possibility that if I write such
> a program:
>
> while (true) {
> try {
>   zk.setData(path, data, version); // (1)
>   break;
> } catch(KeeperException.ConnectionLossException e) {
>    // retry
> }
> }
>
> ... then in (1) there can be a case that it throws
> KeeperException.BadVersionException but actually the action is successful
> on the server side previously (but failed to send a response due to
> connection loss).

if you see BadVersionException then the action must not have been
successful on the server
if you see ConnectionLossException then you know nothing about the outcome

>
> Is this investigation right? If so, it is possibly to distinguish whether
> we succeed to apply the op on the server side?

you have to read the znode again and compare the version,
but please remember that in the meantime (after your read response
leaves the server) someone could have change the znode

I hope that helps

Enrico


>
> Best,
> tison.
>
> [1] https://github.com/apache/pulsar/issues/13954

Reply via email to