mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Add injection-point test for new multixact CV usage
Before commita0e0fb1ba5, multixact.c contained a case in the multixact-read path where it would loop sleeping 1ms each time until another multixact-create path completed, which was uncovered by any tests. That commit changed the code to rely on a condition variable instead. Add a test now, which relies on injection points and "loading" thereof (because of it being in a critical section), per commit4b211003ec. Author: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Michaël Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/0925F9A9-4D53-4B27-A87E-3D83A757B0E0@yandex-team.ru
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
#include "storage/proc.h"
|
||||
#include "storage/procarray.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/injection_point.h"
|
||||
#include "utils/guc_hooks.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
@@ -868,6 +869,8 @@ MultiXactIdCreateFromMembers(int nmembers, MultiXactMember *members)
|
||||
*/
|
||||
multi = GetNewMultiXactId(nmembers, &offset);
|
||||
|
||||
INJECTION_POINT("multixact-create-from-members");
|
||||
|
||||
/* Make an XLOG entry describing the new MXID. */
|
||||
xlrec.mid = multi;
|
||||
xlrec.moff = offset;
|
||||
@@ -1480,6 +1483,8 @@ retry:
|
||||
LWLockRelease(lock);
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
INJECTION_POINT("multixact-get-members-cv-sleep");
|
||||
|
||||
ConditionVariableSleep(&MultiXactState->nextoff_cv,
|
||||
WAIT_EVENT_MULTIXACT_CREATION);
|
||||
slept = true;
|
||||
|
||||
Reference in New Issue
Block a user