Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-11-28 Thread Tom Lane
Michael Paquier writes: > I am wondering if it would be worth adding an AssertMacro() like in > this one, though: > https://www.postgresql.org/message-id/ykap64jvztmgc...@paquier.xyz Kind of doubt it. It'd bloat debug builds with a lot of redundant checks, and probably never catch anything. For

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-11-28 Thread Michael Paquier
On Mon, Nov 28, 2022 at 05:31:50PM -0500, Tom Lane wrote: > After looking through this thread, I side with Robert: we should reject > the remainder of this patch. It gives up page layout flexibility that > we might want back someday. Moreover, I didn't see any hard evidence > offered that there's

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-11-28 Thread Tom Lane
Bruce Momjian writes: > Uh, XTS doesn't require a nonce, so why are talking about nonces in this > thread? Because some other proposals do, or could, require a per-page nonce. After looking through this thread, I side with Robert: we should reject the remainder of this patch. It gives up page l

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-18 Thread Bruce Momjian
On Thu, Apr 7, 2022 at 03:11:24PM -0400, Robert Haas wrote: > On Thu, Apr 7, 2022 at 2:43 PM Peter Geoghegan wrote: > > But if we were in a green-field situation we'd probably not want to > > use up several bytes for a nonse anyway. You said so yourself. > > I don't know what statement of mine y

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Matthias van de Meent
On Thu, 7 Apr 2022 at 21:11, Robert Haas wrote: > > On Thu, Apr 7, 2022 at 2:43 PM Peter Geoghegan wrote: > > But if we were in a green-field situation we'd probably not want to > > use up several bytes for a nonse anyway. You said so yourself. > > I don't know what statement of mine you're talki

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Peter Geoghegan
On Thu, Apr 7, 2022 at 1:09 PM Stephen Frost wrote: > > > I got that much, of course. That will work, I suppose, but it'll be > > > the first and last time that anybody gets to do that (unless we accept > > > it being incompatible with encryption). > > > > Yeah. > > I don't know that I agree with

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Stephen Frost
Greetings, * Peter Geoghegan (p...@bowt.ie) wrote: > On Thu, Apr 7, 2022 at 12:37 PM Robert Haas wrote: > > On Thu, Apr 7, 2022 at 3:27 PM Peter Geoghegan wrote: > > > I just meant that it wouldn't be reasonable to impose a fixed cost on > > > every user, even those not using the feature. Which

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Stephen Frost
Greetings, * Robert Haas (robertmh...@gmail.com) wrote: > On Thu, Apr 7, 2022 at 3:27 PM Peter Geoghegan wrote: > > I just meant that it wouldn't be reasonable to impose a fixed cost on > > every user, even those not using the feature. Which you said yourself. > > Unfortunately, I think there's

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Peter Geoghegan
On Thu, Apr 7, 2022 at 12:37 PM Robert Haas wrote: > On Thu, Apr 7, 2022 at 3:27 PM Peter Geoghegan wrote: > > I just meant that it wouldn't be reasonable to impose a fixed cost on > > every user, even those not using the feature. Which you said yourself. > > Unfortunately, I think there's bound

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Robert Haas
On Thu, Apr 7, 2022 at 3:27 PM Peter Geoghegan wrote: > I just meant that it wouldn't be reasonable to impose a fixed cost on > every user, even those not using the feature. Which you said yourself. Unfortunately, I think there's bound to be some cost. We can avoid using the space in the page for

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Peter Geoghegan
On Thu, Apr 7, 2022 at 12:11 PM Robert Haas wrote: > I don't know what statement of mine you're talking about here, and > while I don't love using up space for a nonce, it seems to be the way > this encryption stuff works. I don't see that there's a reasonable > alternative, green field or no. I

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Robert Haas
On Thu, Apr 7, 2022 at 2:43 PM Peter Geoghegan wrote: > But if we were in a green-field situation we'd probably not want to > use up several bytes for a nonse anyway. You said so yourself. I don't know what statement of mine you're talking about here, and while I don't love using up space for a n

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Peter Geoghegan
On Thu, Apr 7, 2022 at 7:01 AM Robert Haas wrote: > Because there's no place to put them in the existing page format. We > jammed checksums into the 2-byte field that had previously been set > aside for the TLI, but that wasn't really an ideal solution because it > meant we ended up with a checksu

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Robert Haas
On Thu, Apr 7, 2022 at 4:34 AM Matthias van de Meent wrote: > Also, I can't see why we would allow page-level layout changes in > initdb; that seems like the wrong place to do that. All page layout > currently is at compile-time; even checksums (which can be > enabled/disabled in initdb) have rese

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Pavel Borisov
> > On Fri, Apr 1, 2022 at 11:12 AM Matthias van de Meent > wrote: > > Here's a new 0001 to keep CFBot happy. > > This seems like it would conflict with the proposal from > > http://postgr.es/m/ca+tgmoad8wmn6i1mmuo+4znege3hd57ys8uv8uzm7cneqy3...@mail.gmail.com > which I still hope to advance in so

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-07 Thread Matthias van de Meent
On Tue, 5 Apr 2022 at 21:45, Robert Haas wrote: > > On Fri, Apr 1, 2022 at 11:12 AM Matthias van de Meent > wrote: > > Here's a new 0001 to keep CFBot happy. > > This seems like it would conflict with the proposal from > http://postgr.es/m/ca+tgmoad8wmn6i1mmuo+4znege3hd57ys8uv8uzm7cneqy3...@mail.

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-05 Thread Robert Haas
On Fri, Apr 1, 2022 at 11:12 AM Matthias van de Meent wrote: > Here's a new 0001 to keep CFBot happy. This seems like it would conflict with the proposal from http://postgr.es/m/ca+tgmoad8wmn6i1mmuo+4znege3hd57ys8uv8uzm7cneqy3...@mail.gmail.com which I still hope to advance in some form at an app

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-01 Thread Matthias van de Meent
On Fri, 1 Apr 2022 at 10:50, Matthias van de Meent wrote: > > On Fri, 1 Apr 2022 at 07:38, Michael Paquier wrote: > > > > On Thu, Mar 31, 2022 at 12:09:35PM +0200, Matthias van de Meent wrote: > > > PageInit MAXALIGNs the size of the special area that it receives as an > > > argument; so any chan

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-04-01 Thread Matthias van de Meent
On Fri, 1 Apr 2022 at 07:38, Michael Paquier wrote: > > On Thu, Mar 31, 2022 at 12:09:35PM +0200, Matthias van de Meent wrote: > > PageInit MAXALIGNs the size of the special area that it receives as an > > argument; so any changes to the page header that would misalign the > > value would be AM-sp

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-03-31 Thread Michael Paquier
On Thu, Mar 31, 2022 at 12:09:35PM +0200, Matthias van de Meent wrote: > PageInit MAXALIGNs the size of the special area that it receives as an > argument; so any changes to the page header that would misalign the > value would be AM-specific; in which case it is quite unlikely that > this is the r

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-03-31 Thread Matthias van de Meent
On Thu, 31 Mar 2022 at 09:32, Michael Paquier wrote: > > On Mon, Mar 28, 2022 at 05:09:10PM +0200, Matthias van de Meent wrote: > > Not all clusters have checksums enabled (boo!, but we can't > > realistically fix that), so on-disk corruption could reasonably > > propagate to the rest of such syst

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-03-31 Thread Michael Paquier
On Mon, Mar 28, 2022 at 05:09:10PM +0200, Matthias van de Meent wrote: > Not all clusters have checksums enabled (boo!, but we can't > realistically fix that), so on-disk corruption could reasonably > propagate to the rest of such system. Additionally, checksums are only > checked on read, and upda

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-03-28 Thread Matthias van de Meent
On Mon, 28 Mar 2022 at 06:33, Michael Paquier wrote: > > On Wed, Feb 16, 2022 at 10:24:58PM +0100, Matthias van de Meent wrote: > > A first good reason to do this is preventing further damage when a > > page is corrupted: if I can somehow overwrite pd_special, > > non-assert-enabled builds would s

Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-03-27 Thread Michael Paquier
On Wed, Feb 16, 2022 at 10:24:58PM +0100, Matthias van de Meent wrote: > A first good reason to do this is preventing further damage when a > page is corrupted: if I can somehow overwrite pd_special, > non-assert-enabled builds would start reading and writing at arbitrary > offsets from the page po

Preventing indirection for IndexPageGetOpaque for known-size page special areas

2022-02-16 Thread Matthias van de Meent
Hi, I noticed that effectively all indexes use the special region of a page to store some index-specific data on the page. In all cases I've noticed, this is a constant-sized struct, located at what is effectively a fixed offset from the end of the page; indicated on the page by pd_special; and ac