Skip to content

Commit f1352d7

Browse files
committed
Ptrack 2.0 initial release
Ptrack is a fast block-level incremental backup engine for PostgreSQL. Currently `ptrack` codebase is split approximately 50%/50% between PostgreSQL core patch and extension. All public SQL API methods are placed in the `ptrack` extension, while the main engine is still in core. Credits to: * Konstantin Knizhnik * Anastasia Lubennikova * Alexey Kondratov
0 parents  commit f1352d7

8 files changed

+1595
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.deps
2+
*.so
3+
*.o
4+
ptrack--2.0.sql
5+

LICENSE

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ptrack is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
2+
3+
Copyright (c) 2015-2020, Postgres Professional
4+
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
5+
Portions Copyright (c) 1994, The Regents of the University of California
6+
7+
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.
8+
9+
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.
10+
11+
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.

Makefile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# contrib/ptrack/Makefile
2+
3+
MODULE_big = ptrack
4+
OBJS = ptrack.o $(WIN32RES)
5+
EXTENSION = ptrack
6+
EXTVERSION = 2.0
7+
DATA = ptrack.sql
8+
DATA_built = $(EXTENSION)--$(EXTVERSION).sql
9+
PGFILEDESC = "ptrack - public API for internal ptrack engine"
10+
11+
EXTRA_CLEAN = $(EXTENSION)--$(EXTVERSION).sql
12+
13+
ifdef USE_PGXS
14+
PG_CONFIG ?= pg_config
15+
PGXS := $(shell $(PG_CONFIG) --pgxs)
16+
include $(PGXS)
17+
else
18+
subdir = contrib/ptrack
19+
top_builddir = ../..
20+
include $(top_builddir)/src/Makefile.global
21+
include $(top_srcdir)/contrib/contrib-global.mk
22+
endif
23+
24+
$(EXTENSION)--$(EXTVERSION).sql: ptrack.sql
25+
cat $^ > $@
26+
27+
temp-install: EXTRA_INSTALL=contrib/ptrack

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ptrack
2+
3+
## Overview
4+
5+
Ptrack is a fast block-level incremental backup engine for PostgreSQL. Currently `ptrack` codebase is split approximately 50%/50% between PostgreSQL core patch and extension. All public SQL API methods are placed in the `ptrack` extension, while the main engine is still in core.
6+
7+
## Installation
8+
9+
1) Apply PostgreSQL core patch:
10+
11+
```shell
12+
git apply patches/ptrack-2.0-core.diff
13+
```
14+
15+
2) Compile and install PostgreSQL
16+
17+
3) Set `ptrack_map_size` (in MB)
18+
19+
```shell
20+
echo 'ptrack_map_size = 64' >> postgres_data/postgresql.conf
21+
```
22+
23+
4) Compile and install `ptrack` extension
24+
25+
```shell
26+
USE_PGXS=1 make -C /path/to/ptrack/ install
27+
```
28+
29+
5) Run PostgreSQL and create `ptrack` extension
30+
31+
```sql
32+
CREATE EXTENSION ptrack;
33+
```
34+
35+
## Public SQL API
36+
37+
* ptrack_version() --- returns ptrack version string (2.0 currently).
38+
* pg_ptrack_get_pagemapset('LSN') --- returns a set of changed data files with bitmaps of changed blocks since specified LSN.
39+
* pg_ptrack_control_lsn() --- returns LSN of the last ptrack map initialization.
40+
* pg_ptrack_get_block --- returns a requested block of relation.
41+
42+
## Architecture
43+
44+
TBA
45+
46+
## Roadmap
47+
48+
The main goal currently is to move as much `ptrack` functionality into the extension as possible and leave only certain requred hooks as core patch.

0 commit comments

Comments
 (0)