partition_snapshot_row_cursor: fix a continuity loss in ensure_entry_in_latest() with reverse reads
The FIXME comment claims that setting continity isn't very important in this place, but in fact this is just wrong. If two calls to read_from_underlying() get into a race, the one which finishes later can call ensure_entry_in_latest() on a position which lies inside a continuous interval in the newest version. If we don't take care to preserve the total continuity of the version, this can punch a hole in the continuity of the newest version, potentially reverting the affected interval to an older version. Fix that.
This commit is contained in:
@@ -637,11 +637,14 @@ public:
|
||||
}();
|
||||
rows_entry& re = *e;
|
||||
if (_reversed) { // latest_i is not reliably a successor
|
||||
// FIXME: set continuity when possible. Not that important since cache sets it anyway when populating.
|
||||
re.set_continuous(false);
|
||||
e->set_range_tombstone(range_tombstone_for_row());
|
||||
rows_entry::tri_compare cmp(*_snp.schema());
|
||||
auto res = rows.insert(std::move(e), cmp);
|
||||
if (auto l = std::next(res.first); l != rows.end() && l->continuous()) {
|
||||
re.set_continuous(true);
|
||||
re.set_range_tombstone(l->range_tombstone());
|
||||
}
|
||||
if (res.second) {
|
||||
_snp.tracker()->insert(re);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user