pub fn create_open_chunk(
        &mut self,
        chunk: mutable_buffer::chunk::Chunk,
    ) -> Result<Arc<RwLock<Chunk>>> {
        let table_name: String = chunk.table_name().to_string();

        let table = self
            .tables
            .entry(table_name)
            .or_insert_with(PartitionTable::new);

        let chunk_id = table.next_chunk_id;

        // Technically this only causes an issue on the next upsert but
        // the MUB treats u32::MAX as a sentinel value
        assert_ne!(table.next_chunk_id, u32::MAX, "Chunk ID Overflow");

        table.next_chunk_id += 1;

        let chunk = Arc::new(self.metrics.new_lock(Chunk::new_open(
            chunk_id,
            &self.key,
            chunk,
            self.metrics.new_chunk_metrics(),
        )?));

        if table.chunks.insert(chunk_id, Arc::clone(&chunk)).is_some() {
            // A fundamental invariant has been violated - abort
            panic!("chunk already existed with id {}", chunk_id)
        }

        Ok(chunk)
    }
/// Create a new Chunk in the open state.
///
/// This will add a new chunk to the catalog and increases the chunk ID counter for that table-partition
/// combination.
///
/// Returns an error if the chunk is empty.
Create a new Chunk in the open state.
This will add a new chunk to the catalog and increases the chunk ID counter for that table-partition
combination.

Returns an error if the chunk is empty.
Create a new Chunk in the open state . This will add a new chunk to the catalog and increases the chunk ID counter for that table - partition combination . Returns an error if the chunk is empty .
pub fn create_open_chunk(
        &mut self,
        chunk: mutable_buffer::chunk::Chunk,
    ) -> Result<Arc<RwLock<Chunk>>> {
        let table_name: String = chunk.table_name().to_string();
        let table = self
            .tables
            .entry(table_name)
            .or_insert_with(PartitionTable::new);
        let chunk_id = table.next_chunk_id;
        // Technically this only causes an issue on the next upsert but
        // the MUB treats u32::MAX as a sentinel value
        assert_ne!(table.next_chunk_id, u32::MAX, "Chunk ID Overflow");
        table.next_chunk_id += 1;
        let chunk = Arc::new(self.metrics.new_lock(Chunk::new_open(
            chunk_id,
            &self.key,
            chunk,
            self.metrics.new_chunk_metrics(),
        )?));
        if table.chunks.insert(chunk_id, Arc::clone(&chunk)).is_some() {
            // A fundamental invariant has been violated - abort
            panic!("chunk already existed with id {}", chunk_id)
        }
        Ok(chunk)
    }
pub fn create_open_chunk ( & mut self , chunk : mutable_buffer :: chunk :: Chunk , ) -> Result < Arc < RwLock < Chunk > > > { let table_name : String = chunk . table_name ( ) . to_string ( ) ; let table = self . tables . entry ( table_name ) . or_insert_with ( PartitionTable :: new ) ; let chunk_id = table . next_chunk_id ; // Technically this only causes an issue on the next upsert but // the MUB treats u32::MAX as a sentinel value assert_ne ! ( table next_chunk_id u32 MAX " " ) ; table . next_chunk_id += 1 ; let chunk = Arc :: new ( self . metrics . new_lock ( Chunk :: new_open ( chunk_id , & self . key , chunk , self . metrics . new_chunk_metrics ( ) , ) ? ) ) ; if table . chunks . insert ( chunk_id , Arc :: clone ( & chunk ) ) . is_some ( ) { // A fundamental invariant has been violated - abort panic ! ( " " chunk_id ) } Ok ( chunk ) }
Create a new Chunk in the open state.
Create a new Chunk in the open state .
&mut self
chunk
mutable_buffer::chunk::Chunk
&mut self
chunk
mutable_buffer::chunk::Chunk