MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / memtable_flush_remaps_pk

Function memtable_flush_remaps_pk

nodedb-columnar/src/mutation/tests.rs:118–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117#[test]
118fn 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]
151fn multiple_inserts_and_deletes() {

Callers

nothing calls this directly

Calls 7

encode_pkFunction · 0.85
on_memtable_flushedMethod · 0.80
pk_indexMethod · 0.80
test_schemaFunction · 0.70
expectMethod · 0.45
insertMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected