Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Catchup command implementation #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
gsmolk merged 73 commits into release_2_5 from release_2_5-pgpro-4850
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
51e20d9
fix forgotten in 29adb5b comment
kulaginm Feb 1, 2021
c4a8488
porting catchup to release_2_5 branch
kulaginm May 14, 2021
3d2bcda
Merge branch 'master' into release_2_5-pgpro-4850
gsmolk May 15, 2021
69db990
use correct args for wait_wal_lsn()
gsmolk May 15, 2021
6a3c3d3
[Issue #277] review, some improvements, refactoring and overhaul, sev...
gsmolk May 16, 2021
2afa159
[Issue #277] run catchup test in remote mode only if envvar PGPROBACK...
gsmolk May 16, 2021
2f843a7
[Issue #227] Remove support of ptrack1.x, clean up redundant code in ...
gsmolk May 16, 2021
2f8617d
cosmetic changes
kulaginm May 18, 2021
61f167c
rename pg_checksum_enable() to pg_is_checksum_enabled
kulaginm May 18, 2021
30543b2
remove unused instanceState from pg_start_backup()
kulaginm May 24, 2021
1657fee
Refactor wait_wal_lsn(): remove unused pgBackup * parameter and repla...
kulaginm May 24, 2021
fffa8b1
Refactor pg_stop_backup(): remove useless conn variable
kulaginm May 24, 2021
ed5d71e
Make some functions and variables (from backup.c) accessible from oth...
kulaginm May 24, 2021
f7196e8
Remove some references to global stream_wal variable
kulaginm May 24, 2021
bd9cd9f
remove unused variable externaldir
kulaginm May 24, 2021
1793c68
Yet another split of pg_stop_backup(): separate verification of stop_...
kulaginm May 24, 2021
a13a23f
Merge branch 'release_2_5-pgpro-5018' into release_2_5-pgpro-4850
kulaginm May 24, 2021
7415e6c
Merge branch 'release_2_5-pg_stop_backup-decomposition2' into release...
kulaginm May 24, 2021
02aa321
catchup update #1
kulaginm May 24, 2021
24bd657
make separate function for node creation in catchup tests (make_empty...
kulaginm May 24, 2021
eab58c1
simple delta catchup test
kulaginm May 24, 2021
9efea2b
Remove get_min_recovery_point() and use get_redo() instead
kulaginm May 24, 2021
1c1a89c
catchup update #2
kulaginm May 25, 2021
d7e2606
catchup update #3 (tablespace mapping fix)
kulaginm May 25, 2021
2c8b7e9
create pfilearray_clear_locks() helper function
kulaginm May 26, 2021
bbacdf0
Merge remote-tracking branch 'origin/release_2_5-pg_stop_backup-decom...
kulaginm May 26, 2021
50cd84d
followup for 02aa32107433c34f6f7f264585e051cc7b5dbab1
kulaginm May 26, 2021
bc2f392
catchup update #4 (fix removed files)
kulaginm May 26, 2021
55ee681
Merge remote-tracking branch 'origin/release_2_5' into release_2_5-pg...
kulaginm May 27, 2021
05c451e
test stabilization
kulaginm May 27, 2021
fd7571b
test_tablefile_truncation added
kulaginm May 27, 2021
72b5bba
Improve catchup help
kulaginm May 28, 2021
bee476c
pg_control now is synced last
kulaginm May 31, 2021
74cd21a
apply lubennikovaav review.patch
kulaginm May 31, 2021
271cf16
indent correction as noted by Roman Zharkov
kulaginm May 31, 2021
8e03b8d
Review answer #1
kulaginm May 31, 2021
b294557
typo
kulaginm Jun 1, 2021
2e3adf1
check emptyness of dest_pgdata
kulaginm Jun 1, 2021
861ddd3
check that user uses tablespace_mapping
kulaginm Jun 1, 2021
e865c83
fix destination file existance
kulaginm Jun 2, 2021
2598c99
Print octal permissions in tests compare_pgdata()
kulaginm Jun 2, 2021
746a1a5
fix local delta backup
kulaginm Jun 2, 2021
2cceb71
Review answer #2
kulaginm Jun 2, 2021
803a7e3
add more catchup preflight checks
kulaginm Jun 3, 2021
5b46f09
rename cmdline parameters, remove annoyng message
kulaginm Jun 3, 2021
18c4b46
one more review pass
lubennikovaav Jun 7, 2021
19ace74
Merge remote-tracking branch 'origin/release_2_5' into release_2_5-pg...
kulaginm Jun 7, 2021
01fe2f9
Additional tablespace checks
kulaginm Jun 7, 2021
39df7ac
[DOC] Added documentation for catchup command
indrups Jun 7, 2021
fc76038
Proofread catchup messages
indrups Jun 7, 2021
132ec94
fix lost lost --no-color option in docs
kulaginm Jun 7, 2021
dc8d425
Merge branch 'release_2_5-pgpro-4850' of https://github.com/postgresp...
kulaginm Jun 7, 2021
ce34427
Pure language refinement
indrups Jun 7, 2021
5089400
fix datafile truncation bug
kulaginm Jun 7, 2021
3e43d00
Wording in documentation refined from techwriters' feedback
indrups Jun 8, 2021
55c114f
bugfix: remove unnecessary tablespace_map file write
kulaginm Jun 8, 2021
8a9c6ce
Merge branch 'release_2_5-pgpro-4850' of https://github.com/postgresp...
kulaginm Jun 8, 2021
9cde0f9
Modify tablespace preflight checks (as per comment by Roman Zharkov)
kulaginm Jun 8, 2021
1ab642a
typo
kulaginm Jun 9, 2021
6240c9f
bugfix: fix incorrect pg_control reading (as per comment by Roman Zha...
kulaginm Jun 9, 2021
1a48b0a
bugfix: add additional cmdline check (reported by Roman Zharkov)
kulaginm Jun 9, 2021
1811eb7
refine catchup tests
kulaginm Jun 10, 2021
629b732
more checks and tests
kulaginm Jun 10, 2021
b15fcf6
refine test_same_db_id test
kulaginm Jun 10, 2021
ba22e2e
split do_catchup_instance() into parts #1
kulaginm Jun 10, 2021
8d3fb16
TLI tests and TLI check fix
kulaginm Jun 10, 2021
6b6086f
postgres-9.5 compability fix
kulaginm Jun 11, 2021
ff444b3
rename tests (include simple tests to basic suite)
kulaginm Jun 11, 2021
83ccabc
add comment of future improvements
kulaginm Jun 11, 2021
4a2419a
Merge remote-tracking branch 'origin/release_2_5' into release_2_5-pg...
kulaginm Jun 14, 2021
d987131
fix help message
kulaginm Jun 15, 2021
68cfd5b
[DOC] Documentation updated upon feedback from Probackup team
indrups Jun 16, 2021
de58e46
Merge branch 'release_2_5' into release_2_5-pgpro-4850
gsmolk Jun 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Issue #227] Remove support of ptrack1.x, clean up redundant code in ...
...catchup
  • Loading branch information
gsmolk committed May 16, 2021
commit 2f843a70677545793a947fb6749cdf7812f57597
14 changes: 3 additions & 11 deletions src/catchup.c
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
backup_mode == BACKUP_MODE_DIFF_DELTA))
{
dest_filelist = parray_new();
dir_list_file(dest_filelist, dest_pgdata,
dir_list_file(dest_filelist, dest_pgdata,
true, true, false, backup_logs, true, 0, FIO_LOCAL_HOST);

sync_lsn = get_min_recovery_point(dest_pgdata);
Expand Down Expand Up @@ -268,18 +268,10 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
arg->nodeInfo = nodeInfo;
arg->from_root = source_pgdata;
arg->to_root = dest_pgdata;
/* TODO разобраться */
//arg->external_prefix = external_prefix;
//arg->external_dirs = external_dirs;
arg->source_filelist = source_filelist;
/* TODO !!!! change to target file_list */
arg->dest_filelist = dest_filelist;
arg->sync_lsn = sync_lsn;
arg->backup_mode = backup_mode;
arg->conn_arg.conn = NULL;
arg->conn_arg.cancel_conn = NULL;
/* TODO !!!! */
arg->hdr_map = &(current.hdr_map);
arg->thread_num = i+1;
/* By default there are some error */
arg->ret = 1;
Expand Down Expand Up @@ -564,15 +556,15 @@ catchup_files(void *arg)
/* Do actual work */
if (file->is_datafile && !file->is_cfs)
{
catchup_data_file(&(arguments->conn_arg), file, from_fullpath, to_fullpath,
catchup_data_file(file, from_fullpath, to_fullpath,
arguments->sync_lsn,
arguments->backup_mode,
NONE_COMPRESS,
0,
arguments->nodeInfo->checksum_version,
arguments->nodeInfo->ptrack_version_num,
arguments->nodeInfo->ptrack_schema,
arguments->hdr_map, false);
false);
}
else
{
Expand Down
78 changes: 8 additions & 70 deletions src/data.c
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ get_checksum_errormsg(Page page, char **errormsg, BlockNumber absolute_blkno)
* return it to the caller
*/
static int32
prepare_page(ConnectionArgs *conn_arg,
pgFile *file, XLogRecPtr prev_backup_start_lsn,
prepare_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
BlockNumber blknum, FILE *in,
BackupMode backup_mode,
Page page, bool strict,
Expand Down Expand Up @@ -395,66 +394,6 @@ prepare_page(ConnectionArgs *conn_arg,
return PageIsOk;
}

/*
* Get page via ptrack interface from PostgreSQL shared buffer.
* We do this only in the cases of PTRACK 1.x versions backup
*/
if (backup_mode == BACKUP_MODE_DIFF_PTRACK
&& (ptrack_version_num >= 15 && ptrack_version_num < 20))
{
int rc = 0;
size_t page_size = 0;
Page ptrack_page = NULL;
ptrack_page = (Page) pg_ptrack_get_block(conn_arg, file->dbOid, file->tblspcOid,
file->relOid, absolute_blknum, &page_size,
ptrack_version_num, ptrack_schema);

if (ptrack_page == NULL)
/* This block was truncated.*/
return PageIsTruncated;

if (page_size != BLCKSZ)
elog(ERROR, "File: \"%s\", block %u, expected block size %d, but read %zu",
from_fullpath, blknum, BLCKSZ, page_size);

/*
* We need to copy the page that was successfully
* retrieved from ptrack into our output "page" parameter.
*/
memcpy(page, ptrack_page, BLCKSZ);
pg_free(ptrack_page);

/*
* UPD: It apprears that is possible to get zeroed page or page with invalid header
* from shared buffer.
* Note, that getting page with wrong checksumm from shared buffer is
* acceptable.
*/
rc = validate_one_page(page, absolute_blknum,
InvalidXLogRecPtr, page_st,
checksum_version);

/* It is ok to get zeroed page */
if (rc == PAGE_IS_ZEROED)
return PageIsOk;

/* Getting page with invalid header from shared buffers is unacceptable */
if (rc == PAGE_HEADER_IS_INVALID)
{
char *errormsg = NULL;
get_header_errormsg(page, &errormsg);
elog(ERROR, "Corruption detected in file \"%s\", block %u: %s",
from_fullpath, blknum, errormsg);
}

/*
* We must set checksum here, because it is outdated
* in the block recieved from shared buffers.
*/
if (checksum_version)
page_st->checksum = ((PageHeader) page)->pd_checksum = pg_checksum_page(page, absolute_blknum);
}

/*
* Skip page if page lsn is less than START_LSN of parent backup.
* Nullified pages must be copied by DELTA backup, just to be safe.
Expand Down Expand Up @@ -714,12 +653,11 @@ backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
* backup with special header.
*/
void
catchup_data_file(ConnectionArgs* conn_arg, pgFile *file,
const char *from_fullpath, const char *to_fullpath,
catchup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpath,
XLogRecPtr prev_backup_start_lsn, BackupMode backup_mode,
CompressAlg calg, int clevel, uint32 checksum_version,
int ptrack_version_num, const char *ptrack_schema,
HeaderMap *hdr_map, bool is_merge)
bool is_merge)
{
int rc;
bool use_pagemap;
Expand Down Expand Up @@ -796,7 +734,7 @@ catchup_data_file(ConnectionArgs* conn_arg, pgFile *file,
else
{
/* TODO: stop handling errors internally */
rc = copy_pages(conn_arg, to_fullpath, from_fullpath, file,
rc = copy_pages(to_fullpath, from_fullpath, file,
/* send prev backup START_LSN */
backup_mode == BACKUP_MODE_DIFF_DELTA &&
file->exists_in_prev ? prev_backup_start_lsn : InvalidXLogRecPtr,
Expand Down Expand Up @@ -1742,7 +1680,7 @@ check_data_file(ConnectionArgs *arguments, pgFile *file,
for (blknum = 0; blknum < nblocks; blknum++)
{
PageState page_st;
page_state = prepare_page(NULL, file, InvalidXLogRecPtr,
page_state = prepare_page(file, InvalidXLogRecPtr,
blknum, in, BACKUP_MODE_FULL,
curr_page, false, checksum_version,
0, NULL, from_fullpath, &page_st);
Expand Down Expand Up @@ -2228,7 +2166,7 @@ send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f
while (blknum < file->n_blocks)
{
PageState page_st;
int rc = prepare_page(conn_arg, file, prev_backup_start_lsn,
int rc = prepare_page(file, prev_backup_start_lsn,
blknum, in, backup_mode, curr_page,
true, checksum_version,
ptrack_version_num, ptrack_schema,
Expand Down Expand Up @@ -2303,7 +2241,7 @@ send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f

/* copy local file (взята из send_pages, но используется простое копирование странички, без добавления заголовков и компрессии) */
int
copy_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_fullpath,
copy_pages(const char *to_fullpath, const char *from_fullpath,
pgFile *file, XLogRecPtr prev_backup_start_lsn,
uint32 checksum_version, bool use_pagemap,
BackupMode backup_mode, int ptrack_version_num, const char *ptrack_schema)
Expand Down Expand Up @@ -2358,7 +2296,7 @@ copy_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f
while (blknum < file->n_blocks)
{
PageState page_st;
int rc = prepare_page(conn_arg, file, prev_backup_start_lsn,
int rc = prepare_page(file, prev_backup_start_lsn,
blknum, in, backup_mode, curr_page,
true, checksum_version,
ptrack_version_num, ptrack_schema,
Expand Down
14 changes: 4 additions & 10 deletions src/pg_probackup.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -601,18 +601,13 @@ typedef struct

const char *from_root;
const char *to_root;
const char *external_prefix;

parray *source_filelist;
parray *dest_filelist;
/* TODO разобраться */
//parray *external_dirs;

XLogRecPtr sync_lsn;
BackupMode backup_mode;

ConnectionArgs conn_arg;
int thread_num;
HeaderMap *hdr_map;

/*
* Return value from the thread.
Expand Down Expand Up @@ -1093,12 +1088,11 @@ extern void backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
CompressAlg calg, int clevel, uint32 checksum_version,
int ptrack_version_num, const char *ptrack_schema,
HeaderMap *hdr_map, bool missing_ok);
extern void catchup_data_file(ConnectionArgs* conn_arg, pgFile *file,
const char *from_fullpath, const char *to_fullpath,
extern void catchup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpath,
XLogRecPtr prev_backup_start_lsn, BackupMode backup_mode,
CompressAlg calg, int clevel, uint32 checksum_version,
int ptrack_version_num, const char *ptrack_schema,
HeaderMap *hdr_map, bool missing_ok);
bool missing_ok);
extern void backup_non_data_file(pgFile *file, pgFile *prev_file,
const char *from_fullpath, const char *to_fullpath,
BackupMode backup_mode, time_t parent_backup_time,
Expand Down Expand Up @@ -1226,7 +1220,7 @@ extern int send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const c
pgFile *file, XLogRecPtr prev_backup_start_lsn, CompressAlg calg, int clevel,
uint32 checksum_version, bool use_pagemap, BackupPageHeader2 **headers,
BackupMode backup_mode, int ptrack_version_num, const char *ptrack_schema);
extern int copy_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_fullpath,
extern int copy_pages(const char *to_fullpath, const char *from_fullpath,
pgFile *file, XLogRecPtr prev_backup_start_lsn,
uint32 checksum_version, bool use_pagemap,
BackupMode backup_mode, int ptrack_version_num, const char *ptrack_schema);
Expand Down

AltStyle によって変換されたページ (->オリジナル) /