From 8dce4fbbaaf373a5a6c6b02e311a7d8f25cf66c3 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 2 Oct 2024 12:43:30 +0300 Subject: Add test, small improvements --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 4afeb4c..3b249d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -224,6 +224,8 @@ impl DB { Ok(db) } + /// Insert a record into the database. If the primary key value already exists, + /// the existing record will be replaced by the supplied one. pub fn upsert(&mut self, record: &Record) -> Result<(), io::Error> { debug!("Upserting record: {:?}", record); // Validate the record length @@ -293,7 +295,7 @@ impl DB { file.unlock()?; debug!("Record appended to log file, lock released"); - debug!("Updating memtables"); + debug!("Updating primary memtable"); let primary_value = &record.values[self.primary_key_index] @@ -308,6 +310,10 @@ impl DB { self.secondary_memtables .iter_mut() .for_each(|secondary_memtable| { + debug!( + "Updating memtable for index on {:?}", + &secondary_memtable.field + ); for (index, (schema_field, _)) in self.config.fields.iter().enumerate() { if schema_field == &secondary_memtable.field { let key = record.values[index] -- cgit v1.3