17 Commits

Author SHA1 Message Date
Daniele Varrazzo
914537edc7 An attempt to restrict the search path to avoid injections
An alternative way to fix #168 which is not as invasive as the changes
in #171.

This currently breaks the current behaviour of the program as the tables
specified on command line are not found.
2018-03-20 20:47:06 +00:00
bwtakacy
70eac9ee06 Change exit code for --help and --version.
Previously, it is 1 but the reason is not clear.
It seems to be a historical one because pg_reorg
has the same exit codes.
2015-11-26 21:51:09 +09:00
Josh Kupershmidt
080ebd3ed6 Bump up Copyright notices for 2015 2015-01-11 19:01:37 -05:00
Josh Kupershmidt
a1821e3dcb Several fixes for concurrent index builds:
* Use poll() if it is available, or select() otherwise, to
   efficiently wait on index builds in worker queries to finish.
 * fix off-by-one error when initially assigning workers
 * move PQsetnonblocking() calls to setup_workers()
2012-12-14 18:49:00 -07:00
Josh Kupershmidt
509e568c52 First pass at implementing concurrent index builds using multiple connections.
Adds a new --jobs command-line argument to specify how many worker
connections you want. These worker connections should stick around
while processing table(s) in a single database. For each table,
parcel out the indexes to be built among these worker conns,
submitting each CREATE INDEX ... request using PQsendQuery() i.e.
in non-blocking fashion.

Most of this is still rather crude, in particular the
while (num_active_workers) ... loop in rebuild_indexes(), but
it seems to be working, so I'm committing here.
2012-12-14 18:49:00 -07:00
Josh Kupershmidt
3c13a0d05e Don't forget to disconnect conn2 when disconnect() is called, otherwise
we leave a connection hanging open for every database processed
via pg_repack -a.
2012-11-18 14:36:09 -07:00
Josh Kupershmidt
ad75dcfbb1 Allow multiple --table options to be specified on the command-line.
Per Issue #18. SimpleStringList code borrowed from pg_dump and a
pending patch to add similar functionality to pg_restore,
clusterdb, vacuumdb, and reindexdb.

The error handling in reorg_one_table() could still be much improved,
so that an error processing a single table doesn't cause pg_reorg to
necessarily bail out and skip further tables, but I'll leave that for
another day.
2012-11-16 15:19:35 +00:00
Josh Kupershmidt
78bae38718 Take an ACCESS SHARE LOCK on the target table, in an initial attempt to prevent concurrent DDL.
This is a first pass at Daniele's suggestion in Issue #8, although it is
definitely still buggy -- it is still possible for another transaction
to get in an AccessExclusive lock and perform DDL either before the
ACCESS SHARE lock is acquired or immediately after it is released.
2012-11-16 15:14:12 +00:00
Daniele Varrazzo
292e00835e Use correct homepage link in pg_repack --help
Also fixed punctuation in help.
2012-11-15 11:53:00 +00:00
Daniele Varrazzo
1d60a946ff Added The Reorg Development Team copyright 2012-11-11 03:00:00 +00:00
Daniele Varrazzo
db1c554f60 Dropped executable flags 2012-11-11 02:48:46 +00:00
Takahiro Itagaki
960930b645 Fixed database corruption when target tables have dropped columns, and
there are views or functions depending on columns after dropped ones.
The issue was reported by depesz, and original patch by Denish Patel.

Improved documentation how to build binaries from source.

COPYRIGHT updated.
2011-04-29 05:06:48 +00:00
Takahiro Itagaki
8ec3a085ad Added project configuration files for MSVC 2010 32/64bit. 2011-01-25 06:41:12 +00:00
Takahiro Itagaki
d490a1b458 Fix -w and -W options. They were inverted. 2010-06-18 01:12:28 +00:00
Takahiro Itagaki
9bed2e6b2e Fix a bug in --username option. 2010-05-25 04:53:23 +00:00
Takahiro Itagaki
6e05a366fa Fix double-free bug with -a (--all) option. 2010-05-14 06:52:45 +00:00
Takahiro Itagaki
f3873ff55b pg_reorg version 1.1.0.
- Add wait-timeout option and use SET statement_timeout instead of NOWAIT.
  This can avoid infinite NOWAIT loops to reorganize heavily accessed tables.
- Support native build with MSVC on Windows.
2010-03-25 07:13:16 +00:00