Skip to content

Commit

Permalink
Ptrack 2.0 initial release
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ololobus committed Jan 12, 2020
0 parents commit f1352d7
Show file tree
Hide file tree
Showing 8 changed files with 1,595 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.deps
*.so
*.o
ptrack--2.0.sql

11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ptrack is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.

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

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.

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.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# contrib/ptrack/Makefile

MODULE_big = ptrack
OBJS = ptrack.o $(WIN32RES)
EXTENSION = ptrack
EXTVERSION = 2.0
DATA = ptrack.sql
DATA_built = $(EXTENSION)--$(EXTVERSION).sql
PGFILEDESC = "ptrack - public API for internal ptrack engine"

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

ifdef USE_PGXS
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/ptrack
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

$(EXTENSION)--$(EXTVERSION).sql: ptrack.sql
cat $^ > $@

temp-install: EXTRA_INSTALL=contrib/ptrack
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ptrack

## Overview

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.

## Installation

1) Apply PostgreSQL core patch:

```shell
git apply patches/ptrack-2.0-core.diff
```

2) Compile and install PostgreSQL

3) Set `ptrack_map_size` (in MB)

```shell
echo 'ptrack_map_size = 64' >> postgres_data/postgresql.conf
```

4) Compile and install `ptrack` extension

```shell
USE_PGXS=1 make -C /path/to/ptrack/ install
```

5) Run PostgreSQL and create `ptrack` extension

```sql
CREATE EXTENSION ptrack;
```

## Public SQL API

* ptrack_version() --- returns ptrack version string (2.0 currently).
* pg_ptrack_get_pagemapset('LSN') --- returns a set of changed data files with bitmaps of changed blocks since specified LSN.
* pg_ptrack_control_lsn() --- returns LSN of the last ptrack map initialization.
* pg_ptrack_get_block --- returns a requested block of relation.

## Architecture

TBA

## Roadmap

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.
Loading

0 comments on commit f1352d7

Please sign in to comment.