On Wed, Aug 7, 2024 at 12:38 PM shveta malik <shveta.ma...@gmail.com> wrote: > > On Wed, Jul 24, 2024 at 12:25 PM Hayato Kuroda (Fujitsu) > <kuroda.hay...@fujitsu.com> wrote: > > > > Issue #1 > > > > When handling a PREPARE message, the subscriber mistook the wrong lsn > > position > > (the end position of the last commit) as the end position of the current > > prepare. > > This can be fixed by adding a new global variable to record the end > > position of > > the last prepare. 0001 patch fixes the issue. > > Thanks for the patches. I have started reviewing this. I reviewed and > tested patch001 alone. >
It makes sense. As both are different bugs we should discuss them separately. > I have a query, shouldn't the local-lsn stored in > apply_handle_commit_prepared() be the end position of > 'COMMIT_PREPARED' instead of 'PREPARE'? I put additional logging on > sub and got this: > > LOG: apply_handle_prepare - prepare_data.end_lsn: 0/15892E0 , > XactLastPrepareEnd: 0/1537FD8. > LOG: apply_handle_commit_prepared - prepare_data.end_lsn: 0/1589318 > , XactLastPrepareEnd: 0/1537FD8. > > In apply_handle_prepare(), remote-lsn ('0/15892E0') is end position of > 'PREPARE' and in apply_handle_commit_prepared(), remote-lsn > ('0/1589318') is end position of 'COMMIT_PREPARED', while local-lsn in > both cases is end-lsn of 'PREPARE'. Details at [1]. > > Shouldn't we use 'XactLastCommitEnd' in apply_handle_commit_prepared() > which is the end position of last COMMIT_PREPARED? It is assigned in > the below flow: > apply_handle_commit_prepared-->CommitTransactionCommand...->RecordTransactionCommit? > I also think so. Additionally, I feel a test case (or some description of the bug that can arise) should be provided for issue-1. -- With Regards, Amit Kapila.