Merge branch 'master' into 21_dryrun

This commit is contained in:
schmiddy 2014-05-23 23:35:25 -04:00
commit 69aa4f741d
8 changed files with 111 additions and 24 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.so
regress/regression.diffs
regress/regression.out
dist/*.zip

View File

@ -2,18 +2,18 @@
"name": "pg_repack",
"abstract": "PostgreSQL module for data reorganization",
"description": "Reorganize tables in PostgreSQL databases with minimal locks",
"version": "1.2.0-beta1",
"version": "1.2.1",
"maintainer": [
"Josh Kupershmidt <schmiddy@gmail.com>",
"Daniele Varrazzo <daniele.varrazzo@gmail.com>"
],
"tags": [ "bloat", "maintenance", "vacuum", "cluster" ],
"release_status": "testing",
"release_status": "stable",
"license": "bsd",
"provides": {
"pg_repack": {
"file": "lib/pg_repack.sql",
"version": "1.2.0-beta1",
"version": "1.2.1",
"abstract": "Reorganize tables in PostgreSQL databases with minimal locks"
}
},

View File

@ -7,19 +7,26 @@
#
PG_CONFIG ?= pg_config
EXTENSION = pg_repack
# Pull out the version number from pg_config
.PHONY: dist/$(EXTENSION)-$(EXTVERSION).zip
# Pull out PostgreSQL version number from pg_config
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
ifeq ("$(VERSION)","")
$(error pg_config not found)
endif
# version as a number, e.g. 9.1.4 -> 901
# PostgreSQL version as a number, e.g. 9.1.4 -> 901
INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed 's/\([[:digit:]]\{1,\}\)\.\([[:digit:]]\{1,\}\).*/\1*100+\2/'))))
# The version number of the library
EXTVERSION = $(shell grep '"version":' META.json | head -1 \
| sed -e 's/[ ]*"version":[ ]*"\(.*\)",/\1/')
# We support PostgreSQL 8.3 and later.
ifeq ($(shell echo $$(($(INTVERSION) < 803))),1)
$(error pg_repack requires PostgreSQL 8.3 or later. This is $(VERSION))
$(error $(EXTENSION) requires PostgreSQL 8.3 or later. This is $(VERSION))
endif
@ -36,3 +43,12 @@ check installcheck:
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
done; \
exit $$CHECKERR
# Prepare the package for PGXN submission
package: dist dist/$(EXTENSION)-$(EXTVERSION).zip
dist:
mkdir -p dist
dist/$(EXTENSION)-$(EXTVERSION).zip:
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ --output $@ master

View File

@ -17,31 +17,34 @@ CLUSTER directly.
Please check the documentation (in the ``doc`` directory or online_) for
installation and usage instructions.
All users of pg_reorg 1.1.9 or earlier, and pg_repack 1.2.0-beta1 or earlier,
are **urged to upgrade** to the latest pg_repack version to fix a serious
data corruption issue_.
.. _pg_repack: http://reorg.github.com/pg_repack
.. _CLUSTER: http://www.postgresql.org/docs/current/static/sql-cluster.html
.. _VACUUM FULL: VACUUM_
.. _VACUUM: http://www.postgresql.org/docs/current/static/sql-vacuum.html
.. _online: pg_repack_
.. _issue: https://github.com/reorg/pg_repack/issues/23
What about pg_reorg?
--------------------
pg_repack is a fork of the pg_reorg_ project, which has proven hugely
successful. Unfortunately development appears to have stopped after the
release of the version 1.1.7, around August 2011.
successful. Unfortunately new feature development on pg_reorg_ has slowed
or stopped since late 2011.
pg_repack 1.1.8 was released as a drop-in replacement for pg_reorg, addressing
some of the shortcomings of the last pg_reorg version (such as support for
PostgreSQL 9.2 and EXTENSION packaging) and known bugs. Shortly after the
first pg_repack release, pg_reorg 1.1.8 was released too, merging all the
pg_repack changes. Version 1.1.8 is the last pg_reorg release at the time of
writing.
pg_repack was initially released as a drop-in replacement for pg_reorg,
addressing some of the shortcomings of the last pg_reorg version (such as
support for PostgreSQL 9.2 and EXTENSION packaging) and known bugs.
pg_repack 1.2 is a new development line based on the original pg_reorg
codebase and offering new features. Its behaviour may be different from the
1.1.x release so it shouldn't be considered a drop-in replacement: you are
advised to check the documentation__ before upgrading from previous versions.
pg_repack 1.2 introduces further new features (parallel index builds,
ability to rebuild only indexes) and bugfixes. In some cases its behaviour
may be different from the 1.1.x release so it shouldn't be considered a
drop-in replacement: you are advised to check the documentation__ before
upgrading from previous versions.
.. __: pg_repack_
.. _pg_reorg: http://reorg.projects.pgfoundry.org/

