Re: Stopping logical replication protocol - Mailing list pgsql-hackers
From | Vladimir Gordiychuk |
---|---|
Subject | Re: Stopping logical replication protocol |
Date | |
Msg-id | CAFgjRd1BvModXisBB==AO2uL-5byPkqBC9+Y=jF5qPgxbnUyGg@mail.gmail.com Whole thread Raw |
In response to | Re: Stopping logical replication protocol (Craig Ringer <craig@2ndquadrant.com>) |
Responses |
Re: Stopping logical replication protocol
|
List | pgsql-hackers |
>Review comments on the 2nd patch, i.e. the 2nd half of your original patch:
>
>* Other places in logical decoding use the CB suffix for callback
>types. This should do the same.
>
>* I'm not too keen on the name is_active for the callback. We
>discussed the name continue_decoding_cb in our prior conversation.
>
>* Instead of having LogicalContextAlwaysActive, would it be better to
>test if the callback pointer is null and skip it if so?
>
>* Lots of typos in LogicalContextAlwaysActive comments, and wording is unclear
>
>* comment added to arguments of pg_logical_slot_get_changes_gu ts is
>not in PostgreSQL style - it goes way wide on the line. Probably
>better to put the comment above the call and mention which argument it
>refers to.
>
>* A comment somewhere is needed - probably on the IsStreamingActive()
>callback - to point readers at the fact that WalSndWriteData() calls
>ProcessRepliesIfAny() and that's how IsStreamingActive can get set. I
>had to look at the email discussion history to remind myself how this
>worked when I was re-reading the code.
>
>* I'm not keen on
>
> typedef ReorderBufferIsActive LogicalDecondingContextIsActiv e;
>
> I think instead a single callback name that encompasses both should
>be used. ContinueDecodingCB ?
>
>* Other places in logical decoding use the CB suffix for callback
>types. This should do the same.
>
>* I'm not too keen on the name is_active for the callback. We
>discussed the name continue_decoding_cb in our prior conversation.
>
>* Instead of having LogicalContextAlwaysActive, would it be better to
>test if the callback pointer is null and skip it if so?
>
>* Lots of typos in LogicalContextAlwaysActive comments, and wording is unclear
>
>* comment added to arguments of pg_logical_slot_get_changes_gu
>not in PostgreSQL style - it goes way wide on the line. Probably
>better to put the comment above the call and mention which argument it
>refers to.
>
>* A comment somewhere is needed - probably on the IsStreamingActive()
>callback - to point readers at the fact that WalSndWriteData() calls
>ProcessRepliesIfAny() and that's how IsStreamingActive can get set. I
>had to look at the email discussion history to remind myself how this
>worked when I was re-reading the code.
>
>* I'm not keen on
>
> typedef ReorderBufferIsActive LogicalDecondingContextIsActiv
>
> I think instead a single callback name that encompasses both should
>be used. ContinueDecodingCB ?
> * There are no tests. I don't see any really simple way to test this, though.
I will be grateful if you specify the best way how to do it. I tests this patches by pgjdbc driver tests that also build on head of postgres. You can check test scenario for both patches in PRhttps://github.com/pgjdbc/ pgjdbc/pull/550
org.postgresql.replication. LogicalReplicationTest# testDuringSendBigTransactionRe plicationStreamCloseNotActive
org.postgresql.replication. LogicalReplicationTest# testAfterCloseReplicationStrea mDBSlotStatusNotActive
2016-09-06 4:10 GMT+03:00 Craig Ringer <craig@2ndquadrant.com>:
On 25 August 2016 at 13:04, Craig Ringer <craig@2ndquadrant.com> wrote:
> By the way, I now think that the second part of your patch, to allow
> interruption during ReorderBufferCommit processing, is also very
> desirable.
I've updated your patch, rebasing it on top of 10.0 master and
splitting it into two pieces. I thought you were planning on following
up with an update to the second part, but maybe that was unclear from
our prior discussion, so I'm doing this to help get this moving again.
The first patch is what I posted earlier - the part of your patch that
allows the walsender to exit COPY BOTH mode and return to command mode
in response to a client-initiated CopyDone when it's in the
WalSndLoop. For logical decoding this means that it will notice a
client CopyDone when it's between transactions or while it's ingesting
transaction changes. It won't react to CopyDone while it's in
ReorderBufferCommit and sending a transaction to an output plugin
though.
The second piece is the other half of your original patch. Currently
unmodified from what you wrote. It adds a hook in ReorderBufferCommit
that calls back into the walsender to check for new client input and
interrupt processing. I haven't yet investigated this in detail.
Review comments on the 2nd patch, i.e. the 2nd half of your original patch:
* Other places in logical decoding use the CB suffix for callback
types. This should do the same.
* I'm not too keen on the name is_active for the callback. We
discussed the name continue_decoding_cb in our prior conversation.
* Instead of having LogicalContextAlwaysActive, would it be better to
test if the callback pointer is null and skip it if so?
* Lots of typos in LogicalContextAlwaysActive comments, and wording is unclear
* comment added to arguments of pg_logical_slot_get_changes_guts is
not in PostgreSQL style - it goes way wide on the line. Probably
better to put the comment above the call and mention which argument it
refers to.
* A comment somewhere is needed - probably on the IsStreamingActive()
callback - to point readers at the fact that WalSndWriteData() calls
ProcessRepliesIfAny() and that's how IsStreamingActive can get set. I
had to look at the email discussion history to remind myself how this
worked when I was re-reading the code.
* I'm not keen on
typedef ReorderBufferIsActive LogicalDecondingContextIsActive;
I think instead a single callback name that encompasses both should
be used. ContinueDecodingCB ?
* There are no tests. I don't see any really simple way to test this, though.
I suggest that you apply these updated/split patches to a fresh copy
of master then see if you can update it based on this feedback.
Something like:
git checkout master
git pull
git checkout -b stop-decoding-v10
git am /path/to/0001-Respect-client-initiated-CopyDone-in- walsender.patch
git am /path/to/0002-Second-part-of-Vladimir-Gordiychuk-s-patch. patch
then modify the code per the above, and "git commit --amend" the
changes and send an updated set of patches with "git format-patch -2"
.
I am setting this patch as "waiting on author" in the commitfest.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment
pgsql-hackers by date: