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. 


------------------ ???????? ------------------
??????:                                                                         
                                               "dev"                            
                                                        
<ted.dunn...@gmail.com&gt;;
????????:&nbsp;2020??8??19??(??????) ????1:44
??????:&nbsp;"dev"<dev@zookeeper.apache.org&gt;;

????:&nbsp;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 <370119...@qq.com&gt; wrote:

&gt; Hi
&gt;
&gt;
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;I think may be there is a little risk when 
running
&gt; MultiTxn's serialize txns.get(vidx1) step. Because probably the txns' size
&gt; is changing that time in the future.
&gt;
&gt;
&gt; ```
&gt; public void serialize(OutputArchive a_, String tag) throws
&gt; java.io.IOException {
&gt; &amp;nbsp; a_.startRecord(this,tag);
&gt; &amp;nbsp; {
&gt; &amp;nbsp; &amp;nbsp; a_.startVector(txns,"txns");
&gt; &amp;nbsp; &amp;nbsp; if (txns!= null) {&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; int
&gt; len1 = txns.size();
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int vidx1 = 0; vidx1<len1; 
vidx1++) {
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Txn e1 = (Txn) 
txns.get(vidx1);
&gt; &amp;nbsp; a_.writeRecord(e1,"e1");
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&gt; &amp;nbsp; &amp;nbsp; }
&gt; &amp;nbsp; &amp;nbsp; a_.endVector(txns,"txns");
&gt; &amp;nbsp; }
&gt; &amp;nbsp; a_.endRecord(this,tag);
&gt; }
&gt; ```

Reply via email to