Fix a bug when setting DistributedLogShared->oldestXmin
The shared oldestXmin (DistributedLogShared->oldestXmin) may be updated
concurrently. It should be set to a higher value, because a higher xmin
can belong to another distributed log segment, its older segments might
already be truncated.
For Example: txA and txB call DistributedLog_AdvanceOldestXmin concurrently.
```
txA and txB: both hold shared DistributedLogTruncateLock.
txA: set the DistributedLogShared->oldestXmin to XminA. TransactionIdToSegment(XminA) = 0009
txB: set the DistributedLogShared->oldestXmin to XminB. TransactionIdToSegment(XminB) = 0008
txA: truncate segment 0008, 0007...
```
After that, DistributedLogShared->oldestXmin == XminB, it is on removed
segment 0008. Subsequent GetSnapshotData() calls will be failed because SimpleLruReadPage will error out.
Co-authored-by: Ndh-cloud <60729713+dh-cloud@users.noreply.github.com>
Showing
想要评论请 注册 或 登录