From 682f33035eeabdc7d230c35c0794ef0f964c2ad0 Mon Sep 17 00:00:00 2001 From: w00427717 Date: Mon, 28 Sep 2020 10:55:09 +0800 Subject: [PATCH] gs_ctl build: return erro when pg_control file is not found gs_ctl build: rm the validation of pg_control file size --- src/bin/pg_rewind/pg_rewind.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bin/pg_rewind/pg_rewind.cpp b/src/bin/pg_rewind/pg_rewind.cpp index 17d68d95d..ee7e8ad8a 100755 --- a/src/bin/pg_rewind/pg_rewind.cpp +++ b/src/bin/pg_rewind/pg_rewind.cpp @@ -188,11 +188,13 @@ BuildErrorCode gs_increment_build(char* pgdata, const char* connstr, const uint3 * information we need from both clusters. */ buffer = slurpFile(datadir_target, "global/pg_control", &size); + PG_CHECKBUILD_AND_RETURN(); digestControlFile(&ControlFile_target, (const char*)buffer, size); pg_free(buffer); PG_CHECKBUILD_AND_RETURN(); buffer = fetchFile("global/pg_control", &size); + PG_CHECKBUILD_AND_RETURN(); digestControlFile(&ControlFile_source, buffer, size); pg_free(buffer); PG_CHECKBUILD_AND_RETURN(); @@ -717,9 +719,6 @@ static void digestControlFile(ControlFileData* ControlFile, const char* src, siz { errno_t errorno = EOK; - if (size != PG_CONTROL_SIZE) - pg_fatal("unexpected control file size %d, expected %d\n", (int)size, PG_CONTROL_SIZE); - errorno = memcpy_s(ControlFile, sizeof(ControlFileData), src, sizeof(ControlFileData)); securec_check_c(errorno, "\0", "\0"); /* Additional checks on control file */