Re: Fix for consume_xids advancing XIDs incorrectly

2024-12-03 Thread Kirill Reshke
On Wed, 30 Oct 2024 at 12:01, Yushi Ogiwara wrote: > > I made a new patch (skip_xid_correctly.diff) that incorporates the > points we discussed: > > 1. Fix the issue that consume_xids consumes nxids+1 XIDs. > 2. Update lastxid when calling GetTopFullTransactionId() to support > nxids==1 case. > 3.

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-31 Thread Masahiko Sawada
On Wed, Oct 30, 2024 at 12:00 AM Yushi Ogiwara wrote: > > I made a new patch (skip_xid_correctly.diff) that incorporates the > points we discussed: > > 1. Fix the issue that consume_xids consumes nxids+1 XIDs. > 2. Update lastxid when calling GetTopFullTransactionId() to support > nxids==1 case. >

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-30 Thread Yushi Ogiwara
I made a new patch (skip_xid_correctly.diff) that incorporates the points we discussed: 1. Fix the issue that consume_xids consumes nxids+1 XIDs. 2. Update lastxid when calling GetTopFullTransactionId() to support nxids==1 case. 3. Forbid consume_xids when nxids==0. 4. Add comments explaining

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-29 Thread Fujii Masao
On 2024/10/29 18:00, Yushi Ogiwara wrote:     consumed = XidSkip(nextXid);     if (consumed > 0)     TransamVariables->nextXid.value += (uint64) consumed; BTW, the code snippet above in consume_xids_shortcut() could potentially set the next XID to a value below FirstNorm

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-29 Thread Yushi Ogiwara
consumed = XidSkip(nextXid); if (consumed > 0) TransamVariables->nextXid.value += (uint64) consumed; BTW, the code snippet above in consume_xids_shortcut() could potentially set the next XID to a value below FirstNormalTransactionId? If yes, we should account f

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-25 Thread Masahiko Sawada
On Thu, Oct 24, 2024 at 7:55 AM Fujii Masao wrote: > > > > On 2024/10/24 5:23, Masahiko Sawada wrote: > >> if (xids_left > 2000 && > >> consumed - last_reported_at < REPORT_INTERVAL && > >> MyProc->subxidStatus.overflowed) > >> { > >>

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-24 Thread Fujii Masao
On 2024/10/24 5:23, Masahiko Sawada wrote: if (xids_left > 2000 && consumed - last_reported_at < REPORT_INTERVAL && MyProc->subxidStatus.overflowed) { int64 consumed_by_shortcut = consume_xids_shortcut();

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-23 Thread Masahiko Sawada
On Tue, Oct 22, 2024 at 11:47 PM Fujii Masao wrote: > > > > On 2024/10/18 14:57, Yushi Ogiwara wrote: > > In conclusion, I agree that: > > > > * Update lastxid with GetTopTransactionId(). > > * consume_xids with 0 should raise an error. > > > > I have attached a new patch that incorporates you

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-22 Thread Fujii Masao
On 2024/10/18 14:57, Yushi Ogiwara wrote: In conclusion, I agree that: * Update lastxid with GetTopTransactionId(). * consume_xids with 0 should raise an error. I have attached a new patch that incorporates your suggestions. One concern in this discussion is that the return value of th

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-16 Thread Masahiko Sawada
On Tue, Oct 15, 2024 at 10:06 PM Yushi Ogiwara wrote: > > Hi, > > Thank you for your comment. > > Regarding the first patch, I believe it works correctly when > consume_xids(1) is called. This is because the lastxid variable in the > consume_xids_common function is initialized as lastxid = > Read

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-15 Thread Yushi Ogiwara
Hi, Thank you for your comment. Regarding the first patch, I believe it works correctly when consume_xids(1) is called. This is because the lastxid variable in the consume_xids_common function is initialized as lastxid = ReadNextFullTransactionId(), where the ReadNextFullTransactionId funct

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-15 Thread Masahiko Sawada
Hi, Thank you for the report. On Mon, Oct 14, 2024 at 6:51 PM Yushi Ogiwara wrote: > > Hi, > > I found that the consume_xids function incorrectly advances XIDs as > shown: > > postgres=# select txid_current(); > txid_current > -- > 746 > (1 row) > > postgres=# select consu

Fix for consume_xids advancing XIDs incorrectly

2024-10-14 Thread Yushi Ogiwara
Hi, I found that the consume_xids function incorrectly advances XIDs as shown: postgres=# select txid_current(); txid_current -- 746 (1 row) postgres=# select consume_xids('100'); consume_xids -- 847 (1 row) In the example, the consume_xids function