Skip to content

Instantly share code, notes, and snippets.

@schmiddy
schmiddy / tighten_version_checking.diff
Created October 17, 2012 04:53
pg_reorg version checking in Makefile, and remove further unneeded macros in ./lib/reorg.c
diff --git a/Makefile b/Makefile
index 01e02e3..e9b251b 100755
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,15 @@ endif
SUBDIRS = bin lib
+# Pull out the version number from pg_config
+VERSION = $(shell $(PG_CONFIG) --version | awk '{print $$2}')
@schmiddy
schmiddy / client_must_be_superuser.diff
Created November 30, 2012 04:17
must be superuser check for pg_repack client
diff --git a/bin/pg_repack.c b/bin/pg_repack.c
index dd24c91..86fac9c 100644
--- a/bin/pg_repack.c
+++ b/bin/pg_repack.c
@@ -82,6 +82,7 @@ typedef struct repack_index
const char *create_index; /* CREATE INDEX */
} repack_index;
+static bool is_superuser(void);
static void repack_all_databases(const char *order_by);
BEGIN;
drop table if exists users cascade;
drop table if exists contacts;
create table users (userid int not null primary key);
insert into users (userid) SELECT i FROM generate_series(1, 100000) AS i;
-- Table: contacts
-- DROP TABLE contacts;
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 5b5d31b..418665a 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -46,6 +46,7 @@
#include "storage/procarray.h"
#include "storage/sinvaladt.h"
#include "storage/smgr.h"
+#include "utils/builtins.h"
#include "utils/catcache.h"
@schmiddy
schmiddy / nm_D_output_after_fix
Created May 31, 2015 23:19
output from `nm -D pg_repack.so` after fix 949c0ad1500369f696e4b47417b05d062ee5093c
U abort
U appendStringInfo
U appendStringInfoString
U appendStringInfoVA
U assert_enabled
U ATExecChangeOwner
U CatalogCloseIndexes
U CatalogIndexInsert
U CatalogOpenIndexes
U CommandCounterIncrement
@schmiddy
schmiddy / nm_D_output_before_fix
Created May 31, 2015 23:19
output from `nm -D pg_repack.so` before fix
U abort
U appendStringInfo
U appendStringInfoString
U appendStringInfoVA
U assert_enabled
U ATExecChangeOwner
0000000000205a48 B __bss_start
U CatalogCloseIndexes
U CatalogIndexInsert
U CatalogOpenIndexes
(gdb) bt
#0 0x00007fbbff2f1d2d in read () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007fbbfcb002b6 in read (__nbytes=4, __buf=0x7fff7c86be9c, __fd=16)
at /usr/include/x86_64-linux-gnu/bits/unistd.h:45
#2 _Billiard_conn_recvall (h=16, buffer=<optimized out>, length=4)
at Modules/_billiard/socket_connection.c:76
#3 0x00007fbbfcb00811 in Billiard_conn_recv_string (
buffer=0x1d4fcc0 "\200\002K\002(M\033\001Nccelery.app.trace\n_fast_trace_task\nq\001(XA", buflength=131072, newbuffer=0x7fff7c86bef8,
maxlength=9223372036854775807, conn=<optimized out>)
at Modules/_billiard/socket_connection.c:149
(gdb) bt
#0 0x00007fcf9a5e0a03 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x000000000049531a in ?? ()
#2 0x000000000056d4a4 in PyEval_EvalFrameEx ()
#3 0x00000000005747c0 in PyEval_EvalCodeEx ()
#4 0x000000000056da48 in PyEval_EvalFrameEx ()
#5 0x00000000005747c0 in PyEval_EvalCodeEx ()
#6 0x000000000056da48 in PyEval_EvalFrameEx ()
#7 0x000000000056853a in ?? ()
#8 0x000000000043b910 in ?? ()
[2015-07-29 17:54:51,417: ERROR/MainProcess] Task some.task.name[3b9ac505-6589-4324-a3f2-67474636464b] raised unexpected: TimeLimitExceeded(100.0,)
Traceback (most recent call last):
File "/opt/venvs/current/lib/python2.7/site-packages/billiard/pool.py", line 641, in on_hard_timeout
raise TimeLimitExceeded(job._timeout)
TimeLimitExceeded: TimeLimitExceeded(100.0,)
[2015-07-29 17:54:51,418: ERROR/MainProcess] Hard time limit (100.0s) exceeded for some.task.name[3b9ac505-6589-4324-a3f2-67474636464b]
[2015-07-29 17:54:51,860: ERROR/MainProcess] Task some.task.name[de4e6e8e-6fd6-485b-a836-591db6f50a04] raised unexpected: TimeLimitExceeded(100.0,)
Traceback (most recent call last):
File "/opt/venvs/current/lib/python2.7/site-packages/billiard/pool.py", line 641, in on_hard_timeout
raise TimeLimitExceeded(job._timeout)
#0 0x00007fe3e92a5d2d in read () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007fe3e6ab42b6 in read (__nbytes=4, __buf=0x7fff26ffffcc, __fd=5)
at /usr/include/x86_64-linux-gnu/bits/unistd.h:45
#2 _Billiard_conn_recvall (h=5, buffer=<optimized out>, length=4)
at Modules/_billiard/socket_connection.c:76
#3 0x00007fe3e6ab4811 in Billiard_conn_recv_string (
buffer=0x1436cc0 "\200\002K\002(M\333\001Nccelery.app.trace\n_fast_trace_task\nq\001(XA", buflength=131072, newbuffer=0x7fff27000028,
maxlength=9223372036854775807, conn=<optimized out>)
at Modules/_billiard/socket_connection.c:149
#4 0x00007fe3e6ab492c in Billiard_connection_recv_payload (self=0x1436ca0)