On Thu, 15 Sept 2022 at 12:36, Japin Li <japi...@hotmail.com> wrote: > > > On Thu, 15 Sep 2022 at 18:04, Simon Riggs <simon.ri...@enterprisedb.com> > wrote: > > On Wed, 14 Sept 2022 at 15:21, Alvaro Herrera <alvhe...@alvh.no-ip.org> > > wrote: > >> > >> On 2022-Aug-30, Simon Riggs wrote: > >> > >> > 001_new_isolation_tests_for_subxids.v3.patch > >> > Adds new test cases to master without adding any new code, specifically > >> > addressing the two areas of code that are not tested by existing tests. > >> > This gives us a baseline from which we can do test driven development. > >> > I'm hoping this can be reviewed and committed fairly smoothly. > >> > >> I gave this a quick run to confirm the claimed increase of coverage. It > >> checks out, so pushed. > > > > Thank you. > > > > So now we just have the main part of the patch, reattached here for > > the auto patch tester's benefit. > > Hi Simon, > > Thanks for the updated patch, here are some comments.
Thanks for your comments. > There is a typo, > s/SubTransGetTopMostTransaction/SubTransGetTopmostTransaction/g. > > + * call SubTransGetTopMostTransaction() if that xact > overflowed; > > > Is there a punctuation mark missing on the following first line? > > + * 2. When IsolationIsSerializable() we sometimes need to > access topxid > + * This occurs only when SERIALIZABLE is requested by app > user. > > > When we use function name in comments, some places we use parentheses, > but others do not use it. Why? I think, we should keep them consistent, > at least in the same commit. > > + * 3. When TransactionIdSetTreeStatus will use a status of > SUB_COMMITTED, > + * which then requires us to consult subtrans to find > parent, which > + * is needed to avoid race condition. In this case we ask > Clog/Xact > + * module if TransactionIdsAreOnSameXactPage(). Since we > start a new > + * clog page every 32000 xids, this is usually <<1% of > subxids. I've reworded those comments, hoping to address all of your above points. > Maybe we declaration a topxid to avoid calling GetTopTransactionId() > twice when we should set subtrans parent? > > + TransactionId subxid = > XidFromFullTransactionId(s->fullTransactionId); > + TransactionId topxid = GetTopTransactionId(); > ... > + if (MyProc->subxidStatus.overflowed || > + IsolationIsSerializable() || > + !TransactionIdsAreOnSameXactPage(topxid, subxid)) > + { > ... > + SubTransSetParent(subxid, topxid); > + } Seems a minor point, but I've done this anyway. Thanks for the review. v10 attached -- Simon Riggs http://www.EnterpriseDB.com/
002_minimize_calls_to_SubTransSetParent.v10.patch
Description: Binary data