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

Method lookup_memtable_row_by_pk

nodedb-columnar/src/mutation/write.rs:157–163  ·  view source on GitHub ↗

Look up the current row for a PK in the memtable, if present. Returns `None` if the PK is not in the index, or if the PK points to a flushed segment (callers needing cross-segment lookup must go through a segment reader separately). This is the fast path used by `ON CONFLICT DO UPDATE` to read the would-be-merged row when the duplicate hits the memtable — the common case under back-to-back insert

(&self, pk_bytes: &[u8])

Source from the content-addressed store, hash-verified

155 /// when the duplicate hits the memtable — the common case under
156 /// back-to-back inserts.
157 pub fn lookup_memtable_row_by_pk(&self, pk_bytes: &[u8]) -> Option<Vec<Value>> {
158 let loc = self.pk_index.get(pk_bytes).copied()?;
159 if loc.segment_id != self.memtable_segment_id {
160 return None;
161 }
162 self.memtable.get_row(loc.row_index as usize)
163 }
164
165 /// Delete a row by PK value. Returns WAL record to persist.
166 ///

Callers 1

Calls 2

get_rowMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected