Skip to content

Commit

Permalink
Merge branch 'support_for_postgresql_13'
Browse files Browse the repository at this point in the history
  • Loading branch information
dvarrazzo committed Sep 30, 2020
2 parents 493b574 + 66d7426 commit 5d75de5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
# Global excludes across all subdirectories
*.o
*.so
*.bc
regress/regression.diffs
regress/regression.out
regress/results/
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -4,10 +4,13 @@ dist: xenial
sudo: required

env:
- PGVER=13
- PGVER=12
- PGVER=11
- PGVER=10
- PGVER=9.6
# Disabled because packages broken at least on xenial
# https://www.postgresql.org/message-id/CA%2Bmi_8a1oEnCzkt0CvqysgY4MQ6jEefjmS%3Dq_K-AvOx%3DF7m2%2BQ%40mail.gmail.com
# - PGVER=9.6
- PGVER=9.5
- PGVER=9.4
- PGVER=9.3
Expand Down
4 changes: 2 additions & 2 deletions META.json
Expand Up @@ -2,7 +2,7 @@
"name": "pg_repack",
"abstract": "PostgreSQL module for data reorganization",
"description": "Reorganize tables in PostgreSQL databases with minimal locks",
"version": "1.4.5",
"version": "1.4.6",
"maintainer": [
"Beena Emerson <memissemerson@gmail.com>",
"Josh Kupershmidt <schmiddy@gmail.com>",
Expand All @@ -15,7 +15,7 @@
"provides": {
"pg_repack": {
"file": "lib/pg_repack.sql",
"version": "1.4.5",
"version": "1.4.6",
"abstract": "Reorganize tables in PostgreSQL databases with minimal locks"
}
},
Expand Down
6 changes: 5 additions & 1 deletion doc/pg_repack.rst
Expand Up @@ -40,7 +40,7 @@ Requirements
------------

PostgreSQL versions
PostgreSQL 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 10, 11, 12
PostgreSQL 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 10, 11, 12, 13

Disks
Performing a full-table repack requires free disk space about twice as
Expand Down Expand Up @@ -466,6 +466,10 @@ Creating indexes concurrently comes with a few caveats, please see `the document
Releases
--------

* pg_repack 1.4.6

* Added support for PostgreSQL 13

* pg_repack 1.4.5

* Added support for PostgreSQL 12
Expand Down
9 changes: 8 additions & 1 deletion lib/repack.c
Expand Up @@ -19,7 +19,6 @@

/*
* heap_open/heap_close was moved to table_open/table_close in 12.0
* table.h has macros mapping the old names to the new ones
*/
#if PG_VERSION_NUM >= 120000
#include "access/table.h"
Expand Down Expand Up @@ -1169,7 +1168,11 @@ swap_heap_or_index_files(Oid r1, Oid r2)
CatalogIndexState indstate;

/* We need writable copies of both pg_class tuples. */
#if PG_VERSION_NUM >= 120000
relRelation = table_open(RelationRelationId, RowExclusiveLock);
#else
relRelation = heap_open(RelationRelationId, RowExclusiveLock);
#endif

reltup1 = SearchSysCacheCopy(RELOID,
ObjectIdGetDatum(r1),
Expand Down Expand Up @@ -1332,7 +1335,11 @@ swap_heap_or_index_files(Oid r1, Oid r2)
heap_freetuple(reltup1);
heap_freetuple(reltup2);

#if PG_VERSION_NUM >= 120000
table_close(relRelation, RowExclusiveLock);
#else
heap_close(relRelation, RowExclusiveLock);
#endif
}

/**
Expand Down
20 changes: 17 additions & 3 deletions regress/travis_prepare.sh
Expand Up @@ -37,9 +37,23 @@ else
fi

sudo apt-get update
sudo apt-get install -y "libpq5=${PGVER}*" "libpq-dev=${PGVER}*"
sudo apt-mark hold libpq5
sudo apt-get install -y postgresql-server-dev-$PGVER postgresql-$PGVER

# This might be a moving target, but it currently fails. 13 could start
# failing in the future instead.
# Some versions break if this is not specified (9.4 for sure, maybe 9.6)
if [[ "$PGVER" = "9.4" ]]; then
sudo apt-get install -y "libpq5=${PGVER}*" "libpq-dev=${PGVER}*"
sudo apt-mark hold libpq5
fi

if ! sudo apt-get install -y \
postgresql-$PGVER \
postgresql-client-$PGVER \
postgresql-server-dev-$PGVER
then
sudo systemctl status postgresql.service -l
exit 1
fi

# ensure PostgreSQL is running on 5432 port with proper auth
sudo sed -i \
Expand Down

0 comments on commit 5d75de5

Please sign in to comment.