()
| 116 | |
| 117 | #[test] |
| 118 | fn memtable_flush_remaps_pk() { |
| 119 | let mut engine = MutationEngine::new("test".into(), test_schema()); |
| 120 | |
| 121 | for i in 0..5 { |
| 122 | engine |
| 123 | .insert(&[ |
| 124 | Value::Integer(i), |
| 125 | Value::String(format!("u{i}")), |
| 126 | Value::Null, |
| 127 | ]) |
| 128 | .expect("insert"); |
| 129 | } |
| 130 | |
| 131 | // Simulate flush: memtable becomes segment 1. |
| 132 | let result = engine.on_memtable_flushed(1).expect("flush"); |
| 133 | assert_eq!(result.wal_records.len(), 1); |
| 134 | assert!(matches!( |
| 135 | &result.wal_records[0], |
| 136 | ColumnarWalRecord::MemtableFlushed { |
| 137 | segment_id: 1, |
| 138 | row_count: 5, |
| 139 | .. |
| 140 | } |
| 141 | )); |
| 142 | |
| 143 | // PK index entries should now point to segment 1. |
| 144 | let pk = encode_pk(&Value::Integer(3)); |
| 145 | let loc = engine.pk_index().get(&pk).expect("pk exists"); |
| 146 | assert_eq!(loc.segment_id, 1); |
| 147 | assert_eq!(loc.row_index, 3); |
| 148 | } |
| 149 | |
| 150 | #[test] |
| 151 | fn multiple_inserts_and_deletes() { |
nothing calls this directly
no test coverage detected