Re: Is custom MemoryContext prohibited?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Kohei KaiGai <kaigai(at)heterodb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is custom MemoryContext prohibited?
Date: 2020-02-05 16:48:05
Message-ID: CA+TgmoY+Bnb-2RsmwJG3pVa=UhQVQN+_QsPZBP30C23L1MT+uw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 5, 2020 at 10:56 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Doesn't the proposed magic number address this concern?
>
> No, because (a) it will be a random magic number that nobody will
> remember, and gdb won't print in any helpful form; (b) at least
> as I understood the proposal, there'd be just one magic number for
> all types of memory context.

I don't disagree with the factual statements that you are making but I
don't understand why any of them represent real problems.

- It's true that magic numbers are generally not chosen for easy
memorization, but I think that most experienced hackers don't have
much trouble looking them up with 'git grep' on those (generally rare)
occasions when they are needed.

- It's true that gdb's default format is decimal and you might want
hex, but it has a 'printf' command that can be used to do that, which
I at least have found to be pretty darn convenient for this sort of
thing.

- And it's true that I was proposing - with your agreement, or so I
had understood - one magic number for all context types, but that was
specifically so you could tell whether you had a memory context or
some other thing. Once you know it's really a memory context, you
could print cxt->methods->name.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2020-02-05 17:03:43 Re: [HACKERS] advanced partition matching algorithm for partition-wise join
Previous Message Dmitry Dolgov 2020-02-05 16:37:30 Re: Index Skip Scan