fix: Remove unused most_recent_n_in_shards function

pull/24376/head
Carol (Nichols || Goulding) 2023-04-17 18:40:40 -04:00
parent 2d1564d568
commit afaa954270
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
5 changed files with 0 additions and 78 deletions

View File

@ -536,13 +536,6 @@ pub trait PartitionRepo: Send + Sync {
/// Return the N most recently created partitions.
async fn most_recent_n(&mut self, n: usize) -> Result<Vec<Partition>>;
/// Return the N most recently created partitions for the specified shards.
async fn most_recent_n_in_shards(
&mut self,
n: usize,
shards: &[ShardId],
) -> Result<Vec<Partition>>;
/// Select partition for cold/warm/hot compaction
/// These are partitions with files created recently (aka created after the specified time_in_the_past)
/// These files include all levels of compaction files
@ -2002,27 +1995,6 @@ pub(crate) mod test_helpers {
.expect("should list most recent");
assert_eq!(recent.len(), 2);
let recent = repos
.partitions()
.most_recent_n_in_shards(10, &[shard.id, other_shard.id])
.await
.expect("should list most recent");
assert_eq!(recent.len(), 3);
let recent = repos
.partitions()
.most_recent_n_in_shards(10, &[shard.id])
.await
.expect("should list most recent");
assert_eq!(recent.len(), 2);
let recent2 = repos
.partitions()
.most_recent_n_in_shards(10, &[shard.id, ShardId::new(42)])
.await
.expect("should list most recent");
assert_eq!(recent, recent2);
repos
.namespaces()
.soft_delete("namespace_partition_test")

View File

@ -904,22 +904,6 @@ impl PartitionRepo for MemTxn {
Ok(stage.partitions.iter().rev().take(n).cloned().collect())
}
async fn most_recent_n_in_shards(
&mut self,
n: usize,
shards: &[ShardId],
) -> Result<Vec<Partition>> {
let stage = self.stage();
Ok(stage
.partitions
.iter()
.rev()
.filter(|p| shards.contains(&p.shard_id))
.take(n)
.cloned()
.collect())
}
async fn partitions_with_recent_created_files(
&mut self,
time_in_the_past: Timestamp,

View File

@ -238,7 +238,6 @@ decorate!(
"partition_list_skipped_compactions" = list_skipped_compactions(&mut self) -> Result<Vec<SkippedCompaction>>;
"partition_delete_skipped_compactions" = delete_skipped_compactions(&mut self, partition_id: PartitionId) -> Result<Option<SkippedCompaction>>;
"partition_most_recent_n" = most_recent_n(&mut self, n: usize) -> Result<Vec<Partition>>;
"partition_most_recent_n_in_shards" = most_recent_n_in_shards(&mut self, n: usize, shards: &[ShardId]) -> Result<Vec<Partition>>;
"partitions_with_recent_created_files" = partitions_with_recent_created_files(&mut self, time_in_the_past: Timestamp, max_num_partitions: usize) -> Result<Vec<PartitionParam>>;
"partitions_new_file_between" = partitions_new_file_between(&mut self, minimum_time: Timestamp, maximum_time: Option<Timestamp>) -> Result<Vec<PartitionId>>;
"get_in_skipped_compaction" = get_in_skipped_compaction(&mut self, partition_id: PartitionId) -> Result<Option<SkippedCompaction>>;

View File

@ -1436,21 +1436,6 @@ RETURNING *
.map_err(|e| Error::SqlxError { source: e })
}
async fn most_recent_n_in_shards(
&mut self,
n: usize,
shards: &[ShardId],
) -> Result<Vec<Partition>> {
sqlx::query_as(
r#"SELECT * FROM partition WHERE shard_id IN (SELECT UNNEST($1)) ORDER BY id DESC LIMIT $2;"#,
)
.bind(shards.iter().map(|v| v.get()).collect::<Vec<_>>())
.bind(n as i64)
.fetch_all(&mut self.inner)
.await
.map_err(|e| Error::SqlxError { source: e })
}
async fn partitions_with_recent_created_files(
&mut self,
time_in_the_past: Timestamp,

View File

@ -1254,24 +1254,6 @@ RETURNING *
.collect())
}
async fn most_recent_n_in_shards(
&mut self,
n: usize,
shards: &[ShardId],
) -> Result<Vec<Partition>> {
Ok(sqlx::query_as::<_, PartitionPod>(
r#"SELECT * FROM partition WHERE shard_id IN (SELECT value FROM json_each($1)) ORDER BY id DESC LIMIT $2;"#,
)
.bind(&Json(shards.iter().map(|v| v.get()).collect::<Vec<_>>()))
.bind(n as i64)
.fetch_all(self.inner.get_mut())
.await
.map_err(|e| Error::SqlxError { source: e })?
.into_iter()
.map(Into::into)
.collect())
}
async fn partitions_with_recent_created_files(
&mut self,
time_in_the_past: Timestamp,