Re: alter_table regression test problem

Lists: pgsql-hackers
From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: alter_table regression test problem
Date: 2013-11-06 19:16:21
Message-ID: 1383765381.96470.YahooMailNeo@web162906.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

In checking things out with CLOBBER_CACHE_ALWAYS, I was getting
this problem, which seems to be unrelated to my changes:

*** /home/kgrittn/pg/master/src/test/regress/expected/alter_table.out   2013-11-01 09:07:35.418829105 -0500
--- /home/kgrittn/pg/master/src/test/regress/results/alter_table.out    2013-11-06 11:06:29.785830560 -0600
***************
*** 2320,2325 ****
      ) mapped;
   incorrectly_mapped | have_mappings
  --------------------+---------------
!                   0 | t
  (1 row)
 
--- 2320,2325 ----
      ) mapped;
   incorrectly_mapped | have_mappings
  --------------------+---------------
!                   1 | t
  (1 row)
 

======================================================================

I looked for detail with this query:

SELECT
    mapped_oid, oid
FROM (
    SELECT
        oid, reltablespace, relfilenode, relname,
        pg_filenode_relation(reltablespace, pg_relation_filenode(oid)) mapped_oid
    FROM pg_class
    WHERE relkind IN ('r', 'i', 'S', 't', 'm')
    ) mapped
WHERE (mapped_oid != oid OR mapped_oid IS NULL);

... with this result:

 mapped_oid | oid
------------+------
 2139062143 | 2619
(1 row)

2619 is the oid for pg_statistic, and the mapped_oid value matches
what we use to clobber the cache.  Any ideas before I start
digging?

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Andres Freund <andres(at)anarazel(dot)de>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-06 19:46:43
Message-ID: 9f3c3690-22ab-480f-baa6-d48ce85d28f9@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Hi,

Kevin Grittner <kgrittn(at)ymail(dot)com> schrieb:
>In checking things out with CLOBBER_CACHE_ALWAYS, I was getting
>this problem, which seems to be unrelated to my changes:

>... with this result:
>
> mapped_oid | oid
>------------+------
> 2139062143 | 2619
>(1 row)
>
>2619 is the oid for pg_statistic, and the mapped_oid value matches
>what we use to clobber the cache.  Any ideas before I start
>digging?

Interesting. That's new code of mine, but it hasn't shown up in the clobber animals so far. I'll have a look.

Thanks,

Andred

---
Please excuse brevity and formatting - I am writing this on my mobile phone.


From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-06 19:58:15
Message-ID: 1383767895.78484.YahooMailNeo@web162904.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

> In checking things out with CLOBBER_CACHE_ALWAYS, I was getting
> this problem, which seems to be unrelated to my changes:

On a CLOBBER_CACHE_ALWAYS build I did a fresh initdb, started the
cluster, and immediately tested this query on both the postgres and
template1 databases, with the same result:

SELECT
    *
FROM (
    SELECT
        oid, reltablespace, relfilenode, relname,
        pg_filenode_relation(reltablespace,
pg_relation_filenode(oid)) mapped_oid
    FROM pg_class
    WHERE relkind IN ('r', 'i', 'S', 't', 'm')
    ) mapped
WHERE (mapped_oid != oid OR mapped_oid IS NULL);
 oid  | reltablespace | relfilenode |   relname    | mapped_oid
------+---------------+-------------+--------------+------------
 2619 |             0 |       11828 | pg_statistic | 2139062143
(1 row)

That makes for a pretty simple test for git bisect, even if
everything including initdb is painfully slow with
CLOBBER_CACHE_ALWAYS.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-06 20:00:40
Message-ID: 20131106200040.GQ5809@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kevin Grittner wrote:

> That makes for a pretty simple test for git bisect, even if
> everything including initdb is painfully slow with
> CLOBBER_CACHE_ALWAYS.

Most likely culprit is f01d1ae3a104019d6d68aeff85c4816a275130b3

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-06 23:17:34
Message-ID: 20131106231734.GP14819@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-06 17:00:40 -0300, Alvaro Herrera wrote:
> Kevin Grittner wrote:
>
> > That makes for a pretty simple test for git bisect, even if
> > everything including initdb is painfully slow with
> > CLOBBER_CACHE_ALWAYS.
>
> Most likely culprit is f01d1ae3a104019d6d68aeff85c4816a275130b3

Well, that test tests the functionality added in that commit, so sure,
it can't be before that. What confuses me is that relfilenodemap has
survived quite some CLOBBER_CACHE_ALWAYS runs in the buildfarm since:
http://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=jaguarundi&br=HEAD

Did you compile with CLOBBER_CACHE_ALWAYS or CLOBBER_CACHE_RECURSIVELY?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-06 23:30:55
Message-ID: 20131106233055.GQ14819@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 00:17:34 +0100, Andres Freund wrote:
> On 2013-11-06 17:00:40 -0300, Alvaro Herrera wrote:
> > Kevin Grittner wrote:
> >
> > > That makes for a pretty simple test for git bisect, even if
> > > everything including initdb is painfully slow with
> > > CLOBBER_CACHE_ALWAYS.
> >
> > Most likely culprit is f01d1ae3a104019d6d68aeff85c4816a275130b3
>
> Well, that test tests the functionality added in that commit, so sure,
> it can't be before that. What confuses me is that relfilenodemap has
> survived quite some CLOBBER_CACHE_ALWAYS runs in the buildfarm since:
> http://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=jaguarundi&br=HEAD
>
> Did you compile with CLOBBER_CACHE_ALWAYS or CLOBBER_CACHE_RECURSIVELY?

Either way, the code is completely and utterly broken in the face of
cache invalidations that are received when it does its internal
heap_open(RelationRelationId). I can't have been thinking straight when
I wrote the invalidation logic.

Will send a fix.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 09:53:31
Message-ID: 20131107095331.GA24361@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 00:30:55 +0100, Andres Freund wrote:
> On 2013-11-07 00:17:34 +0100, Andres Freund wrote:
> > On 2013-11-06 17:00:40 -0300, Alvaro Herrera wrote:
> > > Kevin Grittner wrote:
> > >
> > > > That makes for a pretty simple test for git bisect, even if
> > > > everything including initdb is painfully slow with
> > > > CLOBBER_CACHE_ALWAYS.
> > >
> > > Most likely culprit is f01d1ae3a104019d6d68aeff85c4816a275130b3
> >
> > Well, that test tests the functionality added in that commit, so sure,
> > it can't be before that. What confuses me is that relfilenodemap has
> > survived quite some CLOBBER_CACHE_ALWAYS runs in the buildfarm since:
> > http://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=jaguarundi&br=HEAD
> >
> > Did you compile with CLOBBER_CACHE_ALWAYS or CLOBBER_CACHE_RECURSIVELY?
>
> Either way, the code is completely and utterly broken in the face of
> cache invalidations that are received when it does its internal
> heap_open(RelationRelationId). I can't have been thinking straight when
> I wrote the invalidation logic.

Ok, I've attached a fix for this, which unfortunately is not all that
small.
Could either of you commit it?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-fundamental-issues-with-relfilenodemap-s-cache-i.patch text/x-patch 9.5 KB

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:23:13
Message-ID: 1383834193.64480.YahooMailNeo@web162904.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> wrote:

> Ok, I've attached a fix for this, which unfortunately is not all
> that small.
> Could either of you commit it?

