目前ptrack的提示中,1 缺乏对于报错对应操作的解释 2 对于没有开启pstack的情况下,lsn可能获取为长度0的字符串的处理缺失(导致securec_check_for_sscanf_s失败,其提示容易误解为程序bug)

This commit is contained in:
wei.liu
2022-06-27 16:19:11 +08:00
parent c611b010a0
commit efc0ffe9c2

View File

@ -81,9 +81,12 @@ pg_ptrack_get_pagemapset(PGconn *backup_conn, XLogRecPtr lsn)
char *temp_lsn = NULL; char *temp_lsn = NULL;
res = pgut_execute(backup_conn, "SELECT pg_cbm_tracked_location()", 0, NULL); res = pgut_execute(backup_conn, "SELECT pg_cbm_tracked_location()", 0, NULL);
if (PQnfields(res) != 1) { if (PQnfields(res) != 1) {
elog(ERROR, "cannot get cbm tracked lsn location"); elog(ERROR, "cannot get cbm tracked lsn location, maybe enable_cbm_tracking is off");
} }
temp_lsn = pg_strdup(PQgetvalue(res, 0, 0)); temp_lsn = pg_strdup(PQgetvalue(res, 0, 0));
if (strlen(temp_lsn)==0){
elog(ERROR, "cannot get cbm tracked lsn location, maybe enable_cbm_tracking is off");
}
ret = sscanf_s(temp_lsn, "%X/%X", &lsn_hi, &lsn_lo); ret = sscanf_s(temp_lsn, "%X/%X", &lsn_hi, &lsn_lo);
securec_check_for_sscanf_s(ret, 2, "\0", "\0"); securec_check_for_sscanf_s(ret, 2, "\0", "\0");
pfree(temp_lsn); pfree(temp_lsn);