!261 fix gs_ctl build bug

Merge pull request !261 from 吴岳川/master
This commit is contained in:
opengauss-bot
2020-09-28 15:05:02 +08:00
committed by Gitee

View File

@ -188,11 +188,13 @@ BuildErrorCode gs_increment_build(char* pgdata, const char* connstr, const uint3
* information we need from both clusters. * information we need from both clusters.
*/ */
buffer = slurpFile(datadir_target, "global/pg_control", &size); buffer = slurpFile(datadir_target, "global/pg_control", &size);
PG_CHECKBUILD_AND_RETURN();
digestControlFile(&ControlFile_target, (const char*)buffer, size); digestControlFile(&ControlFile_target, (const char*)buffer, size);
pg_free(buffer); pg_free(buffer);
PG_CHECKBUILD_AND_RETURN(); PG_CHECKBUILD_AND_RETURN();
buffer = fetchFile("global/pg_control", &size); buffer = fetchFile("global/pg_control", &size);
PG_CHECKBUILD_AND_RETURN();
digestControlFile(&ControlFile_source, buffer, size); digestControlFile(&ControlFile_source, buffer, size);
pg_free(buffer); pg_free(buffer);
PG_CHECKBUILD_AND_RETURN(); PG_CHECKBUILD_AND_RETURN();
@ -717,9 +719,6 @@ static void digestControlFile(ControlFileData* ControlFile, const char* src, siz
{ {
errno_t errorno = EOK; 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)); errorno = memcpy_s(ControlFile, sizeof(ControlFileData), src, sizeof(ControlFileData));
securec_check_c(errorno, "\0", "\0"); securec_check_c(errorno, "\0", "\0");
/* Additional checks on control file */ /* Additional checks on control file */