Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgrespro/ptrack
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.0
Choose a base ref
...
head repository: postgrespro/ptrack
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
94 changes: 94 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Test

on:
push:
branches:
- "**"
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
Test:
strategy:
matrix:
# pg_version: [15]
pg_version: [11, 12, 13, 14, 15]
os: [ubuntu-22.04]
# tests: [tap]
tests: [tap, python]
# test_mode: [normal, legacy, paranoia]
test_mode: [normal, paranoia]
exclude:
- tests: tap
test_mode: paranoia
- tests: python
test_mode: normal
- tests: python
test_mode: legacy
fail-fast: false
name: ${{ format('Ptrack ({0}, PostgreSQL {1}, {2} tests, {3} mode)', matrix.os, matrix.pg_version, matrix.tests, matrix.test_mode) }}
container:
image: ${{ format('ghcr.io/postgres-dev/{0}:1.0', matrix.os) }}
env:
PG_BRANCH: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
PGDATA: $HOME/data
TEST_MODE: ${{ matrix.test_mode }}
options: --privileged
steps:
- name: Get Postgres sources
uses: actions/checkout@v3
with:
repository: postgres/postgres
ref: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
path: postgres
- name: Get Ptrack sources
uses: actions/checkout@v3
with:
path: ptrack
- name: Get Pg_probackup sources
uses: actions/checkout@v3
with:
repository: postgrespro/pg_probackup
path: pg_probackup
- name: Apply ptrack patches
run: make patch top_builddir=../postgres
working-directory: ptrack
- name: Install Postgres
run: |
make install-postgres top_builddir=$GITHUB_WORKSPACE/postgres prefix=$HOME/pgsql &&
echo $HOME/pgsql/bin >> $GITHUB_PATH
working-directory: ptrack
- name: Install Ptrack
run: make install USE_PGXS=1 PG_CPPFLAGS=-coverage SHLIB_LINK=-coverage
working-directory: ptrack
- name: Install Pg_probackup
run: make install-pg-probackup USE_PGXS=1 top_srcdir=../postgres
working-directory: ptrack
shell: bash {0}
- name: Install additional packages
run: |
apt update &&
apt install -y python3-pip python3-six python3-pytest python3-pytest-xdist curl &&
pip3 install --no-input testgres
# All steps have been so far executed by root but ptrack tests run from an
# unprivileged user so change some permissions
- name: Adjust the permissions of ptrack test folders
run: |
mkdir pg_probackup/tests/tmp_dirs
chown -R "dev:" pg_probackup ptrack
- name: Test
run: make test-${{ matrix.tests }} USE_PGXS=1
working-directory: ptrack
shell: runuser dev {0}
- name: Collect coverage results
run: make coverage
working-directory: ptrack
shell: runuser dev {0}
- name: Upload coverage results to Codecov
uses: codecov/codecov-action@v3
with:
working-directory: ptrack
runs-on: ubuntu-latest
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.deps
*.so
*.o
ptrack--2.0.sql

Dockerfile
/tmp_check/
22 changes: 22 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Authors

This list is sorted by the number of commits per contributor in _descending_ order.

Avatar|Contributor|Contributions
:-:|---|:-:
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/912790?v=4' width='36' height='36' alt='@ololobus'>|[@ololobus](https://github.com/ololobus)|62
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/249427?v=4' width='36' height='36' alt='@funny-falcon'>|[@funny-falcon](https://github.com/funny-falcon)|15
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/25385449?v=4' width='36' height='36' alt='@alubennikova'>|[@alubennikova](https://github.com/alubennikova)|9
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/16117281?v=4' width='36' height='36' alt='@kulaginm'>|[@kulaginm](https://github.com/kulaginm)|5
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/10120779?v=4' width='36' height='36' alt='@daniel-95'>|[@daniel-95](https://github.com/daniel-95)|4
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/26730675?v=4' width='36' height='36' alt='@ziva777'>|[@ziva777](https://github.com/ziva777)|2
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/11221961?v=4' width='36' height='36' alt='@vegebird'>|[@vegebird](https://github.com/vegebird)|2
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/86721802?v=4' width='36' height='36' alt='@kovdb75'>|[@kovdb75](https://github.com/kovdb75)|1
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1192276?v=4' width='36' height='36' alt='@MarinaPolyakova'>|[@MarinaPolyakova](https://github.com/MarinaPolyakova)|1
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/43462737?v=4' width='36' height='36' alt='@rzharkov'>|[@rzharkov](https://github.com/rzharkov)|1
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/2743340?v=4' width='36' height='36' alt='@vbwagner'>|[@vbwagner](https://github.com/vbwagner)|1
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3983891?v=4' width='36' height='36' alt='@waaeer'>|[@waaeer](https://github.com/waaeer)|1

---

Auto-generated by [gaocegege/maintainer](https://github.com/maintainer-org/maintainer) on 2023-08-03.
22 changes: 15 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
ptrack is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
PostgreSQL License

Copyright (c) 2015-2020, Postgres Professional
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
Portions Copyright (c) 1994, The Regents of the University of California
Copyright (c) 2019-2023, Postgres Professional

Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
hereby granted, provided that the above copyright notice and this paragraph
and the following two paragraphs appear in all copies.

IN NO EVENT SHALL POSTGRES PROFESSIONAL BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF POSTGRES PROFESSIONAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
IN NO EVENT SHALL Postgres Professional BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF Postgres Professional
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

POSTGRES PROFESSIONAL SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND POSTGRES PROFESSIONAL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Postgres Professional SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
AND Postgres Professional HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS.
80 changes: 69 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,85 @@

# contrib/ptrack/Makefile

MODULE_big = ptrack
OBJS = ptrack.o $(WIN32RES)
OBJS = ptrack.o datapagemap.o engine.o $(WIN32RES)
PGFILEDESC = "ptrack - block-level incremental backup engine"

EXTENSION = ptrack
EXTVERSION = 2.0
DATA = ptrack.sql
DATA_built = $(EXTENSION)--$(EXTVERSION).sql
PGFILEDESC = "ptrack - public API for internal ptrack engine"
EXTVERSION = 2.4
DATA = ptrack--2.1.sql ptrack--2.0--2.1.sql ptrack--2.1--2.2.sql ptrack--2.2--2.3.sql \
ptrack--2.3--2.4.sql

EXTRA_CLEAN = $(EXTENSION)--$(EXTVERSION).sql
TAP_TESTS = 1

# This line to link with pgport.lib on Windows compilation
# with Mkvcbuild.pm on PGv15+
PG_LIBS_INTERNAL += $(libpq_pgport)

ifdef USE_PGXS
PG_CONFIG ?= pg_config

ifdef USE_PGXS
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/ptrack
top_builddir = ../..
# Makefile.global is a build artifact and initially may not be available
ifneq ($(wildcard $(top_builddir)/src/Makefile.global), )
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
endif

# Assuming make is started in the ptrack directory
patch:
@cd $(top_builddir) && \
echo Applying the ptrack patch... && \
git apply --3way -v $(CURDIR)/patches/${PG_BRANCH}-ptrack-core.diff
ifeq ($(MODE), paranoia)
@echo Applying turn-off-hint-bits.diff for the paranoia mode... && \
git apply --3way -v $(CURDIR)/patches/turn-off-hint-bits.diff
endif

NPROC ?= $(shell nproc)
prefix := $(abspath $(top_builddir)/pgsql)
TEST_MODE ?= normal
# Postgres Makefile skips some targets depending on the MAKELEVEL variable so
# reset it when calling install targets as if they are started directly from the
# command line
install-postgres:
@cd $(top_builddir) && \
if [ "$(TEST_MODE)" = legacy ]; then \
./configure CFLAGS='-DEXEC_BACKEND' --disable-atomics --prefix=$(prefix) --enable-debug --enable-cassert --enable-depend --enable-tap-tests --quiet; \
else \
./configure --prefix=$(prefix) --enable-debug --enable-cassert --enable-depend --enable-tap-tests; \
fi && \
$(MAKE) -sj $(NPROC) install MAKELEVEL=0 && \
$(MAKE) -sj $(NPROC) -C contrib/ install MAKELEVEL=0

# Now when Postgres is built call all remainig targets with USE_PGXS=1

test-tap:
ifeq ($(TEST_MODE), legacy)
setarch x86_64 --addr-no-randomize $(MAKE) installcheck USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG)
else
$(MAKE) installcheck USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG)
endif

pg_probackup_dir = ../pg_probackup
# Pg_probackup's Makefile uses top_srcdir when building via PGXS so set it when calling this target
# At the moment building pg_probackup with multiple threads may run some jobs too early and end with an error so do not set the -j option
install-pg-probackup:
$(MAKE) -C $(pg_probackup_dir) install USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG) top_srcdir=$(top_srcdir)

$(EXTENSION)--$(EXTVERSION).sql: ptrack.sql
cat $^ > $@
test-python:
cd $(pg_probackup_dir); \
env="PG_PROBACKUP_PTRACK=ON PG_CONFIG=$(PG_CONFIG)"; \
if [ "$(TEST_MODE)" = normal ]; then \
env="$$env PG_PROBACKUP_TEST_BASIC=ON"; \
elif [ "$(TEST_MODE)" = paranoia ]; then \
env="$$env PG_PROBACKUP_PARANOIA=ON"; \
fi; \
env $$env python3 -m pytest -svv$(if $(shell python3 -m pytest --help | grep '\-n '), -n $(NPROC))$(if $(TESTS), -k '$(TESTS)') tests/ptrack_test.py

temp-install: EXTRA_INSTALL=contrib/ptrack
coverage:
gcov *.c *.h
Loading