Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a0ddcbe

Browse files
author
Daniel Shelepanov
committed
[PBCKP-278] md_get_compressor_internal is now used to determine whether the file is compressed
This will help if and when fsm and vm files will be comressable.
1 parent c0ee9af commit a0ddcbe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

engine.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
579579
int oidchars;
580580
char oidbuf[OIDCHARS + 1];
581581
#ifdef PGPRO_EE
582-
FileType file_type;
583582
off_t rel_size;
584583
#endif
585584

@@ -601,10 +600,10 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
601600
nodeRel(nodeOf(rnode)) = atooid(oidbuf);
602601

603602
#ifdef PGPRO_EE
604-
file_type = file_type_from_path(filepath);
605-
606-
if(is_cfs && (file_type == FileTypeMain
607-
|| file_type == FileTypeMainMulti)) {
603+
// if current tablespace is cfs-compressed and md_get_compressor_internal
604+
// returns the type of the compressing algorithm for filepath, then it
605+
// needs to be de-compressed to obtain its size
606+
if(is_cfs && md_get_compressor_internal(rnode.node, rnode.backend, forknum) != 0) {
608607
rel_size = get_cfs_relation_file_decompressed_size(rnode, filepath, forknum);
609608

610609
if(rel_size == (off_t)-1) {

ptrack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
353353
pfl->segno = 0;
354354

355355
#ifdef PGPRO_EE
356-
pfl->is_cfs_compressed = is_cfs && pfl->forknum == MAIN_FORKNUM;
356+
pfl->is_cfs_compressed = is_cfs
357+
&& md_get_compressor_internal(pfl->relnode, InvalidBackendId, pfl->forknum) != 0;
357358
#endif
358359
memcpy(oidbuf, de->d_name, oidchars);
359360
oidbuf[oidchars] = '\0';

0 commit comments

Comments
 (0)