On Thu, Jan 30, 2020 at 4:11 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Fri, Jan 10, 2020 at 10:14 AM Dilip Kumar <dilipbal...@gmail.com> wrote: > > > > On Mon, Jan 6, 2020 at 2:11 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > > > > > > > > > > Few more comments: > > > -------------------------------- > > > v4-0007-Implement-streaming-mode-in-ReorderBuffer > > > 1. > > > +ReorderBufferStreamTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) > > > { > > > .. > > > + /* > > > + * TOCHECK: We have to rebuild historic snapshot to be sure it includes > > > all > > > + * information about > > > subtransactions, which could arrive after streaming start. > > > + */ > > > + if (!txn->is_schema_sent) > > > + snapshot_now > > > = ReorderBufferCopySnap(rb, txn->base_snapshot, > > > + txn, > > > command_id); > > > .. > > > } > > > > > > Why are we using base snapshot here instead of the snapshot we saved > > > the first time streaming has happened? And as mentioned in comments, > > > won't we need to consider the snapshots for subtransactions that > > > arrived after the last time we have streamed the changes? > > Fixed > > > > +static void > +ReorderBufferStreamTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) > { > .. > + /* > + * We can not use txn->snapshot_now directly because after we there > + * might be some new sub-transaction which after the last streaming run > + * so we need to add those sub-xip in the snapshot. > + */ > + snapshot_now = ReorderBufferCopySnap(rb, txn->snapshot_now, > + txn, command_id); > > "because after we there", you seem to forget a word between 'we' and > 'there'. So as we are copying it now, does this mean it will consider > the snapshots for subtransactions that arrived after the last time we > have streamed the changes? If so, have you tested it and can we add > the same in comments.
Ok > Also, if we need to copy the snapshot here, then do we need to again > copy it in ReorderBufferProcessTXN(in below code and in catch block in > the same function). I think so because as part of the "REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT" change, we might directly point to the snapshot and that will get truncated when we truncate all the changes of the ReorderBufferTXN. So I think we can check if snapshot_now->copied is true then we can avoid copying otherwise we can copy? Other comments look fine to me so I will reply to them along with the next version of the patch. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com