aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-12-11 16:09:22 +0100
committerAlex Auvolat <alex@adnab.me>2023-12-11 16:09:22 +0100
commit0041b013a473e3ae72f50209d8f79db75a72848b (patch)
tree7b44d731b86d14369bcef1a65cdc87a8538c484b /src/table
parentadccce1145d5d82581e4a5da707be35badb2d5a6 (diff)
downloadgarage-0041b013a473e3ae72f50209d8f79db75a72848b.tar.gz
garage-0041b013a473e3ae72f50209d8f79db75a72848b.zip
layout: refactoring and fix in layout helpernlnet-task3
Diffstat (limited to 'src/table')
-rw-r--r--src/table/replication/sharded.rs2
-rw-r--r--src/table/sync.rs16
2 files changed, 8 insertions, 10 deletions
diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs
index 55d0029d..8ba3700f 100644
--- a/src/table/replication/sharded.rs
+++ b/src/table/replication/sharded.rs
@@ -54,7 +54,7 @@ impl TableReplication for TableShardedReplication {
fn sync_partitions(&self) -> SyncPartitions {
let layout = self.system.cluster_layout();
- let layout_version = layout.all_ack();
+ let layout_version = layout.ack_map_min();
let mut partitions = layout
.current()
diff --git a/src/table/sync.rs b/src/table/sync.rs
index 1561a2e5..cd080df0 100644
--- a/src/table/sync.rs
+++ b/src/table/sync.rs
@@ -83,7 +83,7 @@ impl<F: TableSchema, R: TableReplication> TableSyncer<F, R> {
bg.spawn_worker(SyncWorker {
syncer: self.clone(),
layout_notify: self.system.layout_notify(),
- layout_versions: self.system.cluster_layout().sync_versions(),
+ layout_digest: self.system.cluster_layout().sync_digest(),
add_full_sync_rx,
todo: None,
next_full_sync: Instant::now() + Duration::from_secs(20),
@@ -483,7 +483,7 @@ struct SyncWorker<F: TableSchema, R: TableReplication> {
syncer: Arc<TableSyncer<F, R>>,
layout_notify: Arc<Notify>,
- layout_versions: (u64, u64, u64),
+ layout_digest: SyncLayoutDigest,
add_full_sync_rx: mpsc::UnboundedReceiver<()>,
next_full_sync: Instant,
@@ -493,15 +493,13 @@ struct SyncWorker<F: TableSchema, R: TableReplication> {
impl<F: TableSchema, R: TableReplication> SyncWorker<F, R> {
fn check_add_full_sync(&mut self) {
- let layout_versions = self.syncer.system.cluster_layout().sync_versions();
- if layout_versions != self.layout_versions {
- self.layout_versions = layout_versions;
+ let layout_digest = self.syncer.system.cluster_layout().sync_digest();
+ if layout_digest != self.layout_digest {
+ self.layout_digest = layout_digest;
info!(
- "({}) Layout versions changed (max={}, ack={}, min stored={}), adding full sync to syncer todo list",
+ "({}) Layout versions changed ({:?}), adding full sync to syncer todo list",
F::TABLE_NAME,
- layout_versions.0,
- layout_versions.1,
- layout_versions.2
+ layout_digest,
);
self.add_full_sync();
}