From bc29d77ed3865fcadfc8d99d029851f6d0f2dee1 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 10 Jun 2022 11:20:59 +0200 Subject: Change object counter table to use full replication --- src/model/garage.rs | 10 +++++----- src/model/index_counter.rs | 8 ++++---- src/model/k2v/item_table.rs | 3 ++- src/model/s3/object_table.rs | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/model') diff --git a/src/model/garage.rs b/src/model/garage.rs index 15769a17..a776789b 100644 --- a/src/model/garage.rs +++ b/src/model/garage.rs @@ -52,8 +52,8 @@ pub struct Garage { /// Table containing S3 objects pub object_table: Arc>, - /// Counting table containing object counters - pub object_counter_table: Arc>, + /// Counting table containing object counters for each bucket + pub object_counter_table: Arc>, /// Table containing S3 object versions pub version_table: Arc>, /// Table containing S3 block references (not blocks themselves) @@ -68,7 +68,7 @@ pub struct GarageK2V { /// Table containing K2V items pub item_table: Arc>, /// Indexing table containing K2V item counters - pub counter_table: Arc>, + pub counter_table: Arc>, /// K2V RPC handler pub rpc: Arc, } @@ -176,7 +176,7 @@ impl Garage { &db, ); info!("Initialize key_table_table..."); - let key_table = Table::new(KeyTable, control_rep_param, system.clone(), &db); + let key_table = Table::new(KeyTable, control_rep_param.clone(), system.clone(), &db); // ---- S3 tables ---- info!("Initialize block_ref_table..."); @@ -201,7 +201,7 @@ impl Garage { ); info!("Initialize object counter table..."); - let object_counter_table = IndexCounter::new(system.clone(), meta_rep_param.clone(), &db); + let object_counter_table = IndexCounter::new(system.clone(), control_rep_param, &db); info!("Initialize object_table..."); #[allow(clippy::redundant_clone)] diff --git a/src/model/index_counter.rs b/src/model/index_counter.rs index 36e8172b..a8837e0f 100644 --- a/src/model/index_counter.rs +++ b/src/model/index_counter.rs @@ -138,17 +138,17 @@ impl TableSchema for CounterTable { // ---- -pub struct IndexCounter { +pub struct IndexCounter { this_node: Uuid, local_counter: db::Tree, propagate_tx: mpsc::UnboundedSender<(T::CP, T::CS, LocalCounterEntry)>, - pub table: Arc, TableShardedReplication>>, + pub table: Arc, R>>, } -impl IndexCounter { +impl IndexCounter { pub fn new( system: Arc, - replication: TableShardedReplication, + replication: R, db: &db::Db, ) -> Arc { let background = system.background.clone(); diff --git a/src/model/k2v/item_table.rs b/src/model/k2v/item_table.rs index baa1db4b..0d91f5e9 100644 --- a/src/model/k2v/item_table.rs +++ b/src/model/k2v/item_table.rs @@ -6,6 +6,7 @@ use garage_db as db; use garage_util::data::*; use garage_table::crdt::*; +use garage_table::replication::*; use garage_table::*; use crate::index_counter::*; @@ -187,7 +188,7 @@ impl Entry for K2VItem { } pub struct K2VItemTable { - pub(crate) counter_table: Arc>, + pub(crate) counter_table: Arc>, pub(crate) subscriptions: Arc, } diff --git a/src/model/s3/object_table.rs b/src/model/s3/object_table.rs index 23cce1d3..b9995d79 100644 --- a/src/model/s3/object_table.rs +++ b/src/model/s3/object_table.rs @@ -8,7 +8,7 @@ use garage_util::background::BackgroundRunner; use garage_util::data::*; use garage_table::crdt::*; -use garage_table::replication::TableShardedReplication; +use garage_table::replication::*; use garage_table::*; use crate::index_counter::*; @@ -223,7 +223,7 @@ impl Crdt for Object { pub struct ObjectTable { pub background: Arc, pub version_table: Arc>, - pub object_counter_table: Arc>, + pub object_counter_table: Arc>, } #[derive(Clone, Copy, Debug, Serialize, Deserialize)] -- cgit v1.2.3