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

Commit2f4ee3a

Browse files
committed
Fix possible cache invalidation failure in ReceiveSharedInvalidMessages.
Commitfad153e modified sinval.c to reducethe number of calls into sinvaladt.c (which require taking a shared lock)by keeping a local buffer of collected-but-not-yet-processed messages.However, if processing of the last message in a batch resulted in arecursive call to ReceiveSharedInvalidMessages, we could overwrite thatmessage with a new one while the outer invalidation function was stillworking on it. This would be likely to lead to invalidation of the wrongcache entry, allowing subsequent processing to use stale cache data.The fix is just to make a local copy of each message while we're processingit.Spotted by Andres Freund. Back-patch to 8.4 where the bug was introduced.
1 parente709807 commit2f4ee3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/backend/storage/ipc/sinval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ ReceiveSharedInvalidMessages(
8888
/* Deal with any messages still pending from an outer recursion */
8989
while (nextmsg<nummsgs)
9090
{
91-
SharedInvalidationMessage*msg=&messages[nextmsg++];
91+
SharedInvalidationMessagemsg=messages[nextmsg++];
9292

93-
invalFunction(msg);
93+
invalFunction(&msg);
9494
}
9595

9696
do
@@ -116,9 +116,9 @@ ReceiveSharedInvalidMessages(
116116

117117
while (nextmsg<nummsgs)
118118
{
119-
SharedInvalidationMessage*msg=&messages[nextmsg++];
119+
SharedInvalidationMessagemsg=messages[nextmsg++];
120120

121-
invalFunction(msg);
121+
invalFunction(&msg);
122122
}
123123

124124
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp