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

Commit9af8b2e

Browse files
committed
Alter background_gc_enable in cfs_start_gc
1 parente32962c commit9af8b2e

File tree

1 file changed

+18
-1
lines changed
  • src/backend/storage/file

1 file changed

+18
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,25 @@ Datum cfs_start_gc(PG_FUNCTION_ARGS)
12531253

12541254
Datumcfs_enable_gc(PG_FUNCTION_ARGS)
12551255
{
1256+
boolenabled=PG_GETARG_BOOL(0);
12561257
boolwas_enabled=cfs_state->background_gc_enabled;
1257-
cfs_state->background_gc_enabled=PG_GETARG_BOOL(0);
1258+
cfs_state->background_gc_enabled=enabled;
1259+
1260+
if (was_enabled&& !enabled)
1261+
{
1262+
/* Wait until there are no active GC workers */
1263+
while (pg_atomic_read_u32(&cfs_state->n_active_gc)!=0)
1264+
{
1265+
intrc=WaitLatch(MyLatch,
1266+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
1267+
CFS_DISABLE_TIMEOUT/* ms */);
1268+
if (rc&WL_POSTMASTER_DEATH)
1269+
exit(1);
1270+
1271+
ResetLatch(MyLatch);
1272+
CHECK_FOR_INTERRUPTS();
1273+
}
1274+
}
12581275
PG_RETURN_BOOL(was_enabled);
12591276
}
12601277

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp