Skip to content

Commit b0158ef

Browse files
goffrieConvex, Inc.
authored and
Convex, Inc.
committed
Add an assertion to TransactionReadSet::_record_indexed that all index reads use the same fields (#37278)
GitOrigin-RevId: d3954684eaef86739da6b63afe95e039f005ca4a
1 parent 91fe8d8 commit b0158ef

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

crates/database/src/reads.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,25 @@ impl TransactionReadSet {
305305
intervals: impl IntoIterator<Item = Interval>,
306306
) -> (usize, usize) {
307307
self.read_set.indexed.mutate_entry_or_insert_with(
308-
index_name,
308+
index_name.clone(),
309309
|| IndexReads {
310-
fields,
310+
fields: fields.clone(),
311311
intervals: IntervalSet::new(),
312312
stack_traces: (*READ_SET_CAPTURE_BACKTRACES).then_some(vec![]),
313313
},
314314
|reads| {
315315
let IndexReads {
316316
intervals: range_set,
317317
stack_traces,
318-
..
318+
fields: existing_fields,
319319
} = reads;
320320

321+
assert_eq!(
322+
*existing_fields, fields,
323+
"trying to change index fields for index {:?}!",
324+
index_name
325+
);
326+
321327
let range_num_intervals_before = range_set.len();
322328
for interval in intervals {
323329
if let Some(stack_traces) = stack_traces.as_mut() {

0 commit comments

Comments
 (0)