feat: add "drop chunk" job type

pull/24376/head
Marco Neumann 2021-07-13 12:37:15 +02:00
parent e570c66697
commit 956086fa6d
3 changed files with 51 additions and 1 deletions

View File

@ -42,6 +42,14 @@ pub enum Job {
chunks: Vec<u32>,
},
/// Drop chunk from memory and (if persisted) from object store.
DropChunk {
db_name: String,
partition_key: String,
table_name: String,
chunk_id: u32,
},
/// Wipe preserved catalog
WipePreservedCatalog {
db_name: String,
@ -57,6 +65,7 @@ impl Job {
Self::WriteChunk { db_name, .. } => Some(db_name),
Self::CompactChunks { db_name, .. } => Some(db_name),
Self::PersistChunks { db_name, .. } => Some(db_name),
Self::DropChunk { db_name, .. } => Some(db_name),
Self::WipePreservedCatalog { db_name, .. } => Some(db_name),
}
}
@ -69,6 +78,7 @@ impl Job {
Self::WriteChunk { partition_key, .. } => Some(partition_key),
Self::CompactChunks { partition_key, .. } => Some(partition_key),
Self::PersistChunks { partition_key, .. } => Some(partition_key),
Self::DropChunk { partition_key, .. } => Some(partition_key),
Self::WipePreservedCatalog { .. } => None,
}
}
@ -81,6 +91,7 @@ impl Job {
Self::WriteChunk { chunk_id, .. } => Some(*chunk_id),
Self::CompactChunks { .. } => None,
Self::PersistChunks { .. } => None,
Self::DropChunk { chunk_id, .. } => Some(*chunk_id),
Self::WipePreservedCatalog { .. } => None,
}
}
@ -93,6 +104,7 @@ impl Job {
Self::WriteChunk { .. } => "Writing chunk to Object Storage",
Self::CompactChunks { .. } => "Compacting chunks to ReadBuffer",
Self::PersistChunks { .. } => "Persisting chunks to object storage",
Self::DropChunk { .. } => "Drop chunk from memory and (if persisted) from object store",
Self::WipePreservedCatalog { .. } => "Wipe preserved catalog",
}
}

View File

@ -25,6 +25,7 @@ message OperationMetadata {
WipePreservedCatalog wipe_preserved_catalog = 9;
CompactChunks compact_chunks = 10;
PersistChunks persist_chunks = 11;
DropChunk drop_chunk = 12;
}
}
@ -94,8 +95,23 @@ message PersistChunks {
repeated uint32 chunks = 3;
}
// Drop chunk from memory and (if persisted) from object store.
message DropChunk {
// name of the database
string db_name = 1;
// partition key
string partition_key = 2;
// table name
string table_name = 4;
// chunk_id
uint32 chunk_id = 3;
}
// Wipe preserved catalog
message WipePreservedCatalog {
// name of the database
string db_name = 1;
}
}

View File

@ -55,6 +55,17 @@ impl From<Job> for management::operation_metadata::Job {
table_name,
chunks,
}),
Job::DropChunk {
db_name,
partition_key,
table_name,
chunk_id,
} => Self::DropChunk(management::DropChunk {
db_name,
partition_key,
table_name,
chunk_id,
}),
}
}
}
@ -111,6 +122,17 @@ impl From<management::operation_metadata::Job> for Job {
table_name,
chunks,
},
Job::DropChunk(management::DropChunk {
db_name,
partition_key,
table_name,
chunk_id,
}) => Self::DropChunk {
db_name,
partition_key,
table_name,
chunk_id,
},
}
}
}