Обсуждение: Question about building an exportable snapshop
While working on the issue [1], I realize that if a subtransaction
hasn't done any catalog change then we don't add this in the commit
xid list even if we are building a full snapshot [2]. That means when
we will convert this to the MVCC snapshot we will add this to a
running xid list. If my understanding is correct then how visibility
will work? Because if I look at the code in XidInMVCCSnapshot(), then
if the suboverflowed is not set then first we are going to look into
the snapshot->subxip array and if we don't find it there then we look
into the snapshot->xip array, and now we will be finding even
committed subxips in the snapshot->xip array. Am I missing something?
[2]
/*
* Add subtransaction to base snapshot if catalog modifying, we don't
* distinguish to toplevel transactions there.
*/
if (ReorderBufferXidHasCatalogChanges(builder->reorder, subxid))
{
sub_needs_timetravel = true;
needs_snapshot = true;
[3]
[1] https://www.postgresql.org/message-id/CAFiTN-tqopqpfS6HHug2nnOGieJJ_nm-Nvy0WBZ%3DZpo-LqtSJA%40mail.gmail.com
--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
On Tue, Oct 12, 2021 at 6:21 PM Dilip Kumar <dilipbalaut@gmail.com> wrote: > > While working on the issue [1], I realize that if a subtransaction > hasn't done any catalog change then we don't add this in the commit > xid list even if we are building a full snapshot [2]. > I think this is true only if we have reached SNAPBUILD_CONSISTENT state otherwise, we are adding subtransactions in the committed xip array by setting 'needs_timetravel' to true. And if we have already reached a consistent state before it then we anyway don't need to add this. If this is true, do you still see any problem? -- With Regards, Amit Kapila.
On Wed, Oct 20, 2021 at 5:06 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Tue, Oct 12, 2021 at 6:21 PM Dilip Kumar <dilipbalaut@gmail.com> wrote: > > > > While working on the issue [1], I realize that if a subtransaction > > hasn't done any catalog change then we don't add this in the commit > > xid list even if we are building a full snapshot [2]. > > > > I think this is true only if we have reached SNAPBUILD_CONSISTENT > state otherwise, we are adding subtransactions in the committed xip > array by setting 'needs_timetravel' to true. And if we have already > reached a consistent state before it then we anyway don't need to add > this. If this is true, do you still see any problem? Yeah, you are right. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com