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

Function update_row

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

Source from the content-addressed store, hash-verified

75
76#[test]
77fn update_row() {
78 let mut engine = MutationEngine::new("test".into(), test_schema());
79
80 engine
81 .insert(&[
82 Value::Integer(1),
83 Value::String("Alice".into()),
84 Value::Float(0.5),
85 ])
86 .expect("insert");
87
88 // Update: change name and score, keep same PK.
89 let result = engine
90 .update(
91 &Value::Integer(1),
92 &[
93 Value::Integer(1),
94 Value::String("Alice Updated".into()),
95 Value::Float(0.75),
96 ],
97 )
98 .expect("update");
99
100 // Should produce 2 WAL records: delete + insert.
101 assert_eq!(result.wal_records.len(), 2);
102 assert!(matches!(
103 &result.wal_records[0],
104 ColumnarWalRecord::DeleteRows { .. }
105 ));
106 assert!(matches!(
107 &result.wal_records[1],
108 ColumnarWalRecord::InsertRow { .. }
109 ));
110
111 // PK index should still have 1 entry.
112 assert_eq!(engine.pk_index().len(), 1);
113 // Memtable should have 2 rows (original + updated).
114 assert_eq!(engine.memtable().row_count(), 2);
115}
116
117#[test]
118fn memtable_flush_remaps_pk() {

Callers

nothing calls this directly

Calls 4

test_schemaFunction · 0.70
expectMethod · 0.45
insertMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected