On Tue, Feb 07, 2023 at 07:30:00PM +0530, Bharath Rupireddy wrote: > + /* > + * Try updating oldest initialized XLog buffer page. > + * > + * Update it if we are initializing an XLog buffer page for the > first > + * time or if XLog buffers are full and we are wrapping around. > + */ > + if (XLogRecPtrIsInvalid(XLogCtl->OldestInitializedPage) || > + (!XLogRecPtrIsInvalid(XLogCtl->OldestInitializedPage) && > + XLogRecPtrToBufIdx(XLogCtl->OldestInitializedPage) == > nextidx)) > + { > + Assert(XLogCtl->OldestInitializedPage < > NewPageBeginPtr); > + > + XLogCtl->OldestInitializedPage = NewPageBeginPtr; > + }
nitpick: I think you can simplify the conditional to if (XLogRecPtrIsInvalid(XLogCtl->OldestInitializedPage) || XLogRecPtrToBufIdx(XLogCtl->OldestInitializedPage) == nextidx) It's confusing to me that OldestInitializedPage is set to NewPageBeginPtr. Doesn't that set it to the beginning of the newest initialized page? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com