Merge branch 'main' into ntran/more_delete_tests

pull/24376/head
kodiakhq[bot] 2021-09-23 17:46:06 +00:00 committed by GitHub
commit 3066b34158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 16 deletions

View File

@ -49,7 +49,6 @@ use write_buffer::core::{WriteBufferReading, WriteBufferWriting};
pub(crate) use crate::db::chunk::DbChunk;
use crate::{
db::{
self,
access::QueryCatalogAccess,
catalog::{
chunk::{CatalogChunk, ChunkStage},
@ -121,9 +120,6 @@ pub enum Error {
source: CatalogError,
},
#[snafu(display("Internal error while adding predicate predicate to chunk: {}", source))]
AddDeletePredicateError { source: db::catalog::chunk::Error },
#[snafu(display(
"Storing sequenced entry failed with the following error(s), and possibly more: {}",
errors.iter().map(ToString::to_string).collect::<Vec<_>>().join(", ")
@ -546,9 +542,7 @@ impl Db {
for chunk in chunks {
// save the delete predicate in the chunk
let mut chunk = chunk.write();
chunk
.add_delete_predicate(Arc::clone(&delete_predicate))
.context(AddDeletePredicateError)?;
chunk.add_delete_predicate(Arc::clone(&delete_predicate));
// We should only report persisted chunks or chunks that are currently being persisted, because the
// preserved catalog does not care about purely in-mem chunks.

View File

@ -469,7 +469,7 @@ impl CatalogChunk {
}
}
pub fn add_delete_predicate(&mut self, delete_predicate: Arc<Predicate>) -> Result<()> {
pub fn add_delete_predicate(&mut self, delete_predicate: Arc<Predicate>) {
debug!(
?delete_predicate,
"Input delete predicate to CatalogChunk add_delete_predicate"
@ -477,7 +477,9 @@ impl CatalogChunk {
match &mut self.stage {
ChunkStage::Open { mb_chunk: _ } => {
// Freeze/close this chunk and add delete_predicate to its frozen one
self.freeze_with_predicate(delete_predicate)?;
self.freeze_with_predicate(delete_predicate).expect(
"chunk stage was just checked to be 'Open', why can the chunk not be frozen?!",
);
}
ChunkStage::Frozen { meta, .. } | ChunkStage::Persisted { meta, .. } => {
// Add the delete_predicate into the chunk's metadata
@ -490,8 +492,6 @@ impl CatalogChunk {
});
}
}
Ok(())
}
pub fn delete_predicates(&self) -> &[Arc<Predicate>] {
@ -1161,7 +1161,7 @@ mod tests {
expected_exprs1.push(e);
// Add a delete predicate into a chunk the open chunk = delete simulation for open chunk
chunk.add_delete_predicate(Arc::new(del_pred1)).unwrap();
chunk.add_delete_predicate(Arc::new(del_pred1));
// chunk must be in frozen stage now
assert_eq!(chunk.stage().name(), "Frozen");
// chunk must have a delete predicate
@ -1192,7 +1192,7 @@ mod tests {
let mut expected_exprs2 = vec![];
let e = col("cost").not_eq(lit(15));
expected_exprs2.push(e);
chunk.add_delete_predicate(Arc::new(del_pred2)).unwrap();
chunk.add_delete_predicate(Arc::new(del_pred2));
// chunk still must be in frozen stage now
assert_eq!(chunk.stage().name(), "Frozen");
// chunk must have 2 delete predicates

View File

@ -287,9 +287,7 @@ impl CatalogState for Loader {
.chunk(&addr.table_name, &addr.partition_key, addr.chunk_id)
{
let mut chunk = chunk.write();
chunk
.add_delete_predicate(Arc::clone(&predicate))
.expect("this should not fail for persisted chunks");
chunk.add_delete_predicate(Arc::clone(&predicate));
}
}
}