pgsql: Improve pg_upgrade's load_directory() function.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve pg_upgrade's load_directory() function.
Date: 2012-07-18 05:13:38
Message-ID: E1SrMZu-00065V-EP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve pg_upgrade's load_directory() function.

Error out on out-of-memory, rather than returning -1, which the sole
existing caller wasn't checking for anyway. There doesn't seem to be
any use-case for making the caller check for failure here.

Detect failure return from readdir().

Use a less platform-dependent method of calculating the entrysize.
It's possible, but not yet confirmed, that this explains bug #6733,
in which Mike Wilson reports a pg_upgrade crash that did not occur
in 9.1. (Note that load_directory is effectively new code in 9.2,
at least on platforms that have scandir().)

Fix up comments, avoid uselessly using two counters, reduce the number
of realloc calls to something sane.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/3d929dc7b8e982f12c62fecba7d5122bb22fa497

Modified Files
--------------
contrib/pg_upgrade/file.c | 62 ++++++++++++++++++++------------------
contrib/pg_upgrade/pg_upgrade.h | 3 +-
contrib/pg_upgrade/util.c | 13 +++++++-
3 files changed, 47 insertions(+), 31 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-07-18 05:23:25 pgsql: Get rid of useless global variable in pg_upgrade.
Previous Message Tom Lane 2012-07-17 20:57:38 pgsql: Improve coding around the fsync request queue.