!211 gs_baebackup tablespace_mapping option doesn't work
Merge pull request !211 from 吴岳川/master
This commit is contained in:
@ -247,7 +247,7 @@ static void tablespace_list_create()
|
||||
securec_check_c(rcm, "", "");
|
||||
}
|
||||
|
||||
static void save_tablespace_dir(char* dir)
|
||||
static void save_tablespace_dir(const char* dir)
|
||||
{
|
||||
if (tblspaceDirectory != NULL) {
|
||||
tblspaceDirectory[tblspaceIndex] = xstrdup(dir);
|
||||
@ -1268,10 +1268,10 @@ static void BaseBackup(void)
|
||||
tablespacepath);
|
||||
securec_check_ss_c(rc, "\0", "\0");
|
||||
|
||||
verify_dir_is_empty_or_create(nodetablespacepath);
|
||||
|
||||
const char* mappingSpacePath = get_tablespace_mapping(nodetablespacepath);
|
||||
verify_dir_is_empty_or_create((char*)mappingSpacePath);
|
||||
/* Save the tablespace directory here so we can remove it when errors happen. */
|
||||
save_tablespace_dir(nodetablespacepath);
|
||||
save_tablespace_dir(mappingSpacePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,7 +737,9 @@ Datum pg_tablespace_location(PG_FUNCTION_ARGS)
|
||||
target_path[rllen] = '\0';
|
||||
|
||||
/* relative location will contain t_thrd.proc_cxt.DataDir */
|
||||
if (0 == strncmp(target_path, t_thrd.proc_cxt.DataDir, strlen(t_thrd.proc_cxt.DataDir))) {
|
||||
size_t dataDirLength = strlen(t_thrd.proc_cxt.DataDir);
|
||||
if (0 == strncmp(target_path, t_thrd.proc_cxt.DataDir, dataDirLength) && rllen > dataDirLength &&
|
||||
target_path[dataDirLength] == '/') {
|
||||
/*
|
||||
* The position is not '/' when skip t_thrd.proc_cxt.DataDir. the relative location can't start from '/'
|
||||
* We only need get the relative location, so remove the common prefix
|
||||
|
Reference in New Issue
Block a user