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

Commit9c321d6

Browse files
committed
Wait and reset MyLatch in CFS WaitLatch calls
1 parentceecae4 commit9c321d6

File tree

1 file changed

+16
-4
lines changed
  • src/backend/storage/file

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,14 @@ static bool cfs_gc_file(char* map_path, bool background)
669669
pg_atomic_fetch_sub_u32(&cfs_state->n_active_gc,1);
670670

671671
rc=WaitLatch(MyLatch,
672-
WL_TIMEOUT |WL_POSTMASTER_DEATH,
672+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
673673
CFS_DISABLE_TIMEOUT/* ms */);
674674
if (cfs_gc_stop|| (rc&WL_POSTMASTER_DEATH))
675675
exit(1);
676676

677+
CHECK_FOR_INTERRUPTS();
678+
ResetLatch(MyLatch);
679+
677680
pg_atomic_fetch_add_u32(&cfs_state->n_active_gc,1);
678681
}
679682

@@ -1014,10 +1017,13 @@ static bool cfs_gc_file(char* map_path, bool background)
10141017
if (cfs_gc_delay!=0)
10151018
{
10161019
intrc=WaitLatch(MyLatch,
1017-
WL_TIMEOUT |WL_POSTMASTER_DEATH,
1020+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
10181021
cfs_gc_delay/* ms */ );
10191022
if (rc&WL_POSTMASTER_DEATH)
10201023
exit(1);
1024+
1025+
CHECK_FOR_INTERRUPTS();
1026+
ResetLatch(MyLatch);
10211027
}
10221028
}
10231029
elseif (cfs_state->max_iterations==1)
@@ -1134,10 +1140,13 @@ static void cfs_gc_bgworker_main(Datum arg)
11341140
break;
11351141
}
11361142
rc=WaitLatch(MyLatch,
1137-
WL_TIMEOUT |WL_POSTMASTER_DEATH,
1143+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
11381144
timeout/* ms */ );
11391145
if (rc&WL_POSTMASTER_DEATH)
11401146
exit(1);
1147+
1148+
CHECK_FOR_INTERRUPTS();
1149+
ResetLatch(MyLatch);
11411150
}
11421151
}
11431152

@@ -1176,10 +1185,13 @@ bool cfs_control_gc(bool enabled)
11761185
while (pg_atomic_read_u32(&cfs_state->n_active_gc)!=0)
11771186
{
11781187
intrc=WaitLatch(MyLatch,
1179-
WL_TIMEOUT |WL_POSTMASTER_DEATH,
1188+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
11801189
CFS_DISABLE_TIMEOUT/* ms */);
11811190
if (rc&WL_POSTMASTER_DEATH)
11821191
exit(1);
1192+
1193+
CHECK_FOR_INTERRUPTS();
1194+
ResetLatch(MyLatch);
11831195
}
11841196
}
11851197
returnwas_enabled;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp