Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-26 Thread Thomas Munro
On Thu, Jun 23, 2022 at 2:09 AM Robert Haas wrote: > On Wed, Jun 22, 2022 at 12:34 AM Thomas Munro wrote: > > > For the record, the third idea proposed was to use 1 for the first > > > byte, so that 0 is reserved for NULL and works with memset(0). Here's > > > an attempt at that. > > > > ...

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-22 Thread Robert Haas
On Wed, Jun 22, 2022 at 12:34 AM Thomas Munro wrote: > > For the record, the third idea proposed was to use 1 for the first > > byte, so that 0 is reserved for NULL and works with memset(0). Here's > > an attempt at that. > > ... erm, though, duh, I forgot to adjust Assert(val > base). One more

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-21 Thread Thomas Munro
On Wed, Jun 22, 2022 at 4:24 PM Thomas Munro wrote: > On Wed, Jun 22, 2022 at 2:54 PM Tom Lane wrote: > > John Naylor writes: > > > On Wed, Jun 1, 2022 at 2:57 AM Robert Haas wrote: > > >> ... So we can fix this by: > > >> 1. Using a relative pointer value other than 0 to represent a null > >

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-21 Thread Thomas Munro
On Wed, Jun 22, 2022 at 2:54 PM Tom Lane wrote: > John Naylor writes: > > On Wed, Jun 1, 2022 at 2:57 AM Robert Haas wrote: > >> ... So we can fix this by: > >> 1. Using a relative pointer value other than 0 to represent a null > >> pointer. Andres suggested (Size) -1. > >> 2. Not storing the

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-21 Thread Tom Lane
John Naylor writes: > On Wed, Jun 1, 2022 at 2:57 AM Robert Haas wrote: >> ... So we can fix this by: >> 1. Using a relative pointer value other than 0 to represent a null >> pointer. Andres suggested (Size) -1. >> 2. Not storing the free page manager for the DSM in the main shared >> memory

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-06-21 Thread John Naylor
On Wed, Jun 1, 2022 at 2:57 AM Robert Haas wrote: > We do use fpm_segment_base(), but that accidentally fails > to break, because instead of using relptr_access() it drills right > through the abstraction and doesn't have any kind of special case for > 0. So we can fix this by: > > 1. Using a

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Kyotaro Horiguchi
At Wed, 01 Jun 2022 11:42:01 +0900 (JST), Kyotaro Horiguchi wrote in me> At Tue, 31 May 2022 16:10:05 -0400, Tom Lane wrote in me> tgl> Robert Haas writes: me> tgl> > Yeah, so when I created this stuff in the first place, I figured that me> tgl> > it wasn't a problem if we reserved relptr ==

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Kyotaro Horiguchi
At Tue, 31 May 2022 15:57:14 -0400, Robert Haas wrote in > 1. Using a relative pointer value other than 0 to represent a null > pointer. Andres suggested (Size) -1. I thought that relptr as a part of DSM so the use of offset=0 is somewhat illegal. But I like this. We can fix this by this

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Kyotaro Horiguchi
At Tue, 31 May 2022 16:10:05 -0400, Tom Lane wrote in tgl> Robert Haas writes: tgl> > Yeah, so when I created this stuff in the first place, I figured that tgl> > it wasn't a problem if we reserved relptr == 0 to mean a NULL pointer, tgl> > because you would never have a relative pointer

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Tom Lane
Robert Haas writes: > On Tue, May 31, 2022 at 6:14 PM Tom Lane wrote: >> However, now that I've corrected that mistaken image ... I wonder if >> it could make sense to redefine relptr as self-relative? That ought >> to provide some notational savings since you'd only need to carry >> around the

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Robert Haas
On Tue, May 31, 2022 at 6:14 PM Tom Lane wrote: > However, now that I've corrected that mistaken image ... I wonder if > it could make sense to redefine relptr as self-relative? That ought > to provide some notational savings since you'd only need to carry > around the relptr's own address not

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Tom Lane
Robert Haas writes: > Seems backwards to me. A relative pointer is supposed to point to > something inside some range of memory, like a DSM gment -- it can > never be legally used to point to anything outside that segment. So it > seems to me that you could perfectly legally point to the second

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Robert Haas
On Tue, May 31, 2022 at 5:52 PM Tom Lane wrote: > Thomas Munro writes: > > Count we make the relptrs 1-based, so that 0 is reserved as a sentinel > > that has the nice memset(0) property? > > Hm ... almost. A +1 offset would mean that zero is ambiguous with a > pointer to the byte just before

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Tom Lane
Thomas Munro writes: > Count we make the relptrs 1-based, so that 0 is reserved as a sentinel > that has the nice memset(0) property? Hm ... almost. A +1 offset would mean that zero is ambiguous with a pointer to the byte just before the relptr. Maybe that case never arises in practice, but

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Thomas Munro
On Wed, Jun 1, 2022 at 9:09 AM Tom Lane wrote: > Robert Haas writes: > > Could it use something other than its own address as the base address? > > Hmm, maybe we could make something of that idea ... > > > One way to do this would be to put it at the *end* of the > > "Preallocated DSM" space,

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Tom Lane
Robert Haas writes: > Could it use something other than its own address as the base address? Hmm, maybe we could make something of that idea ... > One way to do this would be to put it at the *end* of the > "Preallocated DSM" space, rather than the beginning. ... but that way doesn't sound

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Robert Haas
On Tue, May 31, 2022 at 4:32 PM Thomas Munro wrote: > This FPM isn't in a DSM. (It happens to have DSMs *inside it*, > because I'm using it as a separate DSM allocator: instead of making > them with dsm_impl.c mechanisms, this one recycles space from the main > shmem area). I view FPM as a

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Robert Haas
On Tue, May 31, 2022 at 4:10 PM Tom Lane wrote: > Seems like that in itself is a a lousy idea. Either the code should > respect the abstraction, or it shouldn't be declaring the variable > as a relptr in the first place. Yep. I think it should be respecting the abstraction, but the 2016 version

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Thomas Munro
On Wed, Jun 1, 2022 at 8:10 AM Tom Lane wrote: > Robert Haas writes: > > So we can fix this by: > > 1. Using a relative pointer value other than 0 to represent a null > > pointer. Andres suggested (Size) -1. > > 2. Not storing the free page manager for the DSM in the main shared > > memory

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Tom Lane
Robert Haas writes: > Yeah, so when I created this stuff in the first place, I figured that > it wasn't a problem if we reserved relptr == 0 to mean a NULL pointer, > because you would never have a relative pointer pointing to the > beginning of a DSM, because it would probably always start with

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-31 Thread Robert Haas
On Thu, May 19, 2022 at 11:00 PM Kyotaro Horiguchi wrote: > The path is taken only when a valid value is given to the > parameter. If we don't use preallocated dsm, it is initialized > elsewhere. In those cases the first bytes of the base address (the > second parameter of

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-30 Thread Kyotaro Horiguchi
At Fri, 20 May 2022 12:00:14 +0900 (JST), Kyotaro Horiguchi wrote in > At Thu, 19 May 2022 17:16:03 -0400, Tom Lane wrote in > > Justin Pryzby writes: > > > ./tmp_install/usr/local/pgsql/bin/postgres -D > > > ./src/test/regress/tmp_check/data -c min_dynamic_shared_memory=1MB > > > TRAP:

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-19 Thread Kyotaro Horiguchi
At Thu, 19 May 2022 17:16:03 -0400, Tom Lane wrote in > Justin Pryzby writes: > > ./tmp_install/usr/local/pgsql/bin/postgres -D > > ./src/test/regress/tmp_check/data -c min_dynamic_shared_memory=1MB > > TRAP: FailedAssertion("val > base", File: > > "../../../../src/include/utils/relptr.h",

Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-19 Thread Tom Lane
Justin Pryzby writes: > ./tmp_install/usr/local/pgsql/bin/postgres -D > ./src/test/regress/tmp_check/data -c min_dynamic_shared_memory=1MB > TRAP: FailedAssertion("val > base", File: > "../../../../src/include/utils/relptr.h", Line: 67, PID: 21912) Yeah, I see it too. > It looks like this may

pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

2022-05-19 Thread Justin Pryzby
./tmp_install/usr/local/pgsql/bin/postgres -D ./src/test/regress/tmp_check/data -c min_dynamic_shared_memory=1MB TRAP: FailedAssertion("val > base", File: "../../../../src/include/utils/relptr.h", Line: 67, PID: 21912)