File tree 7 files changed +41
-20
lines changed
Filter options
7 files changed +41
-20
lines changed
Original file line number Diff line number Diff line change 1
1
.deps
2
2
* .so
3
3
* .o
4
- ptrack--2.0.sql
5
4
Dockerfile
6
-
Original file line number Diff line number Diff line change 2
2
3
3
MODULE_big = ptrack
4
4
OBJS = ptrack.o datapagemap.o engine.o $(WIN32RES )
5
- EXTENSION = ptrack
6
- EXTVERSION = 2.1
7
- DATA = ptrack.sql ptrack--2.0--2.1.sql
8
- DATA_built = $(EXTENSION ) --$(EXTVERSION ) .sql
9
5
PGFILEDESC = "ptrack - block-level incremental backup engine"
10
6
11
- EXTRA_CLEAN = $(EXTENSION ) --$(EXTVERSION ) .sql
7
+ EXTENSION = ptrack
8
+ EXTVERSION = 2.2
9
+ DATA = ptrack--2.1.sql ptrack--2.0--2.1.sql ptrack--2.1--2.2.sql
12
10
13
11
TAP_TESTS = 1
14
12
@@ -22,13 +20,3 @@ top_builddir = ../..
22
20
include $(top_builddir ) /src/Makefile.global
23
21
include $(top_srcdir ) /contrib/contrib-global.mk
24
22
endif
25
-
26
- $(EXTENSION ) --$(EXTVERSION ) .sql : ptrack.sql
27
- cat $^ > $@
28
-
29
- # temp-install: EXTRA_INSTALL=contrib/ptrack
30
-
31
- # check-tap: temp-install
32
- # $(prove_check)
33
-
34
- # check: check-tap
Original file line number Diff line number Diff line change
1
+ /* ptrack/ptrack--2.1--2.2.sql */
2
+
3
+ -- Complain if script is sourced in psql, rather than via ALTER EXTENSION
4
+ \echo Use " ALTER EXTENSION ptrack UPDATE;" to load this file.\ quit
5
+
6
+ CREATE FUNCTION ptrack_get_change_stat (start_lsn pg_lsn)
7
+ RETURNS TABLE (
8
+ files bigint ,
9
+ pages bigint ,
10
+ " size, MB" numeric
11
+ ) AS
12
+ $func$
13
+ DECLARE
14
+ block_size bigint ;
15
+ BEGIN
16
+ block_size := (SELECT setting FROM pg_settings WHERE name = ' block_size' );
17
+
18
+ RETURN QUERY
19
+ SELECT changed_files,
20
+ changed_pages,
21
+ block_size* changed_pages/ (1024 .0 * 1024 )
22
+ FROM
23
+ (SELECT count (path ) AS changed_files,
24
+ sum (
25
+ length(replace(right((pagemap)::text , - 1 )::varbit::text , ' 0' , ' ' ))
26
+ ) AS changed_pages
27
+ FROM ptrack_get_pagemapset(start_lsn)) s;
28
+ END
29
+ $func$ LANGUAGE plpgsql;
Original file line number Diff line number Diff line change
1
+ /* ptrack/ptrack--2.1.sql */
2
+
1
3
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
2
4
\echo Use " CREATE EXTENSION ptrack" to load this file. \quit
3
5
Original file line number Diff line number Diff line change 1
1
# ptrack extension
2
2
comment = 'block-level incremental backup engine'
3
- default_version = '2.1 '
3
+ default_version = '2.2 '
4
4
module_pathname = '$libdir/ptrack'
5
5
relocatable = true
Original file line number Diff line number Diff line change 22
22
#include "utils/relcache.h"
23
23
24
24
/* Ptrack version as a string */
25
- #define PTRACK_VERSION "2.1 "
25
+ #define PTRACK_VERSION "2.2 "
26
26
/* Ptrack version as a number */
27
27
#define PTRACK_VERSION_NUM 220
28
28
Original file line number Diff line number Diff line change 10
10
use TestLib;
11
11
use Test::More;
12
12
13
- plan tests => 23 ;
13
+ plan tests => 24 ;
14
14
15
15
my $node ;
16
16
my $res ;
115
115
qr /$rel_oid / ,
116
116
' ptrack pagemapset should contain new relation oid' );
117
117
118
+ # Check change stats
119
+ $res_stdout = $node -> safe_psql(" postgres" , " SELECT pages FROM ptrack_get_change_stat('$flush_lsn ')" );
120
+ is($res_stdout > 0, 1, ' should be able to get aggregated stats of changes' );
121
+
118
122
# We should be able to change ptrack map size (but loose all changes)
119
123
$node -> append_conf(
120
124
' postgresql.conf' , q{
You can’t perform that action at this time.
0 commit comments