mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Fix parallel query on standby servers.
Without this fix, it inevitably bombs out with "ERROR: failed to initialize transaction_read_only to 0". Repair. Ashutosh Sharma; comments adjusted by me.
This commit is contained in:
parent
070140ee48
commit
dcfecaae9e
@ -482,11 +482,13 @@ show_log_timezone(void)
|
|||||||
* nothing since XactReadOnly will be reset by the next StartTransaction().
|
* nothing since XactReadOnly will be reset by the next StartTransaction().
|
||||||
* The IsTransactionState() test protects us against trying to check
|
* The IsTransactionState() test protects us against trying to check
|
||||||
* RecoveryInProgress() in contexts where shared memory is not accessible.
|
* RecoveryInProgress() in contexts where shared memory is not accessible.
|
||||||
|
* (Similarly, if we're restoring state in a parallel worker, just allow
|
||||||
|
* the change.)
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
check_transaction_read_only(bool *newval, void **extra, GucSource source)
|
check_transaction_read_only(bool *newval, void **extra, GucSource source)
|
||||||
{
|
{
|
||||||
if (*newval == false && XactReadOnly && IsTransactionState())
|
if (*newval == false && XactReadOnly && IsTransactionState() && !InitializingParallelWorker)
|
||||||
{
|
{
|
||||||
/* Can't go to r/w mode inside a r/o transaction */
|
/* Can't go to r/w mode inside a r/o transaction */
|
||||||
if (IsSubTransaction())
|
if (IsSubTransaction())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user