Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8f7afc

Browse files
authored
Merge pull request#28 from postgrespro/PBCKP-278_cfs-ptrack
Pbckp 278 cfs ptrack review fixes
2 parents6173b21 +d3b427b commitf8f7afc

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

‎engine.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ is_cfm_file_path(const char *filepath) {
109109
returnstrlen(filepath) >=5&&strcmp(&filepath[len-4],".cfm")==0;
110110
}
111111

112-
#ifdefPGPRO_EE
112+
#ifCFS_SUPPORT
113113
/*
114114
* Determines the relation file size specified by fullpath as if it
115115
* was not compressed.
@@ -120,7 +120,7 @@ get_cfs_relation_file_decompressed_size(RelFileNodeBackend rnode, const char *fu
120120
intcompressor;
121121
off_tsize;
122122

123-
compressor=md_get_compressor_internal(rnode.node,rnode.backend,forknum);
123+
compressor=md_get_compressor_internal(nodeOf(rnode),rnode.backend,forknum);
124124
fd=PathNameOpenFile(fullpath,O_RDWR |PG_BINARY,compressor);
125125

126126
if(fd<0)
@@ -540,7 +540,7 @@ assign_ptrack_map_size(int newval, void *extra)
540540
* For use in functions that copy directories bypassing buffer manager.
541541
*/
542542
staticvoid
543-
#ifdefPGPRO_EE
543+
#ifCFS_SUPPORT
544544
ptrack_mark_file(OiddbOid,OidtablespaceOid,
545545
constchar*filepath,constchar*filename,boolis_cfs)
546546
#else
@@ -555,7 +555,7 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
555555
structstatstat_buf;
556556
intoidchars;
557557
charoidbuf[OIDCHARS+1];
558-
#ifdefPGPRO_EE
558+
#ifCFS_SUPPORT
559559
off_trel_size;
560560
#endif
561561

@@ -576,11 +576,11 @@ ptrack_mark_file(Oid dbOid, Oid tablespaceOid,
576576
oidbuf[oidchars]='\0';
577577
nodeRel(nodeOf(rnode))=atooid(oidbuf);
578578

579-
#ifdefPGPRO_EE
579+
#ifCFS_SUPPORT
580580
// if current tablespace is cfs-compressed and md_get_compressor_internal
581581
// returns the type of the compressing algorithm for filepath, then it
582582
// needs to be de-compressed to obtain its size
583-
if(is_cfs&&md_get_compressor_internal(rnode.node,rnode.backend,forknum)!=0) {
583+
if(is_cfs&&md_get_compressor_internal(nodeOf(rnode),rnode.backend,forknum)!=0) {
584584
rel_size=get_cfs_relation_file_decompressed_size(rnode,filepath,forknum);
585585

586586
if(rel_size== (off_t)-1) {
@@ -611,7 +611,7 @@ ptrack_walkdir(const char *path, Oid tablespaceOid, Oid dbOid)
611611
{
612612
DIR*dir;
613613
structdirent*de;
614-
#ifdefPGPRO_EE
614+
#ifCFS_SUPPORT
615615
boolis_cfs;
616616
#endif
617617

@@ -622,7 +622,7 @@ ptrack_walkdir(const char *path, Oid tablespaceOid, Oid dbOid)
622622
||InitializingParallelWorker)
623623
return;
624624

625-
#ifdefPGPRO_EE
625+
#ifCFS_SUPPORT
626626
is_cfs=file_is_in_cfs_tablespace(path);
627627
#endif
628628

@@ -653,7 +653,7 @@ ptrack_walkdir(const char *path, Oid tablespaceOid, Oid dbOid)
653653
}
654654

655655
if (S_ISREG(fst.st_mode))
656-
#ifdefPGPRO_EE
656+
#ifCFS_SUPPORT
657657
ptrack_mark_file(dbOid,tablespaceOid,subpath,de->d_name,is_cfs);
658658
#else
659659
ptrack_mark_file(dbOid,tablespaceOid,subpath,de->d_name);

‎engine.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
#definePTRACK_MAGIC "ptk"
4545
#definePTRACK_MAGIC_SIZE 4
4646

47+
/* CFS support macro */
48+
#if defined(PGPRO_EE)&&PG_VERSION_NUM >=120000
49+
#defineCFS_SUPPORT 1
50+
#endif
51+
4752
/*
4853
* Header of ptrack map.
4954
*/

‎ptrack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
294294
{
295295
DIR*dir;
296296
structdirent*de;
297-
#ifdefPGPRO_EE
297+
#ifCFS_SUPPORT
298298
boolis_cfs;
299299

300300
is_cfs=file_is_in_cfs_tablespace(path);
@@ -360,7 +360,7 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
360360
nodeSpc(pfl->relnode)=spcOid==InvalidOid ?DEFAULTTABLESPACE_OID :spcOid;
361361
pfl->path=GetRelationPath(dbOid,nodeSpc(pfl->relnode),
362362
nodeRel(pfl->relnode),InvalidBackendId,pfl->forknum);
363-
#ifdefPGPRO_EE
363+
#ifCFS_SUPPORT
364364
pfl->is_cfs_compressed=is_cfs
365365
&&md_get_compressor_internal(pfl->relnode,InvalidBackendId,pfl->forknum)!=0;
366366
#endif
@@ -406,7 +406,7 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
406406
char*fullpath;
407407
structstatfst;
408408
off_trel_st_size=0;
409-
#ifdefPGPRO_EE
409+
#ifCFS_SUPPORT
410410
RelFileNodeBackendrnodebackend;
411411
#endif
412412

@@ -455,8 +455,8 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
455455
returnptrack_filelist_getnext(ctx);
456456
}
457457

458-
#ifdefPGPRO_EE
459-
rnodebackend.node=ctx->bid.relnode;
458+
#ifCFS_SUPPORT
459+
nodeOf(rnodebackend)=ctx->bid.relnode;
460460
rnodebackend.backend=InvalidBackendId;
461461

462462
if(pfl->is_cfs_compressed) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp