Skip to content

Commit 9bf3d8b

Browse files
author
Sokolov Yura
committed
cfs: reduce logging on forced GC.
1 parent 8f9dbbc commit 9bf3d8b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/backend/storage/file/cfs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,9 +1681,10 @@ Datum cfs_gc_relation(PG_FUNCTION_ARGS)
16811681
}
16821682

16831683

1684-
void cfs_gc_segment(char const* fileName, bool optional)
1684+
void cfs_gc_segment(char const* fileName, uint32 pos)
16851685
{
16861686
char* mapFileName;
1687+
bool optional = pos < CFS_RED_LINE;
16871688

16881689
if (optional)
16891690
{
@@ -1693,6 +1694,8 @@ void cfs_gc_segment(char const* fileName, bool optional)
16931694
else
16941695
LWLockAcquire(CfsGcLock, LW_EXCLUSIVE); /* Prevent interaction with background GC */
16951696

1697+
elog(LOG, "CFS: backend %d forced to perform GC on file %s because it's size exceed %u bytes",
1698+
MyProcPid, fileName, pos);
16961699
mapFileName = psprintf("%s.cfm", fileName);
16971700

16981701
cfs_gc_file(mapFileName, optional ? CFS_IMPLICIT : CFS_EXPLICIT);

src/backend/storage/file/fd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,9 +2155,7 @@ FileWrite(File file, char *buffer, int amount)
21552155
*/
21562156
if (pos + amount > CFS_IMPLICIT_GC_THRESHOLD)
21572157
{
2158-
elog(LOG, "CFS: backend %d forced to perform GC on file %s block %u because it's size exceed %u bytes",
2159-
MyProcPid, VfdCache[file].fileName, (uint32)(VfdCache[file].seekPos / BLCKSZ), pos);
2160-
cfs_gc_segment(VfdCache[file].fileName, pos + amount < CFS_RED_LINE);
2158+
cfs_gc_segment(VfdCache[file].fileName, pos + amount);
21612159
}
21622160
}
21632161
return returnCode;

src/include/storage/cfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int cfs_shmem_size(void);
136136
void cfs_encrypt(const char* fname, void* block, uint32 offs, uint32 size);
137137
void cfs_decrypt(const char* fname, void* block, uint32 offs, uint32 size);
138138

139-
void cfs_gc_segment(char const* name, bool optional);
139+
void cfs_gc_segment(char const* name, uint32 pos);
140140
void cfs_recover_map(FileMap* map);
141141

142142
extern CfsState* cfs_state;

0 commit comments

Comments
 (0)