fix gtt residual files after db breakdown

This commit is contained in:
gentle_hu
2022-07-29 14:41:55 +08:00
parent 6c8e569752
commit eab698a2eb

View File

@ -3512,13 +3512,16 @@ void RemovePgTempFiles(void)
* subDir returned by ReadDir will be overwritten by the next invoking.
* therefore, the result needs to be saved.
*/
char curSubDir[MAXPGPATH] = {0};
rc = strncpy_s(curSubDir, MAXPGPATH, spc_de->d_name, strlen(spc_de->d_name));
securec_check(rc, "", "");
#ifdef PGXC
/* Postgres-XC tablespaces include node name in path */
rc = snprintf_s(temp_path,
sizeof(temp_path),
sizeof(temp_path) - 1,
"pg_tblspc/%s/%s_%s/%s",
spc_de->d_name,
curSubDir,
TABLESPACE_VERSION_DIRECTORY,
g_instance.attr.attr_common.PGXCNodeName,
PG_TEMP_FILES_DIR);
@ -3528,7 +3531,7 @@ void RemovePgTempFiles(void)
sizeof(temp_path),
sizeof(temp_path) - 1,
"pg_tblspc/%s/%s/%s",
spc_de->d_name,
curSubDir,
TABLESPACE_VERSION_DIRECTORY,
PG_TEMP_FILES_DIR);
securec_check_ss(rc, "", "");
@ -3541,7 +3544,7 @@ void RemovePgTempFiles(void)
sizeof(temp_path),
sizeof(temp_path) - 1,
"pg_tblspc/%s/%s_%s",
spc_de->d_name,
curSubDir,
TABLESPACE_VERSION_DIRECTORY,
g_instance.attr.attr_common.PGXCNodeName);
securec_check_ss(rc, "", "");
@ -3550,7 +3553,7 @@ void RemovePgTempFiles(void)
sizeof(temp_path),
sizeof(temp_path) - 1,
"pg_tblspc/%s/%s",
spc_de->d_name,
curSubDir,
TABLESPACE_VERSION_DIRECTORY);
securec_check_ss(rc, "\0", "\0");
#endif
@ -4055,4 +4058,4 @@ PageCompressHeader *GetPageCompressMemoryMap(File file, uint32 chunk_size)
}
return vfdP->pcmap;
}
}