gs_ctl build: return erro when pg_control file is not found

gs_ctl build: rm the validation of pg_control file size
This commit is contained in:
w00427717
2020-09-28 10:55:09 +08:00
committed by wuyuechuan
parent 2c6fb8dc60
commit 682f33035e

View File

@ -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 */