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.
pull/24376/head
Dom Dwyer 2022-09-16 17:08:08 +02:00
parent 099dda430e
commit 85d6efafe1
3 changed files with 3 additions and 10 deletions

View File

@ -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,
)
});

View File

@ -134,11 +134,10 @@ impl PartitionData {
&mut self,
shard_id: ShardId,
table_id: TableId,
partition_id: PartitionId,
table_name: &str,
) -> Option<Arc<PersistingBatch>> {
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

View File

@ -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();