XTM & parallel search

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: XTM & parallel search
Date: 2016-06-02 20:04:09
Message-ID: 57509139.2090605@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We have to add three more functions to eXtensible Transaction Manager API (XTM):

/*
* Calculate transaction state size. This method is invoked by EstimateTransactionStateSpace to copy transaction
* state to parallel workers
*/
size_t (*GetTransactionStateSize)(void);

/*
* Serialize transaction state
*/
void (*SerializeTransactionState)(void* ctx);

/*
* Deserialize transaction state
*/
void (*DeserializeTransactionState)(void* ctx);

The reason is that we find out that our multimaster is not correctly working when max_parallel_workers > 0
because multimaster transaction context is not properly shared between workers.
Unfortunately right now serialization/deserialization of transaction state is hardcoded in xact.c. and IMHO is done in quite ugly way:

XactIsoLevel = (int) tstate[0];
XactDeferrable = (bool) tstate[1];
XactTopTransactionId = tstate[2];
CurrentTransactionState->transactionId = tstate[3];
currentCommandId = tstate[4];
nParallelCurrentXids = (int) tstate[5];
ParallelCurrentXids = &tstate[6];

- there is even no declared structure with fixed part of saved context.
I wonder if not only DTM will be interested in sharing some common state between workers and should we provide some way of replicating user defined context between workers? From my point of view XTM seems to be good place for it...

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-06-02 20:08:56 Re: Rename max_parallel_degree?
Previous Message Josh berkus 2016-06-02 19:52:09 Re: Rename max_parallel_degree?