View File

@ -450,6 +450,7 @@ Releases
* Don't wait for locks held in other databases (pg_repack issue #11).
* Bugfix: correctly handle key indexes with options such as DESC, NULL
FIRST/LAST, COLLATE (pg_repack issue #3).
* Fixed data corruption bug on delete (pg_repack issue #23).
* More helpful program output and error messages.
* pg_repack 1.1.8

63
doc/release.rst Normal file
View File

@ -0,0 +1,63 @@
What to do to release pg_repack
===============================
This document is the list of operations to do to release a new pg_repack
version. The version number in this document is indicated by ``$VER``: it
should be a three-digit dot-separated version, eventually followed by a
pre-release string: ``1.2.0``, ``1.2.1``, ``1.2-dev0``, ``1.2.0-beta1`` are
valid version numbers.
In order to release the package you will accounts on Github, Freecode and PGXN
with the right privileges: contact Daniele Varrazzo to obtain them.
- Set the right version number in ``META.json`` (note: it's in two different
places).
- Set the right release_status in ``META.json``: ``testing`` or ``stable``.
- Commit the above metadata changes.
- Create a tag, signed if possible::
git tag -a -s ver_$VER
- Create a package running ``make package``. The package will be called
``dist/pg_repack-$VER.zip``.
- Check the packages installs and tests ok with `pgxn client`__::
pgxn install --sudo -- dist/pg_repack-$VER.zip
pgxn check dist/pg_repack-$VER.zip
(note that ``check`` may require the Postgres bin directory to be added to
the path; check the ``install`` log to see where ``pg_repack`` executable
was installed).
.. __: http://pgxnclient.projects.pgfoundry.org/
- Push the code changes and tags on github::
git push
git push --tags
- Upload the package on http://manager.pgxn.org/.
- Check the uploaded package works as expected::
pgxn install --sudo -- pg_repack
pgxn check pg_repack
- Upload the docs by pushing in the repos at
http://reorg.github.io/pg_repack/. The operations are roughly::
git clone git@github.com:reorg/reorg.github.com.git
cd reorg.github.com.git
git submodule init
git submodule update
make
git commit -a -m "Docs upload for release $VER"
git push
- Check the page http://reorg.github.io/pg_repack/ is right.
- Announce the package on reorg-general@pgfoundry.org and
pgsql-announce@postgresql.org.
- Announce the package on http://freecode.com/.

View File

@ -190,7 +190,7 @@ CREATE VIEW repack.tables AS
'INSERT INTO repack.table_' || R.oid || ' VALUES ($1.*)' AS sql_insert,
'DELETE FROM repack.table_' || R.oid || ' WHERE ' || repack.get_compare_pkey(PK.indexrelid, '$1') AS sql_delete,
'UPDATE repack.table_' || R.oid || ' SET ' || repack.get_assign(R.oid, '$2') || ' WHERE ' || repack.get_compare_pkey(PK.indexrelid, '$1') AS sql_update,
'DELETE FROM repack.log_' || R.oid || ' WHERE id <= $1' AS sql_pop
'DELETE FROM repack.log_' || R.oid || ' WHERE id = $1' AS sql_pop
FROM pg_class R
LEFT JOIN pg_class T ON R.reltoastrelid = T.oid
LEFT JOIN repack.primary_keys PK

View File

@ -282,13 +282,16 @@ repack_apply(PG_FUNCTION_ARGS)
plan_update = repack_prepare(sql_update, 2, &argtypes[1]);
execute_plan(SPI_OK_UPDATE, plan_update, &values[1], &nulls[1]);
}
/* Delete tuple in log.
* XXX It would be a lot more efficient to perform
* this DELETE in bulk, but be careful to only
* delete log entries we have actually processed.
*/
if (plan_pop == NULL)
plan_pop = repack_prepare(sql_pop, 1, argtypes);
execute_plan(SPI_OK_DELETE, plan_pop, values, nulls);
}
/* delete tuple in log */
if (plan_pop == NULL)
plan_pop = repack_prepare(sql_pop, 1, argtypes);
execute_plan(SPI_OK_DELETE, plan_pop, values, nulls);
SPI_freetuptable(tuptable);
}