On Mon, May 6, 2019 at 8:13 AM Dilip Kumar <dilipbal...@gmail.com> wrote: > > In general, I find the code for updating transaction headers to be > > really hard to understand. I'm not sure exactly what can be done > > about that. Like, why is UndoRecordPrepareTransInfo unpacking undo? > > It's only unpacking header. But, yeah we can do better, instead of > unpacking we can just read the main header and from uur_info we can > calculate exact offset of the uur_next and in > UndoRecordUpdateTransInfo we can directly update only uur_next by > writing at that offset, instead of overwriting the complete header?
Hmm. I think it's reasonable to use the unpack infrastructure to figure out where uur_next is. I don't know whether a bespoke method of figuring that out would be any better. At least the comments probably need some work. > > Why does it take two undo record pointers as arguments and how are > > they different? > One is previous transaction's start header which we wants to update > and other is current transaction's urec pointer what we want to set as > uur_next in the previous transaction's start header. So put some comments. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company