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

Commit8f9dbbc

Browse files
author
Sokolov Yura
committed
cfs: reload configuration in background worker.
1 parent84d010f commit8f9dbbc

File tree

1 file changed

+24
-2
lines changed
  • src/backend/storage/file

1 file changed

+24
-2
lines changed

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ CfsState* cfs_state;
9999

100100
staticboolcfs_gc_stop;
101101
staticintcfs_gc_processed_segments;
102+
staticboolgot_SIGHUP= false;
102103

103104

104105
/* ----------------------------------------------------------------
@@ -1228,16 +1229,21 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
12281229
}
12291230
pg_atomic_fetch_sub_u32(&cfs_state->n_active_gc,1);
12301231

1231-
if (cfs_gc_delay!=0&&performed&&background==CFS_BACKGROUND)
1232+
if (background==CFS_BACKGROUND)
12321233
{
12331234
intrc=WaitLatch(MyLatch,
12341235
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
1235-
cfs_gc_delay/* ms */ );
1236+
performed ?cfs_gc_delay :0/* ms */ );
12361237
if (rc&WL_POSTMASTER_DEATH)
12371238
exit(1);
12381239

12391240
ResetLatch(MyLatch);
12401241
CHECK_FOR_INTERRUPTS();
1242+
if (got_SIGHUP)
1243+
{
1244+
got_SIGHUP= false;
1245+
ProcessConfigFile(PGC_SIGHUP);
1246+
}
12411247
}
12421248
returnsucceed;
12431249
}
@@ -1295,6 +1301,16 @@ static void cfs_gc_cancel(int sig)
12951301
cfs_gc_stop= true;
12961302
}
12971303

1304+
staticvoidcfs_sighup(SIGNAL_ARGS)
1305+
{
1306+
intsave_errno=errno;
1307+
1308+
got_SIGHUP= true;
1309+
SetLatch(MyLatch);
1310+
1311+
errno=save_errno;
1312+
}
1313+
12981314
/*
12991315
* Now compression can be applied only to the tablespace
13001316
* in general, so gc workers traverse pg_tblspc directory.
@@ -1311,6 +1327,7 @@ static void cfs_gc_bgworker_main(Datum arg)
13111327
pqsignal(SIGINT,cfs_gc_cancel);
13121328
pqsignal(SIGQUIT,cfs_gc_cancel);
13131329
pqsignal(SIGTERM,cfs_gc_cancel);
1330+
pqsignal(SIGHUP,cfs_sighup);
13141331

13151332
/* We're now ready to receive signals */
13161333
BackgroundWorkerUnblockSignals();
@@ -1338,6 +1355,11 @@ static void cfs_gc_bgworker_main(Datum arg)
13381355

13391356
ResetLatch(MyLatch);
13401357
CHECK_FOR_INTERRUPTS();
1358+
if (got_SIGHUP)
1359+
{
1360+
got_SIGHUP= false;
1361+
ProcessConfigFile(PGC_SIGHUP);
1362+
}
13411363
}
13421364
}
13431365

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp