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

Commitd9dc2b4

Browse files
committed
Code review for isolationtester changes.
Fix a few oversights in38f8bdc:don't leak memory in run_permutation(), remember when we've issueda cancel rather than issuing another one every 10ms,fix some typos in comments.
1 parent07d25a9 commitd9dc2b4

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

‎src/test/isolation/isolationtester.c

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,6 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
478478
Step**waiting;
479479
Step**errorstep;
480480

481-
waiting=malloc(sizeof(Step*)*testspec->nsessions);
482-
errorstep=malloc(sizeof(Step*)*testspec->nsessions);
483-
484481
/*
485482
* In dry run mode, just display the permutation in the same format used
486483
* by spec files, and return.
@@ -494,6 +491,9 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
494491
return;
495492
}
496493

494+
waiting=malloc(sizeof(Step*)*testspec->nsessions);
495+
errorstep=malloc(sizeof(Step*)*testspec->nsessions);
496+
497497
printf("\nstarting permutation:");
498498
for (i=0;i<nsteps;i++)
499499
printf(" %s",steps[i]->name);
@@ -548,14 +548,15 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
548548
* Check whether the session that needs to perform the next step
549549
* is still blocked on an earlier step. If so, wait for it to finish.
550550
*
551-
* In older versions of this tool,when allowed precisely one session
552-
* to be waiting at a time. If we reached a stepwhich required that
551+
*(In older versions of this tool,we allowed precisely one session
552+
* to be waiting at a time. If we reached a stepthat required that
553553
* session to execute the next command, we would declare the whole
554-
* permutation invalid, cancel everything, and move on to the next one.
555-
* Unfortunately, that made it impossible to test the deadlock detector
556-
* using this framework unless the numebr of processes involved in the
557-
* deadlock was precisely two. We now assume that if we reach a step
558-
* that is still blocked, we need to wait for it to unblock itself.
554+
* permutation invalid, cancel everything, and move on to the next
555+
* one. Unfortunately, that made it impossible to test the deadlock
556+
* detector using this framework, unless the number of processes
557+
* involved in the deadlock was precisely two. We now assume that if
558+
* we reach a step that is still blocked, we need to wait for it to
559+
* unblock itself.)
559560
*/
560561
for (w=0;w<nwaiting;++w)
561562
{
@@ -689,6 +690,9 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
689690
}
690691
PQclear(res);
691692
}
693+
694+
free(waiting);
695+
free(errorstep);
692696
}
693697

694698
/*
@@ -786,12 +790,17 @@ try_complete_step(Step *step, int flags)
786790
if (td>60*USECS_PER_SEC&& !canceled)
787791
{
788792
PGcancel*cancel=PQgetCancel(conn);
789-
charbuf[256];
790793

791-
if (cancel!=NULL&& !PQcancel(cancel,buf,sizeof(buf)))
792-
fprintf(stderr,"PQcancel failed: %s\n",buf);
793794
if (cancel!=NULL)
795+
{
796+
charbuf[256];
797+
798+
if (PQcancel(cancel,buf,sizeof(buf)))
799+
canceled= true;
800+
else
801+
fprintf(stderr,"PQcancel failed: %s\n",buf);
794802
PQfreeCancel(cancel);
803+
}
795804
}
796805

797806
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp