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

Commit05449c2

Browse files
author
Sokolov Yura
committed
cfs: force whole compaction under lock on huge files
1 parent9b03e0c commit05449c2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

‎src/backend/storage/file/cfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,11 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
992992
cfs_gc_lock(lock);
993993

994994
/* Reread variables after locking file */
995+
physSize=pg_atomic_read_u32(&map->hdr.physSize);
995996
virtSize=pg_atomic_read_u32(&map->hdr.virtSize);
996997
n_pages=virtSize /BLCKSZ;
998+
if (physSize >=CFS_RED_LINE)
999+
gotoforceWhole;
9971000
for (i=0;i<n_pages;i++)
9981001
{
9991002
newMap->inodes[i]=map->inodes[i];
@@ -1073,7 +1076,7 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
10731076
memset(newMap->inodes,0,sizeof(newMap->inodes));
10741077
elog(LOG,"CFS: retry %d whole gc file %s",second_pass_whole,
10751078
file_path);
1076-
if (second_pass_whole==1&&physSize<CFS_IMPLICIT_GC_THRESHOLD)
1079+
if (second_pass_whole==1&&physSize<CFS_RETRY_GC_THRESHOLD)
10771080
{
10781081
cfs_gc_unlock(lock);
10791082
/* sleep, cause there is possibly checkpoint is on a way */
@@ -1082,6 +1085,7 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
10821085
second_pass_bytes=0;
10831086
gotoretry;
10841087
}
1088+
forceWhole:
10851089
for (i=0;i<n_pages;i++)
10861090
{
10871091
newMap->inodes[i]=map->inodes[i];

‎src/include/storage/cfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typedef uint64 inode_t;
5353
#defineCFS_INODE_CLEAN_FLAG ((inode_t)1 << 63)
5454

5555
#defineCFS_IMPLICIT_GC_THRESHOLD 0x80000000U/* 2Gb */
56+
#defineCFS_RETRY_GC_THRESHOLD 0x60000000U/* 1.5Gb */
5657
#defineCFS_RED_LINE 0xC0000000U/* 3Gb */
5758

5859
size_tcfs_compress(void*dst,size_tdst_size,voidconst*src,size_tsrc_size);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp