pub async fn unload_read_buffer(
        &self,
        partition_key: &str,
        table_name: &str,
        chunk_id: u32,
    ) -> Result<Arc<DbChunk>> {
        debug!(%partition_key, %table_name, %chunk_id, "unloading chunk from read buffer");

        // Get the chunk from the catalog
        let chunk = {
            let partition = self
                .preserved_catalog
                .state()
                .valid_partition(partition_key)
                .context(UnloadingChunkFromReadBuffer {
                    partition_key,
                    table_name,
                    chunk_id,
                })?;
            let partition = partition.read();

            partition
                .chunk(table_name, chunk_id)
                .context(UnloadingChunkFromReadBuffer {
                    partition_key,
                    table_name,
                    chunk_id,
                })?
        };

        // update the catalog to no longer use read buffer chunk if any
        let mut chunk = chunk.write();

        chunk
            .set_unload_from_read_buffer()
            .context(UnloadingChunkFromReadBuffer {
                partition_key,
                table_name,
                chunk_id,
            })?;

        debug!(%partition_key, %table_name, %chunk_id, "chunk marked UNLOADED from read buffer");

        Ok(DbChunk::snapshot(&chunk))
    }
/// Unload chunk from read buffer but keep it in object store
Unload chunk from read buffer but keep it in object store
Unload chunk from read buffer but keep it in object store
pub async fn unload_read_buffer(
        &self,
        partition_key: &str,
        table_name: &str,
        chunk_id: u32,
    ) -> Result<Arc<DbChunk>> {
        debug!(%partition_key, %table_name, %chunk_id, "unloading chunk from read buffer");
        // Get the chunk from the catalog
        let chunk = {
            let partition = self
                .preserved_catalog
                .state()
                .valid_partition(partition_key)
                .context(UnloadingChunkFromReadBuffer {
                    partition_key,
                    table_name,
                    chunk_id,
                })?;
            let partition = partition.read();
            partition
                .chunk(table_name, chunk_id)
                .context(UnloadingChunkFromReadBuffer {
                    partition_key,
                    table_name,
                    chunk_id,
                })?
        };
        // update the catalog to no longer use read buffer chunk if any
        let mut chunk = chunk.write();
        chunk
            .set_unload_from_read_buffer()
            .context(UnloadingChunkFromReadBuffer {
                partition_key,
                table_name,
                chunk_id,
            })?;
        debug!(%partition_key, %table_name, %chunk_id, "chunk marked UNLOADED from read buffer");
        Ok(DbChunk::snapshot(&chunk))
    }
pub async fn unload_read_buffer ( & self , partition_key : & str , table_name : & str , chunk_id : u32 , ) -> Result < Arc < DbChunk > > { debug ! ( partition_key table_name chunk_id " " ) ; // Get the chunk from the catalog let chunk = { let partition = self . preserved_catalog . state ( ) . valid_partition ( partition_key ) . context ( UnloadingChunkFromReadBuffer { partition_key , table_name , chunk_id , } ) ? ; let partition = partition . read ( ) ; partition . chunk ( table_name , chunk_id ) . context ( UnloadingChunkFromReadBuffer { partition_key , table_name , chunk_id , } ) ? } ; // update the catalog to no longer use read buffer chunk if any let mut chunk = chunk . write ( ) ; chunk . set_unload_from_read_buffer ( ) . context ( UnloadingChunkFromReadBuffer { partition_key , table_name , chunk_id , } ) ? ; debug ! ( partition_key table_name chunk_id " " ) ; Ok ( DbChunk :: snapshot ( & chunk ) ) }
Unload chunk from read buffer but keep it in object store
Unload chunk from read buffer but keep it in object store
&self
partition_key
&str
table_name
&str
chunk_id
u32
&self
partition_key
&str
table_name
&str
chunk_id
u32