265 Commits

Author SHA1 Message Date
Josh Kupershmidt
859af29061 Bump version to 1.3.0-beta1 2015-01-26 20:45:20 -05:00
Josh Kupershmidt
493e763fd7 Merge branch 'bwtakacy-develop' 2015-01-26 19:39:55 -05:00
Josh Kupershmidt
9beefb6324 Merge branch 'develop' of https://github.com/bwtakacy/pg_repack into bwtakacy-develop 2015-01-26 19:37:20 -05:00
Josh Kupershmidt
ad5ee75215 Merge branch 'bwtakacy-modify_error_message' 2015-01-26 19:26:13 -05:00
Josh Kupershmidt
de8853b241 Wordsmith error message when repack_one_database() fails. 2015-01-26 19:21:27 -05:00
bwtakacy
49e542a0b6 Improve error message when repack against non-existing table.
Previously, pg_repack shows "ERROR: ERROR: relation foo does not
exist" when specify non-existing table. Though the first ERROR
is from pg_repack and the second ERROR is from PostgreSQL server,
some users might think that pg_repack shows error level twice
wrongly.
2015-01-16 10:21:17 +09:00
bwtakacy
aff4610d71 Add a expected out file to run the repack regression test successfully.
The 'repack' regression test fails on PostgreSQL 8.4 because the index name
assigned implicitely is different from 9.0 and after.
2015-01-14 15:47:43 +09:00
Daniele Varrazzo
3920a5e5cd Freecode is no more
See http://freecode.com/about
2015-01-13 16:13:07 +00:00
Josh Kupershmidt
ef4dc5a1fb Tweak apply_log() loop so that we don't wait until getting
all the way down to 0 rows processed before performing the
table swap step.
2015-01-11 20:59:13 -05:00
Josh Kupershmidt
8f61e44efd Tweak logic for when to display:
"Waiting for %d transactions to finish. First PID: %s"

message. Display it on every loop through the SQL_XID_ALIVE check
(i.e. every second), instead of only when the number of transactions
we're waiting on changes -- previously, it was too easy for that
important message to get lost in other messages.

And don't display the message at all when running under pg_regress,
i.e. as part of `make installcheck`. We had been getting occasional
errors from pg_regress when autovacuum was running and that message
got logged.
2015-01-11 19:31:09 -05:00
Josh Kupershmidt
0cb40b6204 Add a Makefile check to avoid building against PostgreSQL 9.4+
Better to error out early during make, rather than failing with an
obscure error during CREATE EXTENSION.
2015-01-11 19:06:20 -05:00
Josh Kupershmidt
080ebd3ed6 Bump up Copyright notices for 2015 2015-01-11 19:01:37 -05:00
Andrew Dunstan
db4ec04cf2 Do get_indexdef calls while the table is already locked.
These calls can require an access share lock on the table, which might
conflict with an existing or later acquires lock. So perform these calls
while we already have an exclusive lock on the table. This unfortuantely
means that we ave to remove the constness of the table parameter to
repack_one_table, as it is not modifying the table object to set up the
indexes.
2014-12-30 16:48:06 -05:00
Andrew Dunstan
9f77a2fd03 Gather index info at the same time as table info, rather than later.
This helps avoid possible problems with later strong table locks.
2014-12-30 10:48:35 -05:00
Josh Kupershmidt
6d3c085b22 Fix up commit 4b3347, where I failed to notice that the initial
problem was really about the OID being interpreted as an integer
literal upon input, and overflowing its integer space before even making
it into pg_try_advisory_lock(). (We do still need to add -2147483648 to
make the result fit into an integer, as 4b3347 does.)

Hopefully fixes issue #30, for real this time.
2014-11-20 17:18:15 -05:00
Josh Kupershmidt
4b334745a3 Ensure that unsigned 4-byte OIDs are able to squeeze into the signed
4-byte int accepted by the two-argument form of pg_try_advisory_lock()
we are using.

Fixes #30. Thanks to Mark Steben and Greg Sabino Mullane for the report
and diagnosis.
2014-11-13 20:54:48 -05:00
Josh Kupershmidt
649e72c0a4 Add some ORDER BYs to queries fetching lists of tables/indexes
to be repacked, in order to ensure consistent installcheck results.
2014-05-26 20:57:28 -04:00
Josh Kupershmidt
e2c720b89c Perform sql_pop delete in bulk instead of one-at-a-time.
Prior to 506104686b these DELETEs had been done in large batches (of
DEFAULT_PEEK_COUNT size), but that naive method of choosing rows to
delete was unsafe. Here we continue to keep track of which rows must
be deleted as we process them.
2014-05-25 22:04:13 -04:00
Josh Kupershmidt
f0cd787bf5 Merge in Pull Request #20 from Steeve Lennmark.
Adds support for repacking only the tables in a specified schema. This
doesn't support --only-indexes mode, but that seems alright for now.

Fix merge conflicts, and make a few tweaks along the way:
 * bump version to 1.3-dev0
 * add Beena to list of maintainers
 * documentation wordsmithing
 * fix up the INFO message printed for each index in --index or
   --only-indexes mode, so that it is only printed once per index, and
   prints the name of the original index, not that of the transient
   index_%u name.
