221 Commits

Author SHA1 Message Date
Daniele Varrazzo
7413a65985 Merge remote-tracking branch 'origin/master' into pg10 2017-09-25 02:45:49 +01:00
Daniele Varrazzo
9e4dd00415 Dropped compiler warning
Probably only raised compiling on 32 bits platforms.
2017-09-25 02:37:29 +01:00
Masahiko Sawada
900bb8369b Reset the transcation state before exiting from lock_exclusive.
Previously we exited from lock_exclusive() while opening the
transaction that started at beggning if --no-kill-backend option
is specified. This caused that DROP INDEX CONCURRENTLY fails
because it cannot be executed within a user transaction block.

Fixed issue #129.
2017-08-18 15:25:04 +09:00
Justin Pryzby
1b651bd3d9 Avoid return from lock_exclusive() while in transaction ..
..causing "ERROR: DROP INDEX CONCURRENTLY cannot run inside a transaction block"
github#129
2017-08-18 15:21:09 +09:00
Masahiko Sawada
34e71adbbd Fix a typo in pg_repack.c file. 2017-08-05 20:16:31 +09:00
Masahiko Sawada
33f4c30563 Fix reorganize table without sorting.
Commit 5adff6ff0b88d6f162719eff7176069730537c2a separated the
data copy from creating table. This is a cause of bug that
pg_repack doesn't actually sort table during reorganization.
This commit fixes this issue by adding ORDER BY clause to Copy
SQL rather than CREATE TABLE SQL.

Reported by acmzero on issue #138.
2017-08-05 02:31:47 +09:00
Masahiko Sawada
c2ed98a85b Fix a small memory leak in repack_one_database function.
Noticed by coverity scan.
2017-07-12 17:04:33 -07:00
Daniele Varrazzo
19e34a3202 Added PG 10 compatibility wrapper to simple_prompt()
Also checking for malloc failure into previous version's simple_prompt()
calls.
2017-04-25 15:09:27 +01:00
Dmitry Ivanov
e1f362e831 resolve conflicts 2017-04-19 14:05:53 +03:00
Nicola Murino
05fac2dac3 fix compilation with msvc
__attribute__ macro is not defined in msvc and it is not essential to
the implementation. All it does  is tell the compiler that this function
is similar to printf, and  expects a printf-like format string
So for MSVC we define __attribute__ as a macro that do nothing
2017-04-19 11:54:46 +01:00
Masahiko Sawada
5adff6ff0b Set column storage type before first copying table.
Previously, even if the table whose column storage type has been
changed the pg_repack did first copy the data to table without changing
column storage paramater. This cause of that the existing data is
pushed out to its toast table even if actual column storage type is
"main".

Issue #94.
2017-04-10 23:25:49 +01:00
Daniele Varrazzo
cf6fe7d4cf Dropped redundant/wrong pg_config definition
Fix issue #24. The OP reported that the issue is solved by dropping this
assignment. The one in regress has been already dropped in the
refactoring to drop pre-9.1 support.
2017-04-10 22:04:28 +01:00
Daniele Varrazzo
86eef300f1 Dropped C code used by unsupported PG versions 2017-04-10 11:44:17 +01:00
Dmitry Ivanov
9f54321e32 Merge branch 'master' into support_table_inheritance 2017-03-30 13:37:54 +03:00
Daniele Varrazzo
8a73172606 Fixed query on PostgreSQL 9.1 2017-03-29 04:38:36 +01:00
Dmitry Ivanov
6d8ff6ba19 extend safety checks for -I 2017-03-24 17:02:12 +03:00
Dmitry Ivanov
4e90fe9b48 resolve conflicts 2017-03-24 16:54:16 +03:00
Masahiko Sawada
9422daae7a Merge branch 'optional_include_extensions' of https://github.com/funbringer/pg_repack into funbringer-optional_include_extensions 2017-03-24 17:38:49 +09:00
Daniele Varrazzo
fe519cf017 Dropped further libs not needed for build 2017-03-23 18:50:22 +00:00
Dmitry Ivanov
e1f41aa6d8 add new option checks for -C 2017-03-23 16:05:59 +03:00
Dmitry Ivanov
1ecec8ce95 change option to '--exclude-extension' 2017-03-23 15:24:41 +03:00
Dmitry Ivanov
e89559a813 resolve conflicts 2017-03-23 14:14:18 +03:00
Dmitry Ivanov
0e3ed0d5e1 fix typos and formatting, implement -I in repack_all_indexes() 2017-03-22 14:15:48 +03:00
Dmitry Ivanov
68dc592545 introduce option --parent-table (-I, stands for 'inheritance'), fix function repack_one_database(), introduce function repack.get_table_and_inheritors() 2017-03-20 23:05:26 +03:00
Nathan Bossart
1f784089a6 Added regression testing for --no-superuser-check option. 2017-03-02 02:58:41 +00:00
bossartn
7471eeaa0c Merge branch 'master' into no_superuser_check 2017-03-01 08:34:29 -08:00
masahiko
b329f9e143 Merge pull request #108 from MasahikoSawada/dont_kill_backend
Introduce --no-kill-backend option.
2017-02-23 09:39:36 +09:00
Masahiko Sawada
9ef8f9f80b Improve error message more explicitely when time out.
This change distinguishes error message between failed to cancel
query due to time out and abandoning to cancel query due to timeout.
2017-02-22 06:03:54 +00:00
Masahiko Sawada
f6c1304c36 Change the option name to no-kill-backend.
For consistency with other slimilar option such as no-order,
no-analyze.
2017-02-22 03:49:04 +00:00
masahiko
5781aabb61 Merge pull request #107 from MasahikoSawada/change_to_after_trigger
Change trigger type to AFTER trigger.
2017-02-22 12:08:32 +09:00
Masahiko Sawada
e8d6b6b97f Change format identifier %lu in pgut.c file. 2017-02-21 12:23:18 +00:00
Nathan Bossart
168676b3b6 Introduce --no-superuser-check option.
The current client checks for superuser before attempting to
execute pg_repack commands. In Amazon RDS, customers are given
access to a psuedo-superuser role called rds_superuser, but they
are not given access to superuser. However, rds_superusers will
otherwise have the ability to execute pg_repack commands in RDS.

