Skip to content

Commit 82f936e

Browse files
committed
Add 'contrib/pg_repack/' from commit '8711ae5b2abaa6430f652456c8c03872d6f7917c'
git-subtree-dir: contrib/pg_repack git-subtree-mainline: f11cb69 git-subtree-split: 8711ae5
2 parents f11cb69 + 8711ae5 commit 82f936e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+12316
-0
lines changed

contrib/pg_repack/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Global excludes across all subdirectories
2+
*.o
3+
*.so
4+
regress/regression.diffs
5+
regress/regression.out
6+
regress/results/
7+
dist/*.zip
8+
lib/exports.list

contrib/pg_repack/COPYRIGHT

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
2+
Portions Copyright (c) 2011, Itagaki Takahiro
3+
Portions Copyright (c) 2012-2015, The Reorg Development Team
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in the
13+
documentation and/or other materials provided with the distribution.
14+
* Neither the name of the authors nor the names of its contributors may
15+
be used to endorse or promote products derived from this software
16+
without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

contrib/pg_repack/META.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "pg_repack",
3+
"abstract": "PostgreSQL module for data reorganization",
4+
"description": "Reorganize tables in PostgreSQL databases with minimal locks",
5+
"version": "1.3.4",
6+
"maintainer": [
7+
"Josh Kupershmidt <schmiddy@gmail.com>",
8+
"Daniele Varrazzo <daniele.varrazzo@gmail.com>",
9+
"Beena Emerson <memissemerson@gmail.com>"
10+
],
11+
"tags": [ "bloat", "maintenance", "vacuum", "cluster" ],
12+
"release_status": "stable",
13+
"license": "bsd",
14+
"provides": {
15+
"pg_repack": {
16+
"file": "lib/pg_repack.sql",
17+
"version": "1.3.4",
18+
"abstract": "Reorganize tables in PostgreSQL databases with minimal locks"
19+
}
20+
},
21+
"prereqs": {
22+
"runtime": {
23+
"requires": {
24+
"PostgreSQL": "8.3.0"
25+
}
26+
}
27+
},
28+
"resources": {
29+
"homepage": "http://reorg.github.com/pg_repack",
30+
"bugtracker": {
31+
"web": "https://github.com/reorg/pg_repack/issues"
32+
},
33+
"repository": {
34+
"url": "git://github.com/reorg/pg_repack.git",
35+
"web": "https://github.com/reorg/pg_repack/",
36+
"type": "git"
37+
}
38+
},
39+
"meta-spec": {
40+
"version": "1.0.0",
41+
"url": "http://pgxn.org/meta/spec.txt"
42+
}
43+
}

contrib/pg_repack/Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# pg_repack: Makefile
3+
#
4+
# Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
5+
# Portions Copyright (c) 2011, Itagaki Takahiro
6+
# Portions Copyright (c) 2012-2015, The Reorg Development Team
7+
#
8+
9+
PG_CONFIG ?= pg_config
10+
EXTENSION = pg_repack
11+
12+
.PHONY: dist/$(EXTENSION)-$(EXTVERSION).zip
13+
14+
# Pull out PostgreSQL version number from pg_config
15+
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
16+
ifeq ("$(VERSION)","")
17+
$(error pg_config not found)
18+
endif
19+
20+
# PostgreSQL version as a number, e.g. 9.1.4 -> 901
21+
INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed 's/\([[:digit:]]\{1,\}\)\.\([[:digit:]]\{1,\}\).*/\1*100+\2/'))))
22+
23+
# The version number of the library
24+
EXTVERSION = $(shell grep '"version":' META.json | head -1 \
25+
| sed -e 's/[ ]*"version":[ ]*"\(.*\)",/\1/')
26+
27+
ifeq ($(shell echo $$(($(INTVERSION) < 803))),1)
28+
$(error $(EXTENSION) requires PostgreSQL 8.3 or later. This is $(VERSION))
29+
endif
30+
31+
SUBDIRS = bin lib regress
32+
33+
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
34+
@for dir in $(SUBDIRS); do \
35+
$(MAKE) -C $$dir $@ || exit; \
36+
done
37+
38+
# We'd like check operations to run all the subtests before failing.
39+
check installcheck:
40+
@CHECKERR=0; for dir in $(SUBDIRS); do \
41+
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
42+
done; \
43+
exit $$CHECKERR
44+
45+
# Prepare the package for PGXN submission
46+
package: dist dist/$(EXTENSION)-$(EXTVERSION).zip
47+
48+
dist:
49+
mkdir -p dist
50+
51+
dist/$(EXTENSION)-$(EXTVERSION).zip:
52+
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ --output $@ master

contrib/pg_repack/README.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
pg_repack -- Reorganize tables in PostgreSQL databases with minimal locks
2+
=========================================================================
3+
4+
- Homepage: http://reorg.github.com/pg_repack
5+
- Download: http://pgxn.org/dist/pg_repack/
6+
- Development: https://github.com/reorg/pg_repack
7+
- Bug Report: https://github.com/reorg/pg_repack/issues
8+
- Mailing List: http://pgfoundry.org/mailman/listinfo/reorg-general
9+
10+
pg_repack_ is a PostgreSQL extension which lets you remove bloat from
11+
tables and indexes, and optionally restore the physical order of clustered
12+
indexes. Unlike CLUSTER_ and `VACUUM FULL`_ it works online, without
13+
holding an exclusive lock on the processed tables during processing.
14+
pg_repack is efficient to boot, with performance comparable to using
15+
CLUSTER directly.
16+
17+
Please check the documentation (in the ``doc`` directory or online_) for
18+
installation and usage instructions.
19+
20+
All users of pg_reorg 1.1.9 or earlier, and pg_repack 1.2.0-beta1 or earlier,
21+
are **urged to upgrade** to the latest pg_repack version to fix a serious
22+
data corruption issue_.
23+
24+
.. _pg_repack: http://reorg.github.com/pg_repack
25+
.. _CLUSTER: http://www.postgresql.org/docs/current/static/sql-cluster.html
26+
.. _VACUUM FULL: VACUUM_
27+
.. _VACUUM: http://www.postgresql.org/docs/current/static/sql-vacuum.html
28+
.. _online: pg_repack_
29+
.. _issue: https://github.com/reorg/pg_repack/issues/23
30+
31+
32+
What about pg_reorg?
33+
--------------------
34+
35+
pg_repack is a fork of the pg_reorg_ project, which has proven hugely
36+
successful. Unfortunately new feature development on pg_reorg_ has slowed
37+
or stopped since late 2011.
38+
39+
pg_repack was initially released as a drop-in replacement for pg_reorg,
40+
addressing some of the shortcomings of the last pg_reorg version (such as
41+
support for PostgreSQL 9.2 and EXTENSION packaging) and known bugs.
42+
43+
pg_repack 1.2 introduces further new features (parallel index builds,
44+
ability to rebuild only indexes) and bugfixes. In some cases its behaviour
45+
may be different from the 1.1.x release so it shouldn't be considered a
46+
drop-in replacement: you are advised to check the documentation__ before
47+
upgrading from previous versions.
48+
49+
.. __: pg_repack_
50+
.. _pg_reorg: http://reorg.projects.pgfoundry.org/
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPEC file for pg_repack
2+
# Copyright(C) 2009-2010 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
3+
%define sname pg_repack
4+
5+
Summary: Reorganize tables in PostgreSQL databases without any locks.
6+
Name: %{sname}
7+
Version: 1.1.5
8+
Release: 1%{?dist}
9+
License: BSD
10+
Group: Applications/Databases
11+
Source0: %{sname}-%{version}.tar.gz
12+
URL: http://pgfoundry.org/projects/%{sname}/
13+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
14+
15+
BuildRequires: postgresql-devel, postgresql
16+
Requires: postgresql, postgresql-libs
17+
18+
%description
19+
pg_repack can re-organize tables on a postgres database without any locks so that
20+
you can retrieve or update rows in tables being reorganized.
21+
The module is developed to be a better alternative of CLUSTER and VACUUM FULL.
22+
23+
%prep
24+
%setup -q -n %{sname}-%{version}
25+
26+
%build
27+
USE_PGXS=1 make %{?_smp_mflags}
28+
29+
%install
30+
rm -rf %{buildroot}
31+
USE_PGXS=1 make DESTDIR=%{buildroot}
32+
33+
install -d %{buildroot}%{_libdir}/pgsql
34+
install -d %{buildroot}%{_bindir}
35+
install -d %{buildroot}%{_datadir}/pgsql/contrib
36+
37+
install -m 755 bin/pg_repack %{buildroot}%{_bindir}/pg_repack
38+
install -m 755 lib/pg_repack.so %{buildroot}%{_libdir}/pgsql/pg_repack.so
39+
install -m 644 lib/pg_repack.sql %{buildroot}%{_datadir}/pgsql/contrib/pg_repack.sql
40+
install -m 644 lib/uninstall_pg_repack.sql %{buildroot}%{_datadir}/pgsql/contrib/uninstall_pg_repack.sql
41+
42+
%define pg_sharedir
43+
44+
%files
45+
%defattr(755,root,root,755)
46+
%{_bindir}/pg_repack
47+
%{_libdir}/pgsql/pg_repack.so
48+
%defattr(644,root,root,755)
49+
%{_datadir}/pgsql/contrib/pg_repack.sql
50+
%{_datadir}/pgsql/contrib/uninstall_pg_repack.sql
51+
52+
%clean
53+
rm -rf %{buildroot}
54+
55+
%changelog
56+
* Thu Oct 21 2010 - NTT OSS Center <sakamoto.masahiko@oss.ntt.co.jp> 1.1.5-1
57+
* Wed Sep 22 2010 - NTT OSS Center <sakamoto.masahiko@oss.ntt.co.jp> 1.1.4-1
58+
* Thu Apr 22 2010 - NTT OSS Center <itagaki.takahiro@oss.ntt.co.jp> 1.1.2-1
59+
* Mon Jan 15 2010 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.8-1
60+
* Tue Sep 08 2009 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.6-1
61+
* Fri May 15 2009 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.4-1
62+
- Initial packaging
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPEC file for pg_repack
2+
# Copyright(C) 2009-2010 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
3+
%define sname pg_repack
4+
5+
%define _pgdir /usr/pgsql-9.0
6+
%define _bindir %{_pgdir}/bin
7+
%define _libdir %{_pgdir}/lib
8+
%define _datadir %{_pgdir}/share
9+
10+
Summary: Reorganize tables in PostgreSQL databases without any locks.
11+
Name: %{sname}
12+
Version: 1.1.5
13+
Release: 1%{?dist}
14+
License: BSD
15+
Group: Applications/Databases
16+
Source0: %{sname}-%{version}.tar.gz
17+
URL: http://pgfoundry.org/projects/%{sname}/
18+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
19+
20+
BuildRequires: postgresql90-devel, postgresql90
21+
Requires: postgresql90, postgresql90-libs
22+
23+
%description
24+
pg_repack can re-organize tables on a postgres database without any locks so that
25+
you can retrieve or update rows in tables being reorganized.
26+
The module is developed to be a better alternative of CLUSTER and VACUUM FULL.
27+
28+
%prep
29+
%setup -q -n %{sname}-%{version}
30+
31+
%build
32+
USE_PGXS=1 make %{?_smp_mflags}
33+
34+
%install
35+
rm -rf %{buildroot}
36+
USE_PGXS=1 make DESTDIR=%{buildroot}
37+
38+
install -d %{buildroot}%{_libdir}
39+
install -d %{buildroot}%{_bindir}
40+
install -d %{buildroot}%{_datadir}/contrib
41+
42+
install -m 755 bin/pg_repack %{buildroot}%{_bindir}/pg_repack
43+
install -m 755 lib/pg_repack.so %{buildroot}%{_libdir}/pg_repack.so
44+
install -m 644 lib/pg_repack.sql %{buildroot}%{_datadir}/contrib/pg_repack.sql
45+
install -m 644 lib/uninstall_pg_repack.sql %{buildroot}%{_datadir}/contrib/uninstall_pg_repack.sql
46+
47+
%define pg_sharedir
48+
49+
%files
50+
%defattr(755,root,root,755)
51+
%{_bindir}/pg_repack
52+
%{_libdir}/pg_repack.so
53+
%defattr(644,root,root,755)
54+
%{_datadir}/contrib/pg_repack.sql
55+
%{_datadir}/contrib/uninstall_pg_repack.sql
56+
57+
%clean
58+
rm -rf %{buildroot}
59+
60+
%changelog
61+
* Thu Oct 21 2010 - NTT OSS Center <sakamoto.masahiko@oss.ntt.co.jp> 1.1.5-1
62+
* Wed Sep 22 2010 - NTT OSS Center <sakamoto.masahiko@oss.ntt.co.jp> 1.1.4-1
63+
* Thu Apr 22 2010 - NTT OSS Center <itagaki.takahiro@oss.ntt.co.jp> 1.1.2-1
64+
* Mon Jan 15 2010 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.8-1
65+
* Tue Sep 08 2009 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.6-1
66+
* Fri May 15 2009 - Toru SHIMOGAKI <shimogaki.toru@oss.ntt.co.jp> 1.0.4-1
67+
- Initial packaging

contrib/pg_repack/bin/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.deps/
2+
/pg_repack
3+
/results/
4+
/sql/init.sql
5+
/sql/init-*.*.sql

contrib/pg_repack/bin/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# pg_repack: bin/Makefile
3+
#
4+
# Portions Copyright (c) 2008-2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
5+
# Portions Copyright (c) 2011, Itagaki Takahiro
6+
# Portions Copyright (c) 2012-2015, The Reorg Development Team
7+
#
8+
9+
PG_CONFIG ?= pg_config
10+
11+
SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c
12+
OBJS = $(SRCS:.c=.o)
13+
PROGRAM = pg_repack
14+
15+
16+
# The version number of the program. It should be the same of the library.
17+
REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \
18+
| sed -e 's/[ ]*"version":[ ]*"\(.*\)",/\1/')
19+
20+
PG_CPPFLAGS = -I$(libpq_srcdir) -DREPACK_VERSION=$(REPACK_VERSION)
21+
22+
ifdef DEBUG_REPACK
23+
PG_CPPFLAGS += -DDEBUG_REPACK
24+
endif
25+
26+
PG_LIBS = $(libpq)
27+
28+
USE_PGXS = 1 # use pgxs if not in contrib directory
29+
PG_CONFIG = pg_config
30+
PGXS := $(shell $(PG_CONFIG) --pgxs)
31+
include $(PGXS)
32+
33+
# remove dependency on libxml2, libxslt, and libpam.
34+
# XXX: find a better way to make sure we are linking with libraries
35+
# from pg_config which we actually need.
36+
LIBS := $(filter-out -lxml2, $(LIBS))
37+
LIBS := $(filter-out -lxslt, $(LIBS))
38+
LIBS := $(filter-out -lpam, $(LIBS))

0 commit comments

Comments
 (0)