Re: Fix for pg_upgrade status display

Lists: pgsql-hackers
From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Fix for pg_upgrade status display
Date: 2012-12-06 03:04:53
Message-ID: 20121206030453.GJ30893@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pg_upgrade displays file names during copy and database names during
dump/restore. Andrew Dunstan identified three bugs:

* long file names were being truncated to 60 _leading_ characters, which
often do not change for long file names

* file names were truncated to 60 characters in log files

* carriage returns were being output to log files

The attached patch fixes these --- it prints 60 _trailing_ characters to
the status display, and full path names without carriage returns to log
files.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
pg_upgrade.diff text/x-diff 5.7 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix for pg_upgrade status display
Date: 2012-12-06 17:43:53
Message-ID: CA+TgmoYQ61GXAkOOK9tLw1Fph9kUo9ULAD0WoO7Mxe6Gyvz=WQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 5, 2012 at 10:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Pg_upgrade displays file names during copy and database names during
> dump/restore. Andrew Dunstan identified three bugs:
>
> * long file names were being truncated to 60 _leading_ characters, which
> often do not change for long file names
>
> * file names were truncated to 60 characters in log files
>
> * carriage returns were being output to log files
>
> The attached patch fixes these --- it prints 60 _trailing_ characters to
> the status display, and full path names without carriage returns to log
> files.

This might be a dumb question, but why limit it to 60 characters at
all instead of, say, MAXPGPATH?

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


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix for pg_upgrade status display
Date: 2012-12-06 17:53:44
Message-ID: 20121206175344.GA4299@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas escribió:
> On Wed, Dec 5, 2012 at 10:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Pg_upgrade displays file names during copy and database names during
> > dump/restore. Andrew Dunstan identified three bugs:
> >
> > * long file names were being truncated to 60 _leading_ characters, which
> > often do not change for long file names
> >
> > * file names were truncated to 60 characters in log files
> >
> > * carriage returns were being output to log files
> >
> > The attached patch fixes these --- it prints 60 _trailing_ characters to
> > the status display, and full path names without carriage returns to log
> > files.
>
> This might be a dumb question, but why limit it to 60 characters at
> all instead of, say, MAXPGPATH?

I think this should be keyed off the terminal width, actually, no? The
whole point of this is to overwrite the same line over and over, right?

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix for pg_upgrade status display
Date: 2012-12-06 18:56:45
Message-ID: 20121206185645.GL30893@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Thu, Dec 6, 2012 at 12:43:53PM -0500, Robert Haas wrote:
> On Wed, Dec 5, 2012 at 10:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Pg_upgrade displays file names during copy and database names during
> > dump/restore. Andrew Dunstan identified three bugs:
> >
> > * long file names were being truncated to 60 _leading_ characters, which
> > often do not change for long file names
> >
> > * file names were truncated to 60 characters in log files
> >
> > * carriage returns were being output to log files
> >
> > The attached patch fixes these --- it prints 60 _trailing_ characters to
> > the status display, and full path names without carriage returns to log
> > files.
>
> This might be a dumb question, but why limit it to 60 characters at
> all instead of, say, MAXPGPATH?

It is limited to 60 only for screen display, so the user knows what is
being processed. If the text wraps across several lines, the \r trick
to overwrite the string will not work.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix for pg_upgrade status display
Date: 2012-12-06 18:57:36
Message-ID: 20121206185736.GM30893@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 6, 2012 at 02:53:44PM -0300, Alvaro Herrera wrote:
> Robert Haas escribió:
> > On Wed, Dec 5, 2012 at 10:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > > Pg_upgrade displays file names during copy and database names during
> > > dump/restore. Andrew Dunstan identified three bugs:
> > >
> > > * long file names were being truncated to 60 _leading_ characters, which
> > > often do not change for long file names
> > >
> > > * file names were truncated to 60 characters in log files
> > >
> > > * carriage returns were being output to log files
> > >
> > > The attached patch fixes these --- it prints 60 _trailing_ characters to
> > > the status display, and full path names without carriage returns to log
> > > files.
> >
> > This might be a dumb question, but why limit it to 60 characters at
> > all instead of, say, MAXPGPATH?
>
> I think this should be keyed off the terminal width, actually, no? The
> whole point of this is to overwrite the same line over and over, right?

That seems like overkill for a status message. It is just there so
users know pg_upgrade isn't stuck, which was the complaint before the
message was used.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix for pg_upgrade status display
Date: 2012-12-07 17:26:37
Message-ID: 20121207172637.GA8889@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 5, 2012 at 10:04:53PM -0500, Bruce Momjian wrote:
> Pg_upgrade displays file names during copy and database names during
> dump/restore. Andrew Dunstan identified three bugs:
>
> * long file names were being truncated to 60 _leading_ characters, which
> often do not change for long file names
>
> * file names were truncated to 60 characters in log files
>
> * carriage returns were being output to log files
>
> The attached patch fixes these --- it prints 60 _trailing_ characters to
> the status display, and full path names without carriage returns to log
> files.

Patch applied. It also suppresses status output to the log file unless
verbose mode is used.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +