Skip to content

Commit

Permalink
cache_flat_mutation_reader: use the correct schema in prepare_hash
Browse files Browse the repository at this point in the history
Since `mvcc: make schema upgrades gentle` (51e3b93),
rows pointed to by the cursor can have different (older) schema
than the schema of the cursor's snapshot.

However, one place in the code wasn't updated accordingly,
causing a row to be processed with the wrong schema in the right
circumstances.

This passed through unit testing because it requires
a digest-computing cache read after a schema change,
and no test exercised this.

Fixes #14110
  • Loading branch information
michoecho committed Jun 19, 2023
1 parent 4f73a28 commit d56b0c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cache_flat_mutation_reader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ void cache_flat_mutation_reader::add_to_buffer(const partition_snapshot_row_curs
if (!row.dummy()) {
_read_context.cache().on_row_hit();
if (_read_context.digest_requested()) {
row.latest_row().cells().prepare_hash(table_schema(), column_kind::regular_column);
row.latest_row_prepare_hash();
}
add_clustering_row_to_buffer(mutation_fragment_v2(*_schema, _permit, row.row()));
} else {
Expand Down
4 changes: 2 additions & 2 deletions partition_snapshot_row_cursor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ public:
}

// Can be called only when cursor is valid and pointing at a row.
deletable_row& latest_row() const noexcept {
return _current_row[0].it->row();
void latest_row_prepare_hash() const {
_current_row[0].it->row().cells().prepare_hash(*_current_row[0].schema, column_kind::regular_column);
}

// Can be called only when cursor is valid and pointing at a row.
Expand Down

0 comments on commit d56b0c2

Please sign in to comment.