refactor: rename `Db::load_chunk_to_object_store` to `Db::write_chunk_to_object_store

For #1083.
pull/24376/head
Marco Neumann 2021-04-13 15:39:24 +02:00
parent 1c6690ae3b
commit f430013141
2 changed files with 9 additions and 9 deletions

View File

@ -447,7 +447,7 @@ impl Db {
Ok(DBChunk::snapshot(&chunk)) Ok(DBChunk::snapshot(&chunk))
} }
pub async fn load_chunk_to_object_store( pub async fn write_chunk_to_object_store(
&self, &self,
partition_key: &str, partition_key: &str,
chunk_id: u32, chunk_id: u32,
@ -601,8 +601,8 @@ impl Db {
} }
/// Spawns a task to perform /// Spawns a task to perform
/// [`load_chunk_to_object_store`](Self::load_chunk_to_object_store) /// [`write_chunk_to_object_store`](Self::write_chunk_to_object_store)
pub fn load_chunk_to_object_store_in_background( pub fn write_chunk_to_object_store_in_background(
self: &Arc<Self>, self: &Arc<Self>,
partition_key: String, partition_key: String,
chunk_id: u32, chunk_id: u32,
@ -618,7 +618,7 @@ impl Db {
let task = async move { let task = async move {
debug!(%name, %partition_key, %chunk_id, "background task loading chunk to object store"); debug!(%name, %partition_key, %chunk_id, "background task loading chunk to object store");
let result = captured let result = captured
.load_chunk_to_object_store(&partition_key, chunk_id) .write_chunk_to_object_store(&partition_key, chunk_id)
.await; .await;
if let Err(e) = result { if let Err(e) = result {
info!(?e, %name, %partition_key, %chunk_id, "background task error loading object store chunk"); info!(?e, %name, %partition_key, %chunk_id, "background task error loading object store chunk");
@ -1069,7 +1069,7 @@ mod tests {
.unwrap(); .unwrap();
// Write the RB chunk to Object Store but keep it in RB // Write the RB chunk to Object Store but keep it in RB
let pq_chunk = db let pq_chunk = db
.load_chunk_to_object_store(partition_key, mb_chunk.id()) .write_chunk_to_object_store(partition_key, mb_chunk.id())
.await .await
.unwrap(); .unwrap();
@ -1157,7 +1157,7 @@ mod tests {
.unwrap(); .unwrap();
// Write the RB chunk to Object Store but keep it in RB // Write the RB chunk to Object Store but keep it in RB
let pq_chunk = db let pq_chunk = db
.load_chunk_to_object_store(partition_key, mb_chunk.id()) .write_chunk_to_object_store(partition_key, mb_chunk.id())
.await .await
.unwrap(); .unwrap();
@ -1754,7 +1754,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
async fn load_chunk_to_object_store_in_background() { async fn write_chunk_to_object_store_in_background() {
// Test that data can be written to object store using a background task // Test that data can be written to object store using a background task
let db = Arc::new(make_db()); let db = Arc::new(make_db());
@ -1773,7 +1773,7 @@ mod tests {
// RB => OS // RB => OS
let task = let task =
db.load_chunk_to_object_store_in_background(partition_key.to_string(), rb_chunk.id()); db.write_chunk_to_object_store_in_background(partition_key.to_string(), rb_chunk.id());
let t_start = std::time::Instant::now(); let t_start = std::time::Instant::now();
while !task.is_complete() { while !task.is_complete() {
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await; tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;

View File

@ -209,7 +209,7 @@ impl ChunkMover for LifecycleManager {
info!(%partition_key, %chunk_id, "write chunk to object store"); info!(%partition_key, %chunk_id, "write chunk to object store");
self.write_task = Some( self.write_task = Some(
self.db self.db
.load_chunk_to_object_store_in_background(partition_key, chunk_id), .write_chunk_to_object_store_in_background(partition_key, chunk_id),
) )
} }