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

Commit a18bc40

Browse files
committed
Do not stop CFS GC in case of errors
1 parent fe395b3 commit a18bc40

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/backend/storage/file/cfs.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,13 +1107,22 @@ static void cfs_gc_bgworker_main(Datum arg)
11071107

11081108
elog(INFO, "Start CFS garbage collector %d", MyProcPid);
11091109

1110-
while (cfs_gc_scan_tablespace(worker_id)
1111-
&& !cfs_gc_stop
1112-
&& --cfs_state->max_iterations >= 0)
1110+
while (true)
11131111
{
1114-
int rc = WaitLatch(MyLatch,
1115-
WL_TIMEOUT | WL_POSTMASTER_DEATH,
1116-
cfs_gc_period /* ms */ );
1112+
int timeout = cfs_gc_period;
1113+
int rc;
1114+
1115+
if (!cfs_gc_scan_tablespace(worker_id))
1116+
{
1117+
timeout = CFS_RETRY_TIMEOUT;
1118+
}
1119+
if (cfs_gc_stop || --cfs_state->max_iterations <= 0)
1120+
{
1121+
break;
1122+
}
1123+
rc = WaitLatch(MyLatch,
1124+
WL_TIMEOUT | WL_POSTMASTER_DEATH,
1125+
timeout /* ms */ );
11171126
if (rc & WL_POSTMASTER_DEATH)
11181127
exit(1);
11191128
}

src/include/storage/cfs.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
#define CFS_GC_LOCK 0x10000000
1212

13-
#define CFS_LOCK_MIN_TIMEOUT 100 /* microseconds */
13+
#define CFS_LOCK_MIN_TIMEOUT 100 /* microseconds: initial timeout of GC lock acquisition */
1414
#define CFS_LOCK_MAX_TIMEOUT 10000 /* microseconds */
15-
#define CFS_DISABLE_TIMEOUT 1000 /* milliseconds */
15+
#define CFS_DISABLE_TIMEOUT 1000 /* milliseconds: timeout of waiting for enabling GC */
16+
#define CFS_RETRY_TIMEOUT 10000 /* milliseconds: delay between GC iterations in case of error */
1617
#define CFS_ESTIMATE_PROBES 10
1718

1819
/*

0 commit comments

Comments
 (0)