File tree 2 files changed +16
-6
lines changed 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -369,7 +369,6 @@ void MtmLock(LWLockMode mode)
369
369
}
370
370
#endif
371
371
if (mode == LW_EXCLUSIVE ) {
372
- // Assert(MtmLockCount == 0);
373
372
Assert (MyProcPid != 0 );
374
373
Mtm -> lastLockHolder = MyProcPid ;
375
374
Assert (MyProcPid );
@@ -382,12 +381,17 @@ void MtmLock(LWLockMode mode)
382
381
383
382
void MtmUnlock (void )
384
383
{
385
- if (MtmLockCount != 0 && -- MtmLockCount != 0 ) {
386
- Assert (Mtm -> lastLockHolder == MyProcPid );
387
- return ;
384
+ if (Mtm -> lastLockHolder == MyProcPid )
385
+ {
386
+ if (MtmLockCount != 0 && -- MtmLockCount != 0 ) {
387
+ return ;
388
+ }
389
+ Mtm -> lastLockHolder = 0 ;
390
+ }
391
+ else
392
+ {
393
+ MtmLockCount = 0 ;
388
394
}
389
-
390
- Mtm -> lastLockHolder = 0 ;
391
395
392
396
/* If we have no PGPROC, then lock was not obtained. */
393
397
if (MyProc != NULL )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ char const* connection = "dbname=regression host=localhost port=5432 sslmode=dis
16
16
int n_records = 100 ;
17
17
int n_clients = 100 ;
18
18
int first_tid ;
19
+ int delay = 0 ;
19
20
long inserts [MAX_THREADS ];
20
21
volatile int termination ;
21
22
@@ -53,6 +54,7 @@ void* worker(void* arg)
53
54
fprintf (stderr , "Insert affect wrong number of tuples: %s\n" , PQcmdTuples (res ));
54
55
exit (1 );
55
56
}
57
+ usleep (delay );
56
58
inserts [id ] += 1 ;
57
59
PQclear (res );
58
60
}
@@ -93,6 +95,9 @@ int main (int argc, char* argv[])
93
95
case 'i' :
94
96
initialize = 1 ;
95
97
continue ;
98
+ case 'p' :
99
+ delay = atoi (argv [++ i ]);
100
+ continue ;
96
101
case 'f' :
97
102
first_tid = atoi (argv [++ i ]);
98
103
continue ;
@@ -101,6 +106,7 @@ int main (int argc, char* argv[])
101
106
printf ("Options:\n"
102
107
"\t-i\tinitialize database\n"
103
108
"\t-f\tfirst thread ID (default 0)\n"
109
+ "\t-p\tdelay (microseconds)\n"
104
110
"\t-c\tnumber of client (default 100)\n"
105
111
"\t-t\ttest duration (default 10 sec)\n"
106
112
"\t-d\tconnection string ('host=localhost port=5432')\n" );
You can’t perform that action at this time.
0 commit comments