From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | ashutosh(dot)bapat(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org, Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp, fcs1(at)poczta(dot)onet(dot)pl |
Subject: | Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING |
Date: | 2017-07-21 05:25:51 |
Message-ID: | 20170721.142551.115979579.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
At Thu, 20 Jul 2017 18:15:42 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in <18927(dot)1500588942(at)sss(dot)pgh(dot)pa(dot)us>
> This seems like overkill. We can test it reasonably easily within the
> existing framework, as shown in the attached patch. I'm also fairly
It checks for a disconnection caused in a single session. I
thought that its inter-process characteristics is important
(since I had forgot that in the previous version), but it is
reasonable enough if we can rely on the fact that it surely works
through invalidation mechanism.
In shoft, I agree to the test in your patch.
> concerned that what you're showing here would be unstable in the buildfarm
> as a result of race conditions between the multiple sessions.
Sure. It is what I meant by 'fragile'.
> I made some cosmetic updates to the code patch, as well.
Thank you for leaving the hashvalue staff and revising the comment.
By the way I mistakenly had left the following code in the
previous patch.
+ /* hashvalue == 0 means a cache reset, must clear all state */
+ if (hashvalue == 0)
+ entry->invalidated = true;
+ else if ((cacheid == FOREIGNSERVEROID &&
+ entry->server_hashvalue == hashvalue) ||
+ (cacheid == USERMAPPINGOID &&
+ entry->mapping_hashvalue == hashvalue))
+ entry->invalidated = true;
The reason for the redundancy was that it had used switch-case in
the else block just before. However, it is no longer
reasonable. I'd like to change here as the follows.
+ /* hashvalue == 0 means a cache reset, must clear all state */
+ if ((hashvalue == 0) ||
+ ((cacheid == FOREIGNSERVEROID &&
+ entry->server_hashvalue == hashvalue) ||
+ (cacheid == USERMAPPINGOID &&
+ entry->mapping_hashvalue == hashvalue)))
+ entry->invalidated = true;
The attached patch differs only in this point.
> I think this is actually a bug fix, and should not wait for the next
> commitfest.
Agreed.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
pgfdw_reconnect_on_option_change_v5.patch | text/x-patch | 12.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro HORIGUCHI | 2017-07-21 05:37:03 | Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING |
Previous Message | Alvaro Herrera | 2017-07-20 22:23:05 | Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2017-07-21 05:31:46 | Re: [TRAP: FailedAssertion] causing server to crash |
Previous Message | Jeff Janes | 2017-07-21 05:04:17 | Re: Better error message for trying to drop a DB with open subscriptions? |