On Mon, Dec 19, 2022 at 5:35 PM Peter Smith <smithpb2250@gmail.com> wrote:
>
> On Mon, Dec 19, 2022 at 5:04 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > Peter Smith <smithpb2250@gmail.com> writes:
> > > My patch/idea makes a small change to the isolationtester spec
> > > grammar. Now each session can optionally specify its own connection
> > > string. When specified, this will override any connection string for
> > > that session that would otherwise have been used. This is the only
> > > change.
> >
> > Surely this cannot work, because isolationtester only runs one
> > monitoring session. How will it detect wait conditions for
> > sessions connected to some other postmaster?
> >
>
> You are right - probably it can't work in a generic sense. But if the
> "controller session" (internal session 0) is also configured to use
> the same conninfo as all my "publisher" sessions (the current patch
> can't do this but it seems only a small change) then all of the
> publisher-side sessions will be monitored like they ought to be --
> which is all I really needed I think.
>
PSA v2 of this patch. Now the conninfo can be specified at the *.spec
file global scope. This will set the connection string for the
"controller", and this will be used by every other session unless they
too specify a conninfo. For example,
======
# Set the isolationtester controller's conninfo. User sessions will also use
# this unless they specify otherwise.
conninfo "host=localhost port=7651"
################
# Publisher node
################
session ps1
setup
{
TRUNCATE TABLE tbl;
}
step ps1_ins { INSERT INTO tbl VALUES (111); }
step ps1_sel { SELECT * FROM tbl ORDER BY id; }
step ps1_begin { BEGIN; }
step ps1_commit { COMMIT; }
step ps1_rollback { ROLLBACK; }
session ps2
step ps2_ins { INSERT INTO tbl VALUES (222); }
step ps2_sel { SELECT * FROM tbl ORDER BY id; }
step ps2_begin { BEGIN; }
step ps2_commit { COMMIT; }
step ps2_rollback { ROLLBACK; }
#################
# Subscriber node
#################
session sub
conninfo "host=localhost port=7652"
setup
{
TRUNCATE TABLE tbl;
}
step sub_sleep { SELECT pg_sleep(3); }
step sub_sel { SELECT * FROM tbl ORDER BY id; }
...
======
The above spec file gives:
======
Parsed test spec with 3 sessions
control connection conninfo 'host=localhost port=7651'
ps1 conninfo 'host=localhost port=7651'
ps2 conninfo 'host=localhost port=7651'
sub conninfo 'host=localhost port=7652'
WARNING: session sub is not using same connection as the controller
...
======
In this way, IIUC the isolationtester's session locking mechanism can
work OK at least for all of my "publishing" sessions.
------
Kind Regards,
Peter Smith
Fujitsu Australia