From 85d6efafe19627a0107a0d044490e9fcaaa4dbd6 Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Fri, 16 Sep 2022 17:08:08 +0200 Subject: [PATCH] refactor: snapshot_to_persisting redundant ID Partition::snapshot_to_persisting() passes the ID of the partition it is calling `snapshot_to_persisting()` on. The partition already knows what its ID is, so at best it's redundant, and at worst, inconsistent with the actual ID. --- ingester/src/data/namespace.rs | 1 - ingester/src/data/partition.rs | 10 ++-------- ingester/src/test_util.rs | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ingester/src/data/namespace.rs b/ingester/src/data/namespace.rs index e65e80dd01..9728fd6285 100644 --- a/ingester/src/data/namespace.rs +++ b/ingester/src/data/namespace.rs @@ -236,7 +236,6 @@ impl NamespaceData { partition_data.snapshot_to_persisting_batch( partition_info.partition.shard_id, partition_info.partition.table_id, - partition_info.partition.id, &partition_info.table_name, ) }); diff --git a/ingester/src/data/partition.rs b/ingester/src/data/partition.rs index f2059dd1cc..bd0e0fa496 100644 --- a/ingester/src/data/partition.rs +++ b/ingester/src/data/partition.rs @@ -134,11 +134,10 @@ impl PartitionData { &mut self, shard_id: ShardId, table_id: TableId, - partition_id: PartitionId, table_name: &str, ) -> Option> { self.data - .snapshot_to_persisting(shard_id, table_id, partition_id, table_name) + .snapshot_to_persisting(shard_id, table_id, self.id, table_name) } /// Snapshot whatever is in the buffer and return a new vec of the @@ -463,12 +462,7 @@ mod tests { // ------------------------------------------ // Persisting let p_batch = p - .snapshot_to_persisting_batch( - ShardId::new(s_id), - TableId::new(t_id), - PartitionId::new(p_id), - table_name, - ) + .snapshot_to_persisting_batch(ShardId::new(s_id), TableId::new(t_id), table_name) .unwrap(); // verify data diff --git a/ingester/src/test_util.rs b/ingester/src/test_util.rs index cb554708b3..0d3b031f5d 100644 --- a/ingester/src/test_util.rs +++ b/ingester/src/test_util.rs @@ -952,7 +952,7 @@ fn make_first_partition_data( if loc.contains(DataLocation::PERSISTING) { // Move group 1 data to persisting - p1.snapshot_to_persisting_batch(shard_id, table_id, partition_id, table_name); + p1.snapshot_to_persisting_batch(shard_id, table_id, table_name); } else if loc.contains(DataLocation::SNAPSHOT) { // move group 1 data to snapshot p1.snapshot().unwrap();