2014-05-24 15:42:24 -04:00
schmiddy
f097982383 A few more fixes to the Releases doc section about 1.2. 2014-05-24 00:27:05 -04:00
schmiddy
4eb1cef99e Make the 'repacking index ...' message be displayed
for indexes-only repacks (not just when in dry-run mode).
2014-05-24 00:09:03 -04:00
schmiddy
69aa4f741d Merge branch 'master' into 21_dryrun 2014-05-23 23:35:25 -04:00
schmiddy
08d28df63a Add note urging users to upgrade due to Issue #23. 2014-05-22 23:36:06 -04:00
schmiddy
9916c48138 A few tweaks to the README, addressing the state of pg_reorg. 2014-05-22 15:08:39 -04:00
Daniele Varrazzo
3ca9c39dff Added documentation about the release process 2014-05-19 13:45:29 +01:00
Daniele Varrazzo
a9f3682645 Setting release status to stable
Grr... can't remove the wrong package from PGXN
2014-05-19 12:43:35 +01:00
Daniele Varrazzo
ae6638b581 Releasing version 1.2 2014-05-19 10:54:46 +01:00
Daniele Varrazzo
cdcb69a237 Source packages go in the dist directory 2014-05-19 10:54:46 +01:00
Daniele Varrazzo
3555c6b81a Added makefile target to create source distribution 2014-05-19 10:54:46 +01:00
Daniele Varrazzo
5e9d596bb7 Document issue #23 fixed 2014-05-19 10:54:46 +01:00
Josh Kupershmidt
506104686b Fix a nasty data loss/corruption bug from the sql_pop query.
It is not safe to assume that we can bulk-delete all entries from the
log table based on their "id" being less than the largest "id" we have
processed so far, as we may unintentionally delete some tuples from the
log which we haven't actually processed yet in the case of concurrent
transactions adding tuples into the log table.
2014-04-22 10:56:24 -04:00
Steeve Lennmark
f094795178 Clean up tests and fix regression
It was possible to specify both --schema and --table which probably
-should- be legal but would need some code to be rewritten. This patch
adds a check that both can't be specified and returns an error telling
the user to use schema.table notation instead. A regression test
checking this behaviour was added.
2014-01-31 08:22:12 +00:00
Steeve Lennmark
d16bdc20d2 Add test for --dry-run
This should probably be rewritten to actually check OID on old/new tables so
that we don't accidentally execute repack during a dry run.
2014-01-30 12:53:48 +00:00
Steeve Lennmark
5affda20ea Move new log output to inside the dryrun block 2014-01-30 12:53:22 +00:00
Steeve Lennmark
f10a41c4e1 Add output explaining that repack won't be issued 2014-01-30 12:50:15 +00:00
Steeve Lennmark
9b381f5b85 Add second test that tests multiple --schema args 2014-01-30 12:27:32 +00:00
Steeve Lennmark
e7b6719256 Add test for --schema (-c) 2014-01-30 12:19:21 +00:00
Steeve Lennmark
c7767ab10b Move --dry-run to 1.3 2014-01-26 10:28:29 +00:00
Steeve Lennmark
bf277a4e5f Add support for dry run -N (--dryrun) 2014-01-24 15:27:42 +01:00
Steeve Lennmark
c2fa3a02ef Add documentation for --schema 2014-01-24 15:14:16 +01:00
Steeve Lennmark
e16472419f Fix regression while refactoring patch 2014-01-22 14:55:07 +01:00
Steeve Lennmark
1a10df9049 Add support for repacking an entire schema
This adds the option -c (--schema).
2014-01-22 14:23:56 +01:00
Daniele Varrazzo
53906c4f18 Bumping version to 1.2.0-beta1
Remember to put back the release status to 'stable' before releasing
the final version.

I hope I got the right version number format for PGXN...
2013-11-05 02:24:42 +00:00
Daniele Varrazzo
18f75951e2 Remove generated blank lines from legacy .sql file
They appear cause portability problems.
Fixes issue #12.
2013-11-05 02:24:42 +00:00
Daniele Varrazzo
57922b552c Docs cleanup before releasing 1.2 2013-11-05 01:39:07 +00:00
Daniele Varrazzo
81c99de210 README updated with pg_repack 1.1/1.2 differences 2013-11-05 01:38:47 +00:00
FIRST man
7487a775d5 skip transactions and locks in other databases when checking pg_locks' entries
problem: in case there are open transactions on other databases then the
         one pg_repack is working on and pg_locks doesn't contain any
         information about the affected database oid of the locked relation
         (e.g. there is no locked relation, only an open transaction),
         pg_repack will wait for that connection to release the lock
         (even if the relation that gets reorganized is held in an
         different database).

solution: join pg_database (via pg_stat_activity's datid) and check
          if the connection (of the conflicted transaction) is established
          on a different database than the relation treated by pg_repack
          and skip them.
          furthermore don't exclude transactions from other databases when
          shared objects are locked.
2013-08-02 15:22:16 +02:00
Josh Kupershmidt
d1ab1f7882 Check "relkind" instead of "reltype" in pg_class for clarity. 2013-07-08 09:20:40 -04:00
Josh Kupershmidt
27ea0fabe4 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
2013-07-05 21:02:28 -04:00
Josh Kupershmidt
03015f8ee8 Regression tests for the new indexes-repacking features.
Patch from Beena Emerson.
2013-07-04 09:47:31 -04:00