From: | "imai(dot)yoshikazu(at)fujitsu(dot)com" <imai(dot)yoshikazu(at)fujitsu(dot)com> |
---|---|
To: | 'Thomas Munro' <thomas(dot)munro(at)gmail(dot)com>, btfujiitkp <btfujiitkp(at)oss(dot)nttdata(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | RE: Should we add xid_current() or a int8->xid cast? |
Date: | 2019-11-20 04:43:00 |
Message-ID: | OSBPR01MB46167CAF46463D79B0215250944F0@OSBPR01MB4616.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Thomas,
Please let me ask something about wraparound problem.
+static FullTransactionId
+convert_xid(TransactionId xid, FullTransactionId next_fxid)
{
- uint64 epoch;
+ TransactionId next_xid = XidFromFullTransactionId(next_fxid);
+ uint32 epoch = EpochFromFullTransactionId(next_fxid);
...
- /* xid can be on either side when near wrap-around */
- epoch = (uint64) state->epoch;
- if (xid > state->last_xid &&
- TransactionIdPrecedes(xid, state->last_xid))
+ if (xid > next_xid)
epoch--;
- else if (xid < state->last_xid &&
- TransactionIdFollows(xid, state->last_xid))
- epoch++;
- return (epoch << 32) | xid;
+ return FullTransactionIdFromEpochAndXid(epoch, xid);
ISTM codes for wraparound are deleted. Is that correct?
I couldn't have read all related threads about using FullTransactionId but
does using FullTransactionId avoid wraparound problem?
If we consider below conditions, we can say it's difficult to see wraparound
with current disk like SSD (2GB/s) or memory DDR4 (34GB/s), but if we can use
more high-spec hardware like HBM3 (2048GB/s), we can see wraparound. Or do
I say silly things?
* 10 year system ( < 2^4 )
* 1 year = 31536000 ( = 60 * 60 * 24 * 365) secs ( < 2^25 )
* 2^35 ( = 2^64 / 2^4 / 2^25) transactions we can use in each seconds
* we can write at (2^5 * 2^30 * n) bytes/sec = (32 * n) GB/sec if we use 'n'
bytes for each transactions.
Is there any agreement we can throw the wraparound problem away if we adopt
FullTransactionId?
Thanks
--
Yoshikazu Imai
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2019-11-20 04:44:23 | Re: logical decoding : exceeded maxAllocatedDescs for .spill files |
Previous Message | btkimurayuzk | 2019-11-20 04:11:16 | Re: Allow CREATE OR REPLACE VIEW to rename the columns |