Unfortunately, I don't feel I have a good enough grasp of the
caching/invalidation mechanism to be a committer for this
particular patch, but I think you could make it a lot easier to
review by eliminating some of the whitespace changes.  I applied
your patch and then ran pgindent, which promptly undid some of the
whitespace changes this patch makes, so there is really no excuse
for those.  I think this is one of those cases where the large
chunk of code inside the new "else" block should not be indented
with the initial patch -- a pgindent-based whitespace-only patch
should follow so that the substantive changes here are easier to
see in the initial patch.  Also, I *really* don't like the
whitespace and comment placement here:

    /* check shared tables */
    if (reltablespace == GLOBALTABLESPACE_OID)
    {
        relid = RelationMapFilenodeToOid(relfilenode, true);
    }

    /*
     * Not a shared table, could either be a plain relation or a database
     * specific but nailed one, like e.g. pg_class.
     */
    else
    {

... which is what results from pgindent acting on this patch.
Please move the "else" comment inside the opening brace for the
"else".

I think that would make the patch a lot easier for someone to
review, and then it can be reformatted separately.
 
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:32:19
Message-ID: 20131107143219.GB24361@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 06:23:13 -0800, Kevin Grittner wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>
> > Ok, I've attached a fix for this, which unfortunately is not all
> > that small.
> > Could either of you commit it?
>
> Unfortunately, I don't feel I have a good enough grasp of the
> caching/invalidation mechanism to be a committer for this
> particular patch,

That's understandable.

> but I think you could make it a lot easier to
> review by eliminating some of the whitespace changes.  I applied
> your patch and then ran pgindent, which promptly undid some of the
> whitespace changes this patch makes, so there is really no excuse
> for those.

I'll try to produce a pgindent-clean version.

> I think this is one of those cases where the large
> chunk of code inside the new "else" block should not be indented
> with the initial patch -- a pgindent-based whitespace-only patch
> should follow so that the substantive changes here are easier to
> see in the initial patch.

I think commiting code with fundamentally broken indentation like that
is pretty much pointless though. Somebody who wants to look at the
actual changes without the whitespace noise can just use git diff -w/git
blame -w/... to eliminate those while viewing.

> Also, I *really* don't like the
> whitespace and comment placement here:
>
>     /* check shared tables */
>     if (reltablespace == GLOBALTABLESPACE_OID)
>     {
>         relid = RelationMapFilenodeToOid(relfilenode, true);
>     }
>
>     /*
>      * Not a shared table, could either be a plain relation or a database
>      * specific but nailed one, like e.g. pg_class.
>      */
>     else
>     {
>
> ... which is what results from pgindent acting on this patch.
> Please move the "else" comment inside the opening brace for the
> "else".

Man, I *hate* pgindent. Imo the comment belongs to the outside, not the
inside since it's toplevel logic that matters. Anyway I'll try to clean
it up somehow.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:49:58
Message-ID: 1383835798.70783.YahooMailNeo@web162902.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2013-11-07 06:23:13 -0800, Kevin Grittner wrote:

>>   I think this is one of those cases where the large
>> chunk of code inside the new "else" block should not be indented
>> with the initial patch -- a pgindent-based whitespace-only patch
>> should follow so that the substantive changes here are easier to
>> see in the initial patch.
>
> I think commiting code with fundamentally broken indentation like that
> is pretty much pointless though. Somebody who wants to look at the
> actual changes without the whitespace noise can just use git diff -w/git
> blame -w/... to eliminate those while viewing.

I think it is pretty much SOP for committers to prefer a patch that
adds a new pair of braces around 50 lines of code and only changes
non-whitespace of a few lines within that block to leave the block
at its old indentation.  It's up to the committer whether to indent
after review and make both substantive and whitespace changes
together, but I have definitely seen those done separately, or even
left for the next global pgindent run to fix.

Personally, I was surprised how small this apparently-large patch
became when I used git --color-words to compare it, which would be
another option, I guess; but there is precedent for the approach I
suggested.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:55:55
Message-ID: 19658.1383836155@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> I think it is pretty much SOP for committers to prefer a patch that
> adds a new pair of braces around 50 lines of code and only changes
> non-whitespace of a few lines within that block to leave the block
> at its old indentation.

Yes. It's much easier to review a patch done that way than to wonder if
the apparently-just-whitespace changes are masking something substantive.
In fact, if I'm reviewing a patch that reindents a big chunk of existing
code, I'll frequently not use the patch but reconstruct it that way,
just to be sure.

regards, tom lane


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:59:00
Message-ID: 20131107145900.GA24357@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 09:55:55 -0500, Tom Lane wrote:
> Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> > I think it is pretty much SOP for committers to prefer a patch that
> > adds a new pair of braces around 50 lines of code and only changes
> > non-whitespace of a few lines within that block to leave the block
> > at its old indentation.
>
> Yes. It's much easier to review a patch done that way than to wonder if
> the apparently-just-whitespace changes are masking something substantive.
> In fact, if I'm reviewing a patch that reindents a big chunk of existing
> code, I'll frequently not use the patch but reconstruct it that way,
> just to be sure.

But why not just use git diff/show/whatever -w or, as suggested by
Kevin, --color-words?

ISTM the patch author is much more likely to mistake when indenting code
strangely.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 14:59:33
Message-ID: 20131107145933.GC24361@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
> It's up to the committer whether to indent
> after review and make both substantive and whitespace changes
> together, but I have definitely seen those done separately, or even
> left for the next global pgindent run to fix.

Hm. I don't remember many such cases and I've just looked across the git
history and i didn't really find anything after
a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
individuals couldn't run pgindent because of the typedefs file.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 15:10:34
Message-ID: 19962.1383837034@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
>> It's up to the committer whether to indent
>> after review and make both substantive and whitespace changes
>> together, but I have definitely seen those done separately, or even
>> left for the next global pgindent run to fix.

> Hm. I don't remember many such cases and I've just looked across the git
> history and i didn't really find anything after
> a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
> individuals couldn't run pgindent because of the typedefs file.

FWIW, I tend to pgindent before committing, now that it's easy to do so.
But in cases like this, I'd much rather review the patch *before* that
happens. Basically the point of the review is to follow and confirm
the patch author's thought process, and I'll bet you put the braces in
before reindenting too.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 15:12:15
Message-ID: 527BADCF.4020807@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 11/07/2013 09:59 AM, Andres Freund wrote:
> On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
>> It's up to the committer whether to indent
>> after review and make both substantive and whitespace changes
>> together, but I have definitely seen those done separately, or even
>> left for the next global pgindent run to fix.
> Hm. I don't remember many such cases and I've just looked across the git
> history and i didn't really find anything after
> a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
> individuals couldn't run pgindent because of the typedefs file.
>

Perhaps we need more frequent pgindent runs.

both patch and git-apply have options to ignore whitespace changes.

cheers

andrew


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-07 17:18:26
Message-ID: 20131107171826.GG28314@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-07 10:10:34 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
> >> It's up to the committer whether to indent
> >> after review and make both substantive and whitespace changes
> >> together, but I have definitely seen those done separately, or even
> >> left for the next global pgindent run to fix.
>
> > Hm. I don't remember many such cases and I've just looked across the git
> > history and i didn't really find anything after
> > a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
> > individuals couldn't run pgindent because of the typedefs file.
>
> FWIW, I tend to pgindent before committing, now that it's easy to do so.
> But in cases like this, I'd much rather review the patch *before* that
> happens. Basically the point of the review is to follow and confirm
> the patch author's thought process, and I'll bet you put the braces in
> before reindenting too.

Well, I did both at the same time, I have an emacs command for that
;). But independent from that technicality, reindenting is part of
changing the flow of logic for me - I've spent a couple of years
primarily writing python (where indentation is significant), maybe it's
that.

So, here's the patch (slightly editorialized) with reverted indenting of
that block.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-fundamental-issues-with-relfilenodemap-s-cache-i.patch text/x-patch 7.1 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-11 21:00:59
Message-ID: CA+TgmobeP2q3xetvC8WK+3cMDCikBwTPS01M10XPwkHSQEScvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 7, 2013 at 12:18 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2013-11-07 10:10:34 -0500, Tom Lane wrote:
>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>> > On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
>> >> It's up to the committer whether to indent
>> >> after review and make both substantive and whitespace changes
>> >> together, but I have definitely seen those done separately, or even
>> >> left for the next global pgindent run to fix.
>>
>> > Hm. I don't remember many such cases and I've just looked across the git
>> > history and i didn't really find anything after
>> > a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
>> > individuals couldn't run pgindent because of the typedefs file.
>>
>> FWIW, I tend to pgindent before committing, now that it's easy to do so.
>> But in cases like this, I'd much rather review the patch *before* that
>> happens. Basically the point of the review is to follow and confirm
>> the patch author's thought process, and I'll bet you put the braces in
>> before reindenting too.
>
> Well, I did both at the same time, I have an emacs command for that
> ;). But independent from that technicality, reindenting is part of
> changing the flow of logic for me - I've spent a couple of years
> primarily writing python (where indentation is significant), maybe it's
> that.
>
> So, here's the patch (slightly editorialized) with reverted indenting of
> that block.

Gah. Well, of course, I have the opposite preference from Tom on how
this should be indented. Sigh.

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


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-11 21:09:55
Message-ID: CA+Tgmob_KA1JA02g2sujeBAzcd9nBE2B3uKKur4KotqKL_QmiQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 11, 2013 at 4:00 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Nov 7, 2013 at 12:18 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>> On 2013-11-07 10:10:34 -0500, Tom Lane wrote:
>>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>>> > On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
>>> >> It's up to the committer whether to indent
>>> >> after review and make both substantive and whitespace changes
>>> >> together, but I have definitely seen those done separately, or even
>>> >> left for the next global pgindent run to fix.
>>>
>>> > Hm. I don't remember many such cases and I've just looked across the git
>>> > history and i didn't really find anything after
>>> > a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
>>> > individuals couldn't run pgindent because of the typedefs file.
>>>
>>> FWIW, I tend to pgindent before committing, now that it's easy to do so.
>>> But in cases like this, I'd much rather review the patch *before* that
>>> happens. Basically the point of the review is to follow and confirm
>>> the patch author's thought process, and I'll bet you put the braces in
>>> before reindenting too.
>>
>> Well, I did both at the same time, I have an emacs command for that
>> ;). But independent from that technicality, reindenting is part of
>> changing the flow of logic for me - I've spent a couple of years
>> primarily writing python (where indentation is significant), maybe it's
>> that.
>>
>> So, here's the patch (slightly editorialized) with reverted indenting of
>> that block.
>
> Gah. Well, of course, I have the opposite preference from Tom on how
> this should be indented. Sigh.

