fix: correctly track chunk ID counter during catalog replay

pull/24376/head
Marco Neumann 2021-05-20 10:32:40 +02:00
parent 93251f22c7
commit 7e55544eef
2 changed files with 12 additions and 1 deletions

View File

@ -2917,5 +2917,8 @@ mod tests {
let chunk = chunk.read();
assert!(matches!(chunk.state(), ChunkState::ObjectStoreOnly(_)));
}
// ==================== check: DB still writable ====================
write_lp(db.as_ref(), "cpu bar=1 10");
}
}

View File

@ -124,6 +124,9 @@ impl Partition {
/// Create new chunk that is only in object store (= parquet file).
///
/// The table-specific chunk ID counter will be set to
/// `max(current, chunk_id + 1)`.
///
/// Fails if the chunk already exists.
pub fn create_object_store_only_chunk(
&mut self,
@ -153,7 +156,12 @@ impl Partition {
table_name,
chunk_id,
}),
None => Ok(chunk),
None => {
// bump chunk ID counter
table.next_chunk_id = table.next_chunk_id.max(chunk_id + 1);
Ok(chunk)
}
}
}