Hi Bharath, Thanks for posting v11. I noticed it names me as its only author. If you intended to give me credit, thank you, but please do not post code you wrote under my name.
On Monday, November 16th, 2026 at 1:41 PM, Bharath Rupireddy <[email protected]> wrote: > However, I > think the patch is unnecessarily big at ~1480 LoC (for example, the > tests don't have to be that long, the docs seem to be overly > explaining things, and some code is unnecessarily complicated). Relative to v10, v11 removes 1034 lines, 627 of them tests. > I could bring it down to ~450 LoC with simplified docs, code > and tests (for the same coverage). The coverage is not the same. v11's tests never read any xmin, never produce a slot_xmin row, and never check that access requires pg_read_all_stats. I changed v11 to return 42 for every xmin and emit no slot_xmin rows, and no test failed. v11 reduces length further by deleting additions requested by reviewers. v2 added datname at Solai's suggestion [1]. v5 added xid and a test for a slot whose effective_xmin is set while data.xmin is still invalid, and v6 made the SRF read fresh transaction start times, all at Surya's request [2][3]. v11 drops these, and your mail gives no reason other than the patch's size. Size alone would justify removing anything. If you think these are not worth having, please say why for each, so the reviewers who asked for them can respond. The simplified docs omit material I added after you asked in [4]: the notes on parallel workers and the SQL decoding functions (items 27 and 28) and the ANALYZE exception (item 29). They also lack information I added unprompted because users need it: rows can tie, and a standby shows the primary's transactions as of the standby's replay position. v11 also returns gid from pg_get_xmin_horizon(). In item 7 of [4], you wrote: > The join also means gid reads null if the prepared transaction > ends in between, for a row the view still reports. In [5], I asked which locks the function would hold while it reads the gid. v11 releases ProcArrayLock, then calls TwoPhaseGetGid(), which takes only TwoPhaseStateLock. If the prepared transaction ends between the proc array scan and that call, v11 still emits the row with a null gid. Moving the lookup into C adds code without closing that window. v11 also uses a row-building helper of the kind I declined in my reply to item 25 of [4]. Calls to xmin_horizon_put_row() pass eight arguments by position and are hard to read. v10 zeroes each row and assigns fields by name. Like pg_stat_get_activity(), pg_stat_get_wal_senders(), pg_prepared_xact(), and pg_get_replication_slots(), it emits rows in one place. v11 emits through its helper from six places. With v10's columns, such a helper would save about 30 lines, but each call would pass ten arguments by position. Five adjacent ones would be uint32, so the compiler could not catch two of them swapped. > And, > the columns it emits seem to be too confusing, there are just too many > xmins (shared, catalog and data horizon). I can read this two ways. One is that three xmin columns are too many to look at. Users can solve that by selecting the ones they want. The other is that it's too confusing that there is more than one horizon and that a row can hold back different horizons at different values. v11 does not remove that confusion. It shifts most of that complexity into the documentation, making horizon scoping easier to overlook and requiring the user to apply more rules by hand. Take the last query in your email. Writing it required choosing a horizon and identifying which rows hold the horizon back. A user who thinks there is only one horizon will not know that the query may exclude logical slots that bloat the catalogs or that removing the oldest row in the view might do nothing for a user table. v11 splits a slot with both an xmin and a catalog_xmin into two rows. Why is one slot row with a column per horizon more confusing than two rows? On a standby, v11 emits one primary_xact row for every transaction ID in KnownAssignedXids, subtransactions included. A transaction with two savepoints can yield three rows, and the view does not indicate such rows are related. The documentation says to query the view on the primary to find the transaction, but a subtransaction's ID does not appear there. I will reply to Surya, attach v12 there, and address logic duplication and the xid column. [1] https://postgr.es/m/caf0whuesedcixvllppss72omgzxzbbo9xtd-vdvcfhi0zrd...@mail.gmail.com [2] https://postgr.es/m/CAOVWO5p8boS_gcjVTJs8A=vkc_uz1ol0kjezh6sbeuqsfbh...@mail.gmail.com [3] https://postgr.es/m/CAOVWO5pTmggE5Z5cx12N_am4=4r76cwpgr9x591hcm5q6fl...@mail.gmail.com [4] https://postgr.es/m/CALj2ACXg+UQhtwZ5oiuvrx+1XKk49N6cu=wP5Cmv627_=zj...@mail.gmail.com [5] https://postgr.es/m/qhODUcdKmqtOtwF4bW03SxPfKHda4EC7CEO2Ddj2jThrGRa8F1pDMA7LtG0R5JRo-2GK5RStXVP7tPP7WAUvfb_GCSN_I_YG7khDW859Fxg=@scottray.io -- Scott Ray
signature.asc
Description: OpenPGP digital signature
