!3407 【轻量级PR】修复gs_xlogdump_parsepage_tablepath报错提示不合理的问题

Merge pull request !3407 from cchen676/1207master
This commit is contained in:
opengauss-bot
2023-05-06 07:31:47 +00:00
committed by Gitee

View File

@ -600,11 +600,11 @@ char *ParsePage(char *path, int64 blocknum, char *relation_type, bool read_memor
SMgrRelation smgr = smgropen(*relnode, InvalidBackendId, GetColumnNum(forkNum)); SMgrRelation smgr = smgropen(*relnode, InvalidBackendId, GetColumnNum(forkNum));
if (strcmp(relation_type, "segment") == 0) if (strcmp(relation_type, "segment") == 0)
CheckSegment(relnode, forkNum, outputfile, outputFilename); CheckSegment(relnode, forkNum, outputfile, outputFilename);
BlockNumber maxBlockNum = smgrnblocks(smgr, forkNum) - 1; BlockNumber maxBlockNum = smgrnblocks(smgr, forkNum);
if (blocknum > maxBlockNum) { if ((blocknum != -1 && blocknum > maxBlockNum) || (maxBlockNum == 0)) {
CheckCloseFile(outputfile, outputFilename, false); CheckCloseFile(outputfile, outputFilename, false);
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errmsg(
(errmsg("Blocknum should be between -1 and %u.", maxBlockNum)))); "The max blocknum of current file is %u. Target blocknum exceeds current file size.", maxBlockNum))));
} }
pfree_ext(relnode); pfree_ext(relnode);