This change introduces the --no-superuser-check option in the
client code so that users can disable the client-side superuser
checks.
2017-02-15 03:15:03 +00:00
Masahiko Sawada
ff8cb96c74 Add white space to COUNT_COMPETING_LOCKS sql.
Pointed out by schmiddy.
2017-02-02 19:59:18 +09:00
Masahiko Sawada
34c6506f54 Introduce --dont-kill-backend option.
pg_repack needs to take an exclusive lock at the end of the
reorganization. If the lock cannot be taken after duration
--wait-timeout option specified and this option is true,
pg_repack gives up to repack a target table instead of
cancelling conflicting backend. False by default.
2017-01-24 14:47:00 +09:00
Masahiko Sawada
375f03c0c3 Change trigger name from a_repack_trigger to repack_trigger.
In AFTER trigger context, since triggered tuple is not changed by
any other triggers we can call it just repack_trigger.
2017-01-24 14:09:05 +09:00
Masahiko Sawada
d83ee3d6a0 Change trigger type to AFTER trigger.
During repacking table, if a transaction executes INSERT CONFLICT
ON UPDATE/DO NOTHING, because we define BEFORE trigger on target
table, the contents of operation log table becomes inconsistent
easliy. As a result, pg_reapck fails with a high probability.

To resolve this issue, this changes the trigger type from BEFORE
to AFTER. We define AFTER trigger that is the first of the AFTER
trigger to fire on the table.
2017-01-19 16:32:54 +09:00
Dmitry Ivanov
116fa68097 set 'include_extensions' to true if tables have been specified 2016-10-24 16:54:32 +03:00
Dmitry Ivanov
20beaf99f2 introduce new option 'include-extensions' which is aimed to prevent pg_repack from touching tables that belong to extensions 2016-10-24 16:11:12 +03:00
Alexander Korotkov
8e50927946 Comment about VACUUM. 2016-07-03 22:42:17 +03:00
Alexander Korotkov
3b0ef954cf Fix. 2016-07-03 21:19:45 +03:00
Josh Kupershmidt
eb2e9c39fb Whitespace cleanup. 2016-05-07 09:24:05 -04:00
Edwina Lu
dcce8e43e9 grab exclusive lock before dropping table 2016-04-15 14:34:41 -07: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
facbcf90dd Wrong precedence for these chained less-than / greater-thans. 2015-07-24 07:27:30 -04:00
Josh Kupershmidt
70cc5769c9 Remember to free repacked_indexes. 2015-05-29 21:18:45 -04:00
Josh Kupershmidt
ffb1980ce4 Remove remaining pgut_strdup() uses in favor of num_buff,
so no more of those tiny leaks.
2015-05-27 21:33:34 -04:00
amit
775a97dbd9 Get rid of hacky usage of pgut_strdup() in utoa.
From inspecting the call sites of utoa, it appears that some of them
(especially the recent cleanup patch which added the strdup there) wanted
to prevent overwriting a local variable by repeated call (to utoa) using
the same variable as argument. This commit instead makes such call sites
strdup the variable itself before passing it to utoa. That seems cleaner
considering that it does not seem utoa's contract to do so (strdup its
parameter that is).
2015-05-27 11:11:15 +09:00
Josh Kupershmidt
d3a99db9f9 Merge branch 'kotsachin-master' 2015-05-25 17:26:31 -04:00
Josh Kupershmidt
8fc8b656a2 Some comments about our new atexit handling. 2015-05-25 16:56:44 -04:00
Josh Kupershmidt
b6b6a8bfb3 Merge branch 'master' of https://github.com/kotsachin/pg_repack into kotsachin-master 2015-05-25 10:59:32 -06:00