From: | "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Minimal logical decoding on standbys |
Date: | 2022-12-16 10:33:50 |
Message-ID: | 60a6476d-f799-39ff-7cd6-98b2665a2c0b@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 12/15/22 11:31 AM, Drouvot, Bertrand wrote:
> Hi,
>
> On 12/14/22 4:55 PM, Robert Haas wrote:
>> On Wed, Dec 14, 2022 at 8:06 AM Drouvot, Bertrand> Other comments:
>>
>> + if RelationIsAccessibleInLogicalDecoding(rel)
>> + xlrec.flags |= VISIBILITYMAP_ON_CATALOG_ACCESSIBLE_IN_LOGICAL_DECODING;
>>
>> This is a few parentheses short of where it should be. Hilariously it
>> still compiles because there are parentheses in the macro definition.
>
> Oops, thanks will fix.
Fixed in v32 attached.
>
>>
>> + xlrec.onCatalogAccessibleInLogicalDecoding =
>> RelationIsAccessibleInLogicalDecoding(relation);
>>
>> These lines are quite long. I think we should consider (1) picking a
>> shorter name for the xlrec field and, if it's such lines are going to
>> still routinely exceed 80 characters, (2) splitting them into two
>> lines, with the second one indented to match pgindent's preferences in
>> such cases, which I think is something like this:
>>
>> xlrec.onCatalogAccessibleInLogicalDecoding =
>> RelationIsAccessibleInLogicalDecoding(relation);
>>
>> As far as renaming, I think we could at least remove onCatalog part
>> from the identifier, as that doesn't seem to be adding much. And maybe
>> we could even think of changing it to something like
>> logicalDecodingConflict or even decodingConflict, which would shave
>> off a bunch more characters.
>
>
> I'm not sure I like the decodingConflict proposal. Indeed, it might be there is no conflict (depending of the xids
> comparison).
>
> What about "checkForConflict"?
In v32 attached, it is renamed to mayConflictInLogicalDecoding (I think it's important it reflects
that it is linked to the logical decoding and the "uncertainty" of the conflict). What do you think?
>
>>
>> + if (heapRelation->rd_options)
>> + isusercatalog = ((StdRdOptions *)
>> (heapRelation)->rd_options)->user_catalog_table;
>>
>> Couldn't you get rid of the if statement here and also the
>> initialization at the top of the function and just write isusercatalog
>> = RelationIsUsedAsCatalogTable(heapRelation)? Or even just get rid of
>> the variable entirely and pass
>> RelationIsUsedAsCatalogTable(heapRelation) as the argument to
>> UpdateIndexRelation directly?
>>
>
> Yeah, that's better, will do, thanks!
Fixed in v32 attached.
>
> While at it, I'm not sure that isusercatalog should be visible in pg_index.
> I mean, this information could be retrieved with a join on pg_class (on the table the index is linked to), so the weirdness to have it visible.
> I did not check how difficult it would be to make it "invisible" though.
> What do you think?
>
It's still visible in v32 attached.
I had a second thought on it and it does not seem like a "real" concern to me.
>> I think this could use some test cases demonstrating that
>> indisusercatalog gets set correctly in all the relevant cases: table
>> is created with user_catalog_table = true/false, reloption is changed,
>> reloptions are reset, new index is added later, etc.
>>
>
> v31 already provides a few checks:
>
> - After index creation on relation with user_catalog_table = true
> - Propagation is done correctly after a user_catalog_table RESET
> - Propagation is done correctly after an ALTER SET user_catalog_table = true
> - Propagation is done correctly after an ALTER SET user_catalog_table = false
>
> In v32, I can add a check for index creation after each of the last 3 mentioned above and one when a table is created with user_catalog_table = false.
>
v32 attached is adding the checks mentioned above.
v32 does not change anything linked to the alignment discussion, as I think this will depend of its outcome.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
v32-0006-Fixing-Walsender-corner-case-with-logical-decodi.patch | text/plain | 7.5 KB |
v32-0005-Doc-changes-describing-details-about-logical-dec.patch | text/plain | 2.1 KB |
v32-0004-New-TAP-test-for-logical-decoding-on-standby.patch | text/plain | 20.4 KB |
v32-0003-Allow-logical-decoding-on-standby.patch | text/plain | 11.5 KB |
v32-0002-Handle-logical-slot-conflicts-on-standby.patch | text/plain | 27.9 KB |
v32-0001-Add-info-in-WAL-records-in-preparation-for-logic.patch | text/plain | 31.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2022-12-16 10:39:44 | Re: Perform streaming logical transactions by background workers and parallel apply |
Previous Message | houzj.fnst@fujitsu.com | 2022-12-16 09:17:37 | RE: Perform streaming logical transactions by background workers and parallel apply |