The future is completed after the transaction has been replicated to a majority of the followers and committed by the leader. If the transaction was submitted on the leader node then a subsequent read will return the data however this isn't guaranteed on a follower b/c the transaction may not have been replicated (only a majority is needed) or applied to the data tree yet.
I'm curious why you need to read the data right after. That said, you should use a read-write transaction or a transaction chain in order to guarantee a subsequent read will observe the previously written data. Also, as a side note, it's better to process the futures asynchronously rather then block on checkedGet. On Wed, Feb 22, 2017 at 1:21 AM, Hari Prasad <hari...@hcl.com> wrote: > Hi All, > > > > We write a bridge information in config DS and reading the same in next > few lines of code. (used 3 node cluster setup). > > > > write operation is performed via org.opendaylight.netvirt. > utils.mdsal.utils.MdsalUtils::put call and read is performed via > > MdsalUtils::read call. > > > > Observed that in MdsalUtils::put call ‘future.checkedGet()’ returns true > immediately but when verified the data in config DS right after ‘return > true’ assuming that data is written to config DS but found value is not > present in DS. > > > > What is the problem and Is there any way to encounter this problem. Please > let us know. > > > > Please find the below responses for the same query from Sam and Vishal. > > > > > > Thanks, > > Hari > > > > > > *From:* Vishal Thapar [mailto:vishal.tha...@ericsson.com] > *Sent:* Wednesday, February 22, 2017 10:50 AM > *To:* N Vivekanandan <n.vivekanan...@ericsson.com>; Sam Hague < > sha...@redhat.com>; Hari Prasad <hari...@hcl.com> > *Cc:* netvirt-...@lists.opendaylight.org > *Subject:* RE: [netvirt-dev] Delay in reading data from Config DS after a > write > > > > Hi Vivek, > > > > Someone from Clustering can answer it better, but it basically boils down > to what constitutes a successful write in any cluster setup. Does write > return success when data is queued to leader node, written on leader node > or replicated throughout cluster? When does read return data, if its > present on leader or replicated across cluster? Read consistency and write > consistency in a cluster can be configured differently and based on network > conditions it is possible for data to be not available for read after a > successful write. > > > > Regards, > > Vishal. > > > > > > *From:* N Vivekanandan > *Sent:* 22 February 2017 10:24 > *To:* Vishal Thapar <vishal.tha...@ericsson.com>; Sam Hague < > sha...@redhat.com>; Hari Prasad <hari...@hcl.com> > *Cc:* netvirt-...@lists.opendaylight.org > *Subject:* RE: [netvirt-dev] Delay in reading data from Config DS after a > write > > > > Hi Vishal, > > > > The checkedFutures.get() is used extensively in many places. > > > > Regardless of 3-nodes setups and distribution of shards , It is expected > that the checkedGet() returns only after the write to the respective > datastore has succeeded. > > > > If that is not so, we would like to know why? > > > > -- > > Thanks, > > > > Vivek > > > > *From:* netvirt-dev-boun...@lists.opendaylight.org [ > mailto:netvirt-dev-boun...@lists.opendaylight.org > <netvirt-dev-boun...@lists.opendaylight.org>] *On Behalf Of *Vishal Thapar > *Sent:* Wednesday, February 22, 2017 10:17 AM > *To:* Sam Hague <sha...@redhat.com>; Hari Prasad <hari...@hcl.com> > *Cc:* netvirt-...@lists.opendaylight.org > *Subject:* Re: [netvirt-dev] Delay in reading data from Config DS after a > write > > > > Hi Hari, > > > > As Sam pointed out data can take time to reflect in DataStore in a > clustere setup if you do a write from one of the follower nodes of that > shard. Since this is cluster setup, what about the code that is doing the > write? Is it chcking for leadership before writing or doing write on each > node [shouldn’t]? If it is checking for leadership, what is the entity used > with EoS? > > > > Regards, > > Vishal. > > > > *From:* netvirt-dev-boun...@lists.opendaylight.org [ > mailto:netvirt-dev-boun...@lists.opendaylight.org > <netvirt-dev-boun...@lists.opendaylight.org>] *On Behalf Of *Sam Hague > *Sent:* 21 February 2017 20:45 > *To:* Hari Prasad <hari...@hcl.com> > *Cc:* netvirt-...@lists.opendaylight.org > *Subject:* Re: [netvirt-dev] Delay in reading data from Config DS after a > write > > > > > > > > On Tue, Feb 21, 2017 at 7:50 AM, Hari Prasad <hari...@hcl.com> wrote: > > Hi All, > > > > We write a bridge information in config DS and reading the same in next > few lines of code > > > > write operation is performed via org.opendaylight.netvirt. > utils.mdsal.utils.MdsalUtils::put call and read is performed via > > MdsalUtils::read call. > > > > Observed that in MdsalUtils::put call ‘future.checkedGet()’ returns true > immediately but when verified the data in config DS right after ‘return > true’ assuming that data is written to config DS but found value is not > present in DS. > > Hari, is this a 3node setup? Can you also check if the checkedGet is > really called? I think in the 3node setup ovsdb southbound fakes out the > writes - checks ownership and if false just returns true. eventually the > owner node will write the same data. > > > > What is the problem and Is there any way to encounter this problem. Please > let us know > > > > Thanks, > > Hari > > > > > > ::DISCLAIMER:: > ------------------------------------------------------------ > ------------------------------------------------------------ > ---------------------------- > > The contents of this e-mail and any attachment(s) are confidential and > intended for the named recipient(s) only. > E-mail transmission is not guaranteed to be secure or error-free as > information could be intercepted, corrupted, > lost, destroyed, arrive late or incomplete, or may contain viruses in > transmission. The e mail and its contents > (with or without referred errors) shall therefore not attach any liability > on the originator or HCL or its affiliates. > Views or opinions, if any, presented in this email are solely those of the > author and may not necessarily reflect the > views or opinions of HCL or its affiliates. Any form of reproduction, > dissemination, copying, disclosure, modification, > distribution and / or publication of this message without the prior > written consent of authorized representative of > HCL is strictly prohibited. If you have received this email in error > please delete it and notify the sender immediately. > Before opening any email and/or attachments, please check them for viruses > and other defects. > > ------------------------------------------------------------ > ------------------------------------------------------------ > ---------------------------- > > > _______________________________________________ > netvirt-dev mailing list > netvirt-...@lists.opendaylight.org > https://lists.opendaylight.org/mailman/listinfo/netvirt-dev > > > > _______________________________________________ > controller-dev mailing list > controller-dev@lists.opendaylight.org > https://lists.opendaylight.org/mailman/listinfo/controller-dev > >
_______________________________________________ controller-dev mailing list controller-dev@lists.opendaylight.org https://lists.opendaylight.org/mailman/listinfo/controller-dev