Re: Virtual tx id
От | Zhang Mingli |
---|---|
Тема | Re: Virtual tx id |
Дата | |
Msg-id | 21e65c15-f7ad-48c0-be19-0f53c786588e@Spark обсуждение исходный текст |
Ответ на | Virtual tx id (James Sewell <james.sewell@gmail.com>) |
Список | pgsql-hackers |
HI,
On Sep 21, 2022, 11:59 +0800, James Sewell <james.sewell@gmail.com>, wrote:
Hello Hackers!
Is it possible to get the current virtual txid from C somehow?
I've looked through the code, but can't seem to find anything other than getting a NULL when there is no (real) xid assigned. Maybe I'm missing something?
Cheers,
James
Virtual xid is meaningful only inside a read-only transaction.
It’s made up of MyProc->BackendId and MyProc->LocalTransactionId.
To catch it, you can begin a transaction, but don’t exec sqls that could change the db.
And gdb on process to see( must exec a read only sql to call StartTransaction, else MyProc->lxid is not assigned).
```
Begin;
// do nothing
```
gdb on it and see
```
p MyProc->lxid
p MyProc->backendId
```
Regards,
Zhang Mingli
В списке pgsql-hackers по дате отправления: