1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-02 09:53:24 +02:00

bugfixes:

- if block is invalid after 100 read attempts then throw an error
 - if block is invalid after first read attempt then instead of additional 99 atempts use pg_ptrack_get_block if ptrack is supported
This commit is contained in:
Grigory Smolkin 2018-01-18 04:55:10 +03:00
parent 68e2742da0
commit 830bcfdc6a
3 changed files with 23 additions and 3 deletions

View File

@ -52,6 +52,7 @@ static pthread_mutex_t start_stream_mut = PTHREAD_MUTEX_INITIALIZER;
static pthread_t stream_thread;
static int is_ptrack_enable = false;
bool is_ptrack_support = false;
bool is_checksum_enabled = false;
/* Backup connections */
@ -743,7 +744,6 @@ do_backup_instance(void)
int
do_backup(time_t start_time)
{
bool is_ptrack_support;
/* PGDATA and BACKUP_MODE are always required */
if (pgdata == NULL)

View File

@ -190,7 +190,7 @@ read_page_from_file(pgFile *file, BlockNumber blknum,
}
/* Verify checksum */
if(current.checksum_version && is_checksum_enabled)
if(current.checksum_version)
{
/*
* If checksum is wrong, sleep a bit and then try again
@ -266,10 +266,29 @@ backup_data_page(backup_files_args *arguments,
if (result == 1)
page_is_valid = true;
/*
* If ptrack support is available use it to get invalid block
* instead of rereading it 99 times
*/
//elog(WARNING, "Checksum_Version: %i", current.checksum_version ? 1 : 0);
if (result == -1 && is_ptrack_support)
{
elog(WARNING, "File %s, block %u, try to fetch via SQL",
file->path, blknum);
break;
}
}
/*
* If page is not valid after 100 attempts to read it
* throw an error.
*/
if(!page_is_valid && !is_ptrack_support)
elog(ERROR, "Data file checksum mismatch, canceling backup");
}
if (backup_mode == BACKUP_MODE_DIFF_PTRACK)
if (backup_mode == BACKUP_MODE_DIFF_PTRACK || (!page_is_valid && is_ptrack_support))
{
size_t page_size = 0;

View File

@ -298,6 +298,7 @@ extern const char *master_port;
extern const char *master_user;
extern uint32 replica_timeout;
extern bool is_ptrack_support;
extern bool is_checksum_enabled;
/* delete options */