From de4044267766ca8d4126ab0743deb1fc5dbe160d Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 20 Nov 2024 09:02:24 +0200 Subject: [PATCH 1/4] core: Remove unused import from btree.rs --- core/storage/btree.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/storage/btree.rs b/core/storage/btree.rs index 8cc392f60..0c9f7c806 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -2,8 +2,8 @@ use log::debug; use crate::storage::pager::{Page, Pager}; use crate::storage::sqlite3_ondisk::{ - read_btree_cell, read_record, read_varint, write_varint, BTreeCell, DatabaseHeader, - PageContent, PageType, TableInteriorCell, TableLeafCell, + read_btree_cell, read_varint, write_varint, BTreeCell, DatabaseHeader, PageContent, PageType, + TableInteriorCell, TableLeafCell, }; use crate::types::{Cursor, CursorResult, OwnedRecord, OwnedValue, SeekKey, SeekOp}; use crate::Result; From a3078079b4a80ccbd9ba9719b7cb0a9381d8319c Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 20 Nov 2024 09:04:56 +0200 Subject: [PATCH 2/4] simulator: Fix clone() on double reference Switch to to_string() and to_vec() instead of clone() + to_owned() to fix the following warnings: warning: using `.clone()` on a double reference, which returns `&String` instead of cloning the inner type --> simulator/main.rs:348:68 | 348 | limbo_core::Value::Text(t) => Value::Text(t.clone().to_owned()), | ^^^^^^^^ | = note: `#[warn(suspicious_double_ref_op)]` on by default warning: using `.clone()` on a double reference, which returns `&Vec` instead of cloning the inner type --> simulator/main.rs:349:68 | 349 | limbo_core::Value::Blob(b) => Value::Blob(b.clone().to_owned()), --- simulator/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simulator/main.rs b/simulator/main.rs index bbb9b8bc1..3b7492cb1 100644 --- a/simulator/main.rs +++ b/simulator/main.rs @@ -345,8 +345,8 @@ fn get_all_rows( limbo_core::Value::Null => Value::Null, limbo_core::Value::Integer(i) => Value::Integer(*i), limbo_core::Value::Float(f) => Value::Float(*f), - limbo_core::Value::Text(t) => Value::Text(t.clone().to_owned()), - limbo_core::Value::Blob(b) => Value::Blob(b.clone().to_owned()), + limbo_core::Value::Text(t) => Value::Text(t.to_string()), + limbo_core::Value::Blob(b) => Value::Blob(b.to_vec()), }; r.push(v); } From 39ca03a7cece0ba896ad82115feb7d6c62806873 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 20 Nov 2024 09:07:55 +0200 Subject: [PATCH 3/4] simulator: Remove unused imports from main.rs --- simulator/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/simulator/main.rs b/simulator/main.rs index 3b7492cb1..e326be166 100644 --- a/simulator/main.rs +++ b/simulator/main.rs @@ -1,6 +1,4 @@ -use limbo_core::{ - Connection, Database, File, LimboError, OpenFlags, PlatformIO, Result, Row, RowResult, IO, -}; +use limbo_core::{Connection, Database, File, OpenFlags, PlatformIO, Result, RowResult, IO}; use log; use rand::prelude::*; use rand_chacha::ChaCha8Rng; @@ -9,7 +7,7 @@ use std::rc::Rc; use std::sync::Arc; use tempfile::TempDir; -use anarchist_readable_name_generator_lib::{readable_name, readable_name_custom}; +use anarchist_readable_name_generator_lib::readable_name_custom; struct SimulatorEnv { opts: SimulatorOpts, From f8667bb1605be2e130d2723c90a0c5a834686b68 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 20 Nov 2024 09:09:03 +0200 Subject: [PATCH 4/4] simulator: Remove seed from SimulatorOpts It's not used anywhere and technically it's not even part of simulation options, but the seed that generates them. --- simulator/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/simulator/main.rs b/simulator/main.rs index e326be166..c09ea508e 100644 --- a/simulator/main.rs +++ b/simulator/main.rs @@ -29,7 +29,6 @@ struct SimulatorOpts { ticks: usize, max_connections: usize, max_tables: usize, - seed: u64, // this next options are the distribution of workload where read_percent + write_percent + // delete_percent == 100% read_percent: usize, @@ -94,7 +93,6 @@ fn main() { max_connections: 1, // TODO: for now let's use one connection as we didn't implement // correct transactions procesing max_tables: rng.gen_range(0..128), - seed, read_percent, write_percent, delete_percent,