Skip to content

Commit 27ea0fa

Browse files
committed
Several documentation updates for the pending 1.2 release:
* More mentions of new --only-indexes feature * Note we now support up to Postgres 9.3, and get rid of outdated list of supported operating systems. (As far as we know, pg_repack should build on any platforms supported by PostgreSQL itself, although no one has tested the Windows build in a long time.) * Remove most of the warnings about data corruption possible with concurrent DDL: this should no longer be a concern now that we hold an ACCESS SHARE lock during full-table repacks. Keep a short warning about old versions being susceptible to this problem, just to make clear that it's fixed now and as an enticement to upgrade. * A few grammar, phrasing, and typo fixes
1 parent 03015f8 commit 27ea0fa

File tree

3 files changed

+29
-41
lines changed

3 files changed

+29
-41
lines changed

bin/pg_repack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ repack_one_table(const repack_table *table, const char *orderby)
10311031
{
10321032
ereport(WARNING,
10331033
(errcode(E_PG_COMMAND),
1034-
errmsg("the table \"%s\" has already a trigger called \"%s\"",
1034+
errmsg("the table \"%s\" already has a trigger called \"%s\"",
10351035
table->target_name, PQgetvalue(res, 0, 0)),
10361036
errdetail(
10371037
"The trigger was probably installed during a previous"

doc/pg_repack.rst

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ You can choose one of the following methods to reorganize:
2020
* Online CLUSTER (ordered by cluster index)
2121
* Ordered by specified columns
2222
* Online VACUUM FULL (packing rows only)
23+
* Rebuild or relocate only the indexes of a table
2324

2425
NOTICE:
2526

@@ -39,15 +40,13 @@ Requirements
3940
------------
4041

4142
PostgreSQL versions
42-
PostgreSQL 8.3, 8.4, 9.0, 9.1, 9.2
43-
44-
OS
45-
RHEL 5.2, Windows XP SP3
43+
PostgreSQL 8.3, 8.4, 9.0, 9.1, 9.2, 9.3
4644

4745
Disks
48-
Requires free disk space twice as large as the target table(s) and
49-
indexes. For example, if the total size of the tables and indexes to be
50-
reorganized is 1GB, an additional 2GB of disk space is required.
46+
Performing a full-table repack requires free disk space about twice as
47+
large as the target table(s) and its indexes. For example, if the total
48+
size of the tables and indexes to be reorganized is 1GB, an additional 2GB
49+
of disk space is required.
5150

5251

5352
Download
@@ -147,7 +146,7 @@ Reorg Options
147146
^^^^^^^^^^^^^
148147

149148
``-a``, ``--all``
150-
Attempt repack all the databases of the cluster. Databases where the
149+
Attempt to repack all the databases of the cluster. Databases where the
151150
``pg_repack`` extension is not installed will be skipped.
152151

153152
``-t TABLE``, ``--table=TABLE``
@@ -165,17 +164,19 @@ Reorg Options
165164
``-j``, ``--jobs``
166165
Create the specified number of extra connections to PostgreSQL, and
167166
use these extra connections to parallelize the rebuild of indexes
168-
on each table. If your PostgreSQL server has extra cores and disk
169-
I/O available, this can be a useful way to speed up pg_repack.
167+
on each table. Parallel index builds are only supported for full-table
168+
repacks, not with ``--index`` or ``--only-indexes`` options. If your
169+
PostgreSQL server has extra cores and disk I/O available, this can be a
170+
useful way to speed up pg_repack.
170171

171172
``-s TBLSPC``, ``--tablespace=TBLSPC``
172173
Move the repacked tables to the specified tablespace: essentially an
173-
online version of ``ALTER TABLE ... SET TABLESPACE``. The tables indexes
174-
are left on the original tablespace unless ``--moveidx`` is specified too.
174+
online version of ``ALTER TABLE ... SET TABLESPACE``. The tables' indexes
175+
are left in the original tablespace unless ``--moveidx`` is specified too.
175176

176177
``-S``, ``--moveidx``
177-
Move the indexes too of the repacked tables to the tablespace specified
178-
by the option ``--tablespace``.
178+
Also move the indexes of the repacked tables to the tablespace specified
179+
by the ``--tablespace`` option.
179180

180181
``-i``, ``--index``
181182
Repack the specified index(es) only. Multiple indexes may be repacked
@@ -351,7 +352,7 @@ ERROR: query failed: ERROR: column "col" does not exist
351352

352353
Specify existing columns.
353354

354-
WARNING: the table "tbl" has already a trigger called z_repack_trigger
355+
WARNING: the table "tbl" already has a trigger called z_repack_trigger
355356
The trigger was probably installed during a previous attempt to run
356357
pg_repack on the table which was interrupted and for some reason failed
357358
to clean up the temporary objects.
@@ -364,7 +365,7 @@ WARNING: trigger "trg" conflicting on table "tbl"
364365
in alphabetical order.
365366

366367
The ``z_repack_trigger`` should be the last BEFORE trigger to fire.
367-
Please rename your trigger to that it sorts alphabetically before
368+
Please rename your trigger so that it sorts alphabetically before
368369
pg_repack's one; you can use::
369370

370371
ALTER TRIGGER zzz_my_trigger ON sometable RENAME TO yyy_my_trigger;
@@ -375,7 +376,7 @@ ERROR: Another pg_repack command may be running on the table. Please try again
375376
There is a chance of deadlock when two concurrent pg_repack commands are run
376377
on the same table. So, try to run the command after some time.
377378

378-
WARNING: Error creating index: ERROR: relation "index_xxxxx" already exists
379+
WARNING: Cannot create index "schema"."index_xxxxx", already exists
379380
DETAIL: An invalid index may have been left behind by a previous pg_repack on
380381
the table which was interrupted. Please use DROP INDEX "schema"."index_xxxxx"
381382
to remove this index and try again.
@@ -389,8 +390,7 @@ to remove this index and try again.
389390
Restrictions
390391
------------
391392

392-
pg_repack has the following restrictions. Be careful to avoid data
393-
corruptions.
393+
pg_repack comes with the following restrictions.
394394

395395
Temp tables
396396
^^^^^^^^^^^
@@ -405,27 +405,15 @@ pg_repack cannot reorganize tables using GiST indexes.
405405
DDL commands
406406
^^^^^^^^^^^^
407407

408-
You cannot perform DDL commands of the target table(s) **except** VACUUM and
409-
ANALYZE during pg_repack. In many
410-
cases pg_repack will fail and rollback correctly, but there are some cases
411-
which may result in data corruption.
412-
413-
.. class:: ddl
414-
415-
TRUNCATE
416-
TRUNCATE is lost. Deleted rows still exist after pg_repack.
417-
418-
CREATE INDEX
419-
It causes index corruption.
420-
421-
ALTER TABLE ... ADD COLUMN
422-
It causes loss of data. Newly added columns are initialized with NULLs.
423-
424-
ALTER TABLE ... ALTER COLUMN TYPE
425-
It causes data corruption.
408+
You will not be able to perform DDL commands of the target table(s) **except**
409+
VACUUM or ANALYZE while pg_repack is working. pg_repack will hold an
410+
ACCESS SHARE lock on the target table during a full-table repack, to enforce
411+
this restriction.
426412

427-
ALTER TABLE ... SET TABLESPACE
428-
It causes data corruption by wrong relfilenode.
413+
If you are using version 1.1.8 or earlier, you must not attempt to perform any
414+
DDL commands on the target table(s) while pg_repack is running. In many cases
415+
pg_repack would fail and rollback correctly, but there were some cases in these
416+
earlier versions which could result in data corruption.
429417

430418

431419
Details

regress/expected/repack.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ CREATE TABLE trg2 (id integer PRIMARY KEY);
340340
CREATE TRIGGER z_repack_trigger BEFORE UPDATE ON trg2 FOR EACH ROW EXECUTE PROCEDURE trgtest();
341341
\! pg_repack --dbname=contrib_regression --table=trg2
342342
INFO: repacking table "trg2"
343-
WARNING: the table "trg2" has already a trigger called "z_repack_trigger"
343+
WARNING: the table "trg2" already has a trigger called "z_repack_trigger"
344344
DETAIL: The trigger was probably installed during a previous attempt to run pg_repack on the table which was interrupted and for some reason failed to clean up the temporary objects. Please drop the trigger or drop and recreate the pg_repack extension altogether to remove all the temporary objects left over.
345345
CREATE TABLE trg3 (id integer PRIMARY KEY);
346346
CREATE TRIGGER z_repack_trigges BEFORE UPDATE ON trg3 FOR EACH ROW EXECUTE PROCEDURE trgtest();

0 commit comments

Comments
 (0)