...and I hit send too soon.

I'm pretty sure that the current coding, which blows away the whole
relation, is used in other places, and I really don't see why it
should be fundamentally flawed, or why we should change it to clear
the cache entries out one by one instead of en masse.
RelidByRelfilenode definitely needs to use HASH_FIND rather than
HASH_ENTER, so that part I agree with.

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


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-11 21:34:58
Message-ID: 0e91fbbc-fe56-42a3-8978-734c48898b3a@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> schrieb:
>On Mon, Nov 11, 2013 at 4:00 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
>wrote:
>> On Thu, Nov 7, 2013 at 12:18 PM, Andres Freund
><andres(at)2ndquadrant(dot)com> wrote:
>>> On 2013-11-07 10:10:34 -0500, Tom Lane wrote:
>>>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>>>> > On 2013-11-07 06:49:58 -0800, Kevin Grittner wrote:
>>>> >> It's up to the committer whether to indent
>>>> >> after review and make both substantive and whitespace changes
>>>> >> together, but I have definitely seen those done separately, or
>even
>>>> >> left for the next global pgindent run to fix.
>>>>
>>>> > Hm. I don't remember many such cases and I've just looked across
>the git
>>>> > history and i didn't really find anything after
>>>> > a04161f2eab55f72b3c3dba9baed0ec09e7f633f, but that was back when
>>>> > individuals couldn't run pgindent because of the typedefs file.
>>>>
>>>> FWIW, I tend to pgindent before committing, now that it's easy to
>do so.
>>>> But in cases like this, I'd much rather review the patch *before*
>that
>>>> happens. Basically the point of the review is to follow and
>confirm
>>>> the patch author's thought process, and I'll bet you put the braces
>in
>>>> before reindenting too.
>>>
>>> Well, I did both at the same time, I have an emacs command for that
>>> ;). But independent from that technicality, reindenting is part of
>>> changing the flow of logic for me - I've spent a couple of years
>>> primarily writing python (where indentation is significant), maybe
>it's
>>> that.
>>>
>>> So, here's the patch (slightly editorialized) with reverted
>indenting of
>>> that block.
>>
>> Gah. Well, of course, I have the opposite preference from Tom on how
>> this should be indented. Sigh.
>
>...and I hit send too soon.
>
>I'm pretty sure that the current coding, which blows away the whole
>relation, is used in other places, and I really don't see why it
>should be fundamentally flawed, or why we should change it to clear
>the cache entries out one by one instead of en masse.
>RelidByRelfilenode definitely needs to use HASH_FIND rather than
>HASH_ENTER, so that part I agree with.

It surely is possible to go that route, but imagine what happens if the heap_open() blows away the entire hash. We'd either need to recheck if the hash exists before entering or recreate it after dropping. It seemed simpler to follow attoptcache's example.

Regards,

Andres

--
Please excuse brevity and formatting - I am writing this on my mobile phone.

Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter_table regression test problem
Date: 2013-11-13 15:59:22
Message-ID: CA+TgmoZasXcRxT4Or18_DMjtxbXmn87YyBhHFmogC=8DOaAs+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 11, 2013 at 4:34 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>>I'm pretty sure that the current coding, which blows away the whole
>>relation, is used in other places, and I really don't see why it
>>should be fundamentally flawed, or why we should change it to clear
>>the cache entries out one by one instead of en masse.
>>RelidByRelfilenode definitely needs to use HASH_FIND rather than
>>HASH_ENTER, so that part I agree with.
>
> It surely is possible to go that route, but imagine what happens if the heap_open() blows away the entire hash. We'd either need to recheck if the hash exists before entering or recreate it after dropping. It seemed simpler to follow attoptcache's example.

I'm not sure if this is the best way forward, but I don't feel like
arguing about it, either, so committed.

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