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

Commit97fb88e

Browse files
committed
Fix isolationtester race condition for notices sent before blocking.
If a test sends a notice just before blocking, it's possible onslow machines for isolationtester to detect the blocked state beforeit's consumed the notice. (For this to happen, the notice would haveto arrive after isolationtester has waited for data for 10ms, so onfast/lightly-loaded machines it's hard to reproduce the failure.)But, if we have seen the backend as blocked, it's certainly alreadysent any notices it's going to send. Therefore, one more round ofPQconsumeInput and PQisBusy should be enough to collect and processany such notices.Back-patch of3071763 into v12. We're still discussing whetherto back-patch this further and/or back-patch some other recentisolationtester fixes, but this much is provably necessary tomake the test cases added by27cc7cd stable in v12.Discussion:https://postgr.es/m/14616.1564251339@sss.pgh.pa.usDiscussion:https://postgr.es/m/E1i7IqC-0000Uc-5H@gemulon.postgresql.org
1 parent84bb33c commit97fb88e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/test/isolation/isolationtester.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,28 @@ try_complete_step(Step *step, int flags)
764764

765765
if (waiting)/* waiting to acquire a lock */
766766
{
767+
/*
768+
* Since it takes time to perform the lock-check query,
769+
* some data --- notably, NOTICE messages --- might have
770+
* arrived since we looked. We must call PQconsumeInput
771+
* and then PQisBusy to collect and process any such
772+
* messages. In the (unlikely) case that PQisBusy then
773+
* returns false, we might as well go examine the
774+
* available result.
775+
*/
776+
if (!PQconsumeInput(conn))
777+
{
778+
fprintf(stderr,"PQconsumeInput failed: %s\n",
779+
PQerrorMessage(conn));
780+
exit(1);
781+
}
782+
if (!PQisBusy(conn))
783+
break;
784+
785+
/*
786+
* conn is still busy, so conclude that the step really is
787+
* waiting.
788+
*/
767789
if (!(flags&STEP_RETRY))
768790
printf("step %s: %s <waiting ...>\n",
769791
step->name,step->sql);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp