Lists: | pgsql-hackers |
---|
From: | Mike <miketheman(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Fwd: Emit namespace in post-copy output |
Date: | 2021-06-22 22:07:53 |
Message-ID: | CAMerE0oz+8G-aORZL_BJcPxnBqewZAvND4bSUysjz+r-oT1BxQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
When running a VACUUM or CLUSTER command, the namespace name is not part of
the emitted message.
Using `vacuumdb` CLI tool recently with multiple jobs, I found that
reading the output messages harder to match the relations with their
namespaces.
Example:
INFO: vacuuming "sendgrid.open"
INFO: vacuuming "mailgun.open"
...
INFO: "open": found 0 removable, 31460776 nonremovable row versions in
1358656 pages
DETAIL: 0 dead row versions cannot be removed yet.
CPU 31.35s/261.26u sec elapsed 1620.68 sec.
...
In this example. the user can't readily tell which `open` relation was
completed.
Attached is a patch using existing functions to include the namespace in
the output string.
Looking forward to feedback!
-Mike Fiedler
Attachment | Content-Type | Size |
---|---|---|
0001-emit-namespace-in-post-copy-output.patch | application/x-patch | 2.0 KB |
From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
---|---|
To: | Mike <miketheman(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-06-23 21:46:10 |
Message-ID: | CADkLM=c0HO=om=+3R1JKj9rtjp9k5C7TOYC8s66d5BBzSu928Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Jun 22, 2021 at 6:08 PM Mike <miketheman(at)gmail(dot)com> wrote:
> When running a VACUUM or CLUSTER command, the namespace name is not part
> of the emitted message.
>
> Using `vacuumdb` CLI tool recently with multiple jobs, I found that
> reading the output messages harder to match the relations with their
> namespaces.
>
> Example:
>
> INFO: vacuuming "sendgrid.open"
> INFO: vacuuming "mailgun.open"
> ...
> INFO: "open": found 0 removable, 31460776 nonremovable row versions in
> 1358656 pages
> DETAIL: 0 dead row versions cannot be removed yet.
> CPU 31.35s/261.26u sec elapsed 1620.68 sec.
> ...
>
> In this example. the user can't readily tell which `open` relation was
> completed.
>
> Attached is a patch using existing functions to include the namespace in
> the output string.
>
> Looking forward to feedback!
> -Mike Fiedler
>
I've added this to the open commitfest:
https://commitfest.postgresql.org/33/3200/
The change is quite simple, just 3 lines, adding the schema name to two
different lines of output.
As such, there is no obvious documentation to change, though I can imagine
that we have sample output from vacuum, vacuumdb or cluster somewhere that
would need to be updated.
I cobbled together a very simple test:
~/pgdata$ /usr/local/pgsql/bin/psql postgres
psql (14beta2)
Type "help" for help.
postgres=# create database mike_test;
CREATE DATABASE
postgres=# \c mike_test
You are now connected to database "mike_test" as user "corey".
mike_test=# create schema foo;
CREATE SCHEMA
mike_test=# create table foo.bar(x integer);
CREATE TABLE
mike_test=# \q
mike_test=# VACUUM FULL VERBOSE foo.bar;
INFO: vacuuming "foo.bar"
INFO: "foo.bar": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL: 0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
VACUUM
And of course vacuumdb
~/pgdata$ /usr/local/pgsql/bin/vacuumdb --full --verbose mike_test
--table=foo.bar
vacuumdb: vacuuming database "mike_test"
INFO: vacuuming "foo.bar"
INFO: "foo.bar": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL: 0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
So far, so good.
From: | Mike <miketheman(at)gmail(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-06-25 15:10:47 |
Message-ID: | CAMerE0rgBxn+KvmqQdO2Oju5rjE43=Afi90GcpNGZCd6HyVDNA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Awesome, thanks! Are there any other steps I should take?
On Wed, Jun 23, 2021 at 5:46 PM Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
wrote:
> On Tue, Jun 22, 2021 at 6:08 PM Mike <miketheman(at)gmail(dot)com> wrote:
>
>> When running a VACUUM or CLUSTER command, the namespace name is not part
>> of the emitted message.
>>
>> Using `vacuumdb` CLI tool recently with multiple jobs, I found that
>> reading the output messages harder to match the relations with their
>> namespaces.
>>
>> Example:
>>
>> INFO: vacuuming "sendgrid.open"
>> INFO: vacuuming "mailgun.open"
>> ...
>> INFO: "open": found 0 removable, 31460776 nonremovable row versions in
>> 1358656 pages
>> DETAIL: 0 dead row versions cannot be removed yet.
>> CPU 31.35s/261.26u sec elapsed 1620.68 sec.
>> ...
>>
>> In this example. the user can't readily tell which `open` relation was
>> completed.
>>
>> Attached is a patch using existing functions to include the namespace in
>> the output string.
>>
>> Looking forward to feedback!
>> -Mike Fiedler
>>
>
> I've added this to the open commitfest:
> https://commitfest.postgresql.org/33/3200/
>
> The change is quite simple, just 3 lines, adding the schema name to two
> different lines of output.
>
> As such, there is no obvious documentation to change, though I can imagine
> that we have sample output from vacuum, vacuumdb or cluster somewhere that
> would need to be updated.
>
> I cobbled together a very simple test:
>
> ~/pgdata$ /usr/local/pgsql/bin/psql postgres
> psql (14beta2)
> Type "help" for help.
> postgres=# create database mike_test;
> CREATE DATABASE
> postgres=# \c mike_test
> You are now connected to database "mike_test" as user "corey".
> mike_test=# create schema foo;
> CREATE SCHEMA
> mike_test=# create table foo.bar(x integer);
> CREATE TABLE
> mike_test=# \q
> mike_test=# VACUUM FULL VERBOSE foo.bar;
> INFO: vacuuming "foo.bar"
> INFO: "foo.bar": found 0 removable, 0 nonremovable row versions in 0 pages
> DETAIL: 0 dead row versions cannot be removed yet.
> CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
> VACUUM
>
>
> And of course vacuumdb
>
> ~/pgdata$ /usr/local/pgsql/bin/vacuumdb --full --verbose mike_test
> --table=foo.bar
> vacuumdb: vacuuming database "mike_test"
> INFO: vacuuming "foo.bar"
> INFO: "foo.bar": found 0 removable, 0 nonremovable row versions in 0 pages
> DETAIL: 0 dead row versions cannot be removed yet.
> CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
>
>
> So far, so good.
>
From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
---|---|
To: | Mike <miketheman(at)gmail(dot)com>, "Corey Huinker" <corey(dot)huinker(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-06-25 19:56:30 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Jun 25, 2021, at 12:10 PM, Mike wrote:
> Awesome, thanks! Are there any other steps I should take?
No. Keep an eye on this thread. If you modify this patch, check if PostgreSQL
Patch Tester [1] reports failure. Since your patch does not modify a
considerable amount of code, it probably won't conflict with another patch. If
so, a reviewer will say so. If your patch doesn't have objections, it will
eventually be committed. BTW, your patch looks good to me.
[1] http://cfbot.cputube.org/index.html
--
Euler Taveira
EDB https://www.enterprisedb.com/
From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Cc: | Mike Fiedler <miketheman(at)gmail(dot)com> |
Subject: | Re: Fwd: Emit namespace in post-copy output |
Date: | 2021-07-27 06:01:13 |
Message-ID: | 162736567368.31964.16890342736158323428.pgcf@coridan.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested
Passed make check-world. Running make installcheck-world had 2 errors out of 209, but I got those same 2 errors on a clean branch.
Feature is as-described, and very simple.
As far as I can tell, there is no external specification for vacuum or any related utility.
I searched the documentation, and found several examples of the invocation of the VACUUM FULL command and vacuuumdb utility, but at no point was sample output shown, so this change will not require updating documentation.
The new status of this patch is: Ready for Committer
From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Mike Fiedler <miketheman(at)gmail(dot)com> |
Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-07-28 14:15:19 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
I took a look at this I agree with the reviewer that it's a good change. The
output from multiple jobs in vacuumdb is clearly easier to parse with this
since the initial LOG and later DETAIL can be interleaved with other relations
of the same name in other namespaces.
+ get_namespace_name(RelationGetNamespace(OldHeap)),
Since get_namespace_name() returns a palloced string, this will lead to a 2x
leak of the namespace length as opposed to the 1x of today. While hardly a big
deal, it seems prudent to cap this by storing the returned string locally now
that we need it twice.
I've updated the patch with this, see the attached v2. Barring objections I
will go ahead with this.
--
Daniel Gustafsson https://vmware.com/
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Emit-namespace-in-the-post-copy-errmsg.patch | application/octet-stream | 3.7 KB |
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
Cc: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Mike Fiedler <miketheman(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-07-29 00:57:30 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Jul 28, 2021 at 04:15:19PM +0200, Daniel Gustafsson wrote:
> Since get_namespace_name() returns a palloced string, this will lead to a 2x
> leak of the namespace length as opposed to the 1x of today. While hardly a big
> deal, it seems prudent to cap this by storing the returned string locally now
> that we need it twice.
I don't think this matters much. A quick read of the code shows that
this memory should be allocated within the transaction context running
CLUSTER/VACUUM FULL, and that gets free'd in the internal calls of
CommitTransactionCommand().
--
Michael
From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Mike Fiedler <miketheman(at)gmail(dot)com> |
Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Emit namespace in post-copy output |
Date: | 2021-08-16 18:13:02 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
> On 28 Jul 2021, at 16:15, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> I took a look at this I agree with the reviewer that it's a good change.
Pushed to master, thanks!
--
Daniel Gustafsson https://vmware.com/