You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by happen <37...@qq.com> on 2020/08/19 07:20:10 UTC
Re: racing risk in MultiTxn's serialize
I found that one observer's SyncRequestProcessor is appending one MultiTxn's log, FinalRequestProcessor access MultiTxn's at the same time. maybe MultiTxn will be modified by FinalRequestProcessor in the future.
It already was when I modified zk server to be a tool dealing txn logs.
------------------ > ------------------
from: "dev" <ted.dunning@gmail.com>;
time: 2020-08-19(Wed) 01:44
to: "dev"<dev@zookeeper.apache.org>;
theme: Re: racing risk in MultiTxn's serialize
Why do you think that this code is a problem? The instance in question is
limited to a single thread.
On Tue, Aug 18, 2020 at 10:27 AM happen <370119764@qq.com> wrote:
> Hi
>
>
> &nbsp; &nbsp; &nbsp;I think may be there is a little risk when running
> MultiTxn's serialize txns.get(vidx1) step. Because probably the txns' size
> is changing that time in the future.
>
>
> ```
> public void serialize(OutputArchive a_, String tag) throws
> java.io.IOException {
> &nbsp; a_.startRecord(this,tag);
> &nbsp; {
> &nbsp; &nbsp; a_.startVector(txns,"txns");
> &nbsp; &nbsp; if (txns!= null) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int
> len1 = txns.size();
> &nbsp; &nbsp; &nbsp; &nbsp; for(int vidx1 = 0; vidx1<len1; vidx1++) {
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Txn e1 = (Txn) txns.get(vidx1);
> &nbsp; a_.writeRecord(e1,"e1");
> &nbsp; &nbsp; &nbsp; &nbsp; }
> &nbsp; &nbsp; }
> &nbsp; &nbsp; a_.endVector(txns,"txns");
> &nbsp; }
> &nbsp; a_.endRecord(this,tag);
> }
> ```