@@ -1968,7 +1968,6 @@ parse_backup_filelist_filenames(parray *files, const char *root)
19681968 int sscanf_result ;
19691969
19701970 relative = GetRelativePath (file -> path , root );
1971- file -> is_cfs = false;
19721971 filename [0 ] = '\0' ;
19731972
19741973 elog (VERBOSE , "-----------------------------------------------------: %s" , relative );
@@ -2042,7 +2041,7 @@ parse_backup_filelist_filenames(parray *files, const char *root)
20422041 /* Found file in pg_tblspc/tblsOid/TABLESPACE_VERSION_DIRECTORY
20432042 Legal only in case of 'pg_compression'
20442043 */
2045- if (strcmp (relative + strlen ( relative ) - strlen ( "pg_compression" ) , "pg_compression" ) == 0 )
2044+ if (strcmp (file -> name , "pg_compression" ) == 0 )
20462045 {
20472046 elog (VERBOSE , "Found pg_compression file in TABLESPACE_VERSION_DIRECTORY, filepath %s" , relative );
20482047 /*Set every datafile in tablespace as is_cfs */
@@ -2186,29 +2185,39 @@ set_cfs_datafiles(parray *files, const char *root, char *relative, size_t i)
21862185{
21872186 int len ;
21882187 size_t p ;
2188+ pgFile * prev_file ;
21892189 char * cfs_tblspc_path ;
2190+ char * relative_prev_file ;
21902191
21912192 cfs_tblspc_path = strdup (relative );
21922193 len = strlen ("/pg_compression" );
21932194 cfs_tblspc_path [strlen (cfs_tblspc_path ) - len ] = 0 ;
21942195 elog (VERBOSE , "CFS DIRECTORY %s, pg_compression path: %s" , cfs_tblspc_path , relative );
21952196
2196- for (p = i ; p ! = 0 ; p -- )
2197+ for (p = i ; p > = 0 ; p -- )
21972198 {
2198- char * relative_prev_file ;
2199- pgFile * prev_file = (pgFile * ) parray_get (files , p );
2199+ prev_file = (pgFile * ) parray_get (files , p );
22002200 relative_prev_file = GetRelativePath (prev_file -> path , root );
2201- //elog(VERBOSE, "P: %d, CHECKING file %s", p, relative_prev_file);
2201+
2202+ //elog(VERBOSE, "P: %lu, Checking file in cfs tablespace %s", p, relative_prev_file);
2203+ elog (VERBOSE , "Checking file in cfs tablespace %s" , relative_prev_file );
2204+
22022205 if (strstr (relative_prev_file , cfs_tblspc_path ) != NULL )
22032206 {
22042207 if (S_ISREG (prev_file -> mode ) && prev_file -> is_datafile )
22052208 {
2206- elog (VERBOSE , "Setting as 'is_cfs' file %s, fork %s" ,
2207- relative_prev_file , prev_file -> forkName );
2209+ elog (VERBOSE , "Setting 'is_cfs' on file %s, name %s" ,
2210+ relative_prev_file , prev_file -> name );
22082211 prev_file -> is_cfs = true;
22092212 }
22102213 }
2214+ else
2215+ {
2216+ elog (VERBOSE , "Breaking on %s" , relative_prev_file );
2217+ break ;
2218+ }
22112219 }
2220+ free (cfs_tblspc_path );
22122221}
22132222
22142223
0 commit comments