adjust remaining calculation to use the profile

This commit is contained in:
pedrocarlo
2025-08-28 17:26:36 -03:00
parent 962666831b
commit 2f237fdcfd
6 changed files with 159 additions and 122 deletions

View File

@@ -14,8 +14,8 @@ use strum::EnumString;
use crate::profiles::{io::IOProfile, query::QueryProfile};
mod io;
mod query;
pub mod io;
pub mod query;
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Validate)]
#[serde(deny_unknown_fields, default)]
@@ -45,11 +45,13 @@ impl Profile {
query: QueryProfile {
gen_opts: Opts {
// TODO: in the future tweak blob size for bigger inserts
// TODO: increase number of rows increased as well
// TODO: increase number of rows as well
..Default::default()
},
delete: false,
update: false,
read_weight: 30,
write_weight: 70,
delete_weight: 0,
update_weight: 0,
..Default::default()
},
..Default::default()

View File

@@ -9,29 +9,48 @@ pub struct QueryProfile {
#[garde(dive)]
pub gen_opts: Opts,
#[garde(skip)]
pub create_table: bool,
/// Effectively the weight of how many select operations we want
pub read_weight: u32,
#[garde(skip)]
pub create_index: bool,
pub write_weight: u32,
// All weights below are only going to be sampled when we determine we are doing a write operation,
// meaning we first sample between `read_weight` and `write_weight`, and if we a write_weight we will then sample the weights below
#[garde(skip)]
pub insert: bool,
pub create_table_weight: u32,
#[garde(skip)]
pub update: bool,
pub create_index_weight: u32,
#[garde(skip)]
pub delete: bool,
pub insert_weight: u32,
#[garde(skip)]
pub drop_table: bool,
pub update_weight: u32,
#[garde(skip)]
pub delete_weight: u32,
#[garde(skip)]
pub drop_table_weight: u32,
}
impl Default for QueryProfile {
fn default() -> Self {
Self {
gen_opts: Opts::default(),
create_table: true,
create_index: true,
insert: true,
update: true,
delete: true,
drop_table: true,
read_weight: 60,
write_weight: 50,
create_table_weight: 15,
create_index_weight: 5,
insert_weight: 30,
update_weight: 20,
delete_weight: 20,
drop_table_weight: 2,
}
}
}
#[derive(Debug, Clone, strum::VariantArray)]
pub enum QueryTypes {
CreateTable,
CreateIndex,
Insert,
Update,
Delete,
DropTable,
}