You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-07-15 07:04:14 +02:00
[Issue #385] pg_stop_backup refactoring, part 1
This commit is contained in:
931
src/backup.c
931
src/backup.c
File diff suppressed because it is too large
Load Diff
@ -679,6 +679,11 @@ typedef struct BackupPageHeader2
|
|||||||
uint16 checksum;
|
uint16 checksum;
|
||||||
} BackupPageHeader2;
|
} BackupPageHeader2;
|
||||||
|
|
||||||
|
typedef struct StopBackupCallbackState {
|
||||||
|
PGconn *conn;
|
||||||
|
int server_version;
|
||||||
|
} StopBackupCallbackState;
|
||||||
|
|
||||||
/* Special value for compressed_size field */
|
/* Special value for compressed_size field */
|
||||||
#define PageIsOk 0
|
#define PageIsOk 0
|
||||||
#define SkipCurrentPage -1
|
#define SkipCurrentPage -1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* pgut.c
|
* pgut.c
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
|
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
|
||||||
* Portions Copyright (c) 2017-2019, Postgres Professional
|
* Portions Copyright (c) 2017-2021, Postgres Professional
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -902,6 +902,20 @@ pgut_strdup(const char *str)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
pgut_strndup(const char *str, size_t n)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
|
||||||
|
if (str == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if ((ret = strndup(str, n)) == NULL)
|
||||||
|
elog(ERROR, "could not duplicate string \"%s\": %s",
|
||||||
|
str, strerror(errno));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
pgut_fopen(const char *path, const char *mode, bool missing_ok)
|
pgut_fopen(const char *path, const char *mode, bool missing_ok)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* pgut.h
|
* pgut.h
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
|
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
|
||||||
* Portions Copyright (c) 2017-2019, Postgres Professional
|
* Portions Copyright (c) 2017-2021, Postgres Professional
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -61,6 +61,7 @@ extern int pgut_wait(int num, PGconn *connections[], struct timeval *timeout);
|
|||||||
extern void *pgut_malloc(size_t size);
|
extern void *pgut_malloc(size_t size);
|
||||||
extern void *pgut_realloc(void *p, size_t size);
|
extern void *pgut_realloc(void *p, size_t size);
|
||||||
extern char *pgut_strdup(const char *str);
|
extern char *pgut_strdup(const char *str);
|
||||||
|
extern char *pgut_strndup(const char *str, size_t n);
|
||||||
|
|
||||||
#define pgut_new(type) ((type *) pgut_malloc(sizeof(type)))
|
#define pgut_new(type) ((type *) pgut_malloc(sizeof(type)))
|
||||||
#define pgut_newarray(type, n) ((type *) pgut_malloc(sizeof(type) * (n)))
|
#define pgut_newarray(type, n) ((type *) pgut_malloc(sizeof(type) * (n)))
|
||||||
|
@ -733,7 +733,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
# to original data
|
# to original data
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(256,512) i")
|
"from generate_series(256,512) i")
|
||||||
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
@ -768,7 +768,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
# to original data
|
# to original data
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(512,80680) i")
|
"from generate_series(512,80680) i")
|
||||||
|
|
||||||
@ -911,6 +911,11 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
'autovacuum': 'off',
|
'autovacuum': 'off',
|
||||||
'archive_timeout': '10s'})
|
'archive_timeout': '10s'})
|
||||||
|
|
||||||
|
if self.get_version(master) < self.version_to_num('9.6.0'):
|
||||||
|
self.del_test_dir(module_name, fname)
|
||||||
|
return unittest.skip(
|
||||||
|
'Skipped because backup from replica is not supported in PG 9.5')
|
||||||
|
|
||||||
replica = self.make_simple_node(
|
replica = self.make_simple_node(
|
||||||
base_dir=os.path.join(module_name, fname, 'replica'))
|
base_dir=os.path.join(module_name, fname, 'replica'))
|
||||||
replica.cleanup()
|
replica.cleanup()
|
||||||
@ -956,7 +961,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
|
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(0,10000) i")
|
"from generate_series(0,10000) i")
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
|||||||
# to original data
|
# to original data
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(256,512) i")
|
"from generate_series(256,512) i")
|
||||||
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
before = master.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
@ -185,7 +185,7 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
|||||||
# to original data
|
# to original data
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(512,768) i")
|
"from generate_series(512,768) i")
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
|||||||
# equal to original data
|
# equal to original data
|
||||||
master.psql(
|
master.psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"insert into t_heap as select i as id, md5(i::text) as text, "
|
"insert into t_heap select i as id, md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(256,25120) i")
|
"from generate_series(256,25120) i")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user