Always use SnapshotNow for AO insert
SnapshotNow MUST be used during insert flow to fetch the latest EOF value from aoseg table. Earlier usage of ActiveSnapshot in AO insert flow caused data corruption as potentially could read incorrect or stale EOF value from aoseg. The specific scenario this happens when entry from AppendOnlyHash table gets evicted out. It invalidates (zeros out) the latestWriteXid and hence check for usedByConcurrentTransaction cannot be performed. So, any transaction later inserting data to same AO table, if it has aquired the snapshot and has latestWriteXid listed in its in-progress distributed transaction list, gets the same segfile to write. Based on DTM visibility rules using ActiveSnapshot current transaction will not read the EOF value from previous inserted transaction as its listed in its in-progress list and hence will overwrite the data but SnapshotNow will see the latest and make sure to append.
Showing
想要评论请 注册 或 登录