pub fn drop_chunk(&self, partition_key: &str, table_name: &str, chunk_id: u32) -> Result<()> {
        debug!(%partition_key, %table_name, %chunk_id, "dropping chunk");

        let partition = self
            .preserved_catalog
            .state()
            .valid_partition(partition_key)
            .context(DroppingChunk {
                partition_key,
                table_name,
                chunk_id,
            })?;

        // lock the partition so that no one else can be messing /
        // with it while we drop the chunk
        let mut partition = partition.write();

        {
            let chunk = partition
                .chunk(table_name, chunk_id)
                .context(DroppingChunk {
                    partition_key,
                    table_name,
                    chunk_id,
                })?;
            let chunk = chunk.read();
            let chunk_state = chunk.stage().name();

            // prevent chunks that are actively being moved. TODO it
            // would be nicer to allow this to happen have the chunk
            // migration logic cleanup afterwards so that users
            // weren't prevented from dropping chunks due to
            // background tasks
            if let Some(lifecycle_action) = chunk.lifecycle_action() {
                return DropMovingChunk {
                    partition_key,
                    table_name,
                    chunk_id,
                    action: lifecycle_action.metadata().name(),
                }
                .fail();
            }

            debug!(%partition_key, %table_name, %chunk_id, %chunk_state, "dropping chunk");
        }

        partition
            .drop_chunk(table_name, chunk_id)
            .context(DroppingChunk {
                partition_key,
                table_name,
                chunk_id,
            })
    }
/// Drops the specified chunk from the catalog and all storage systems
Drops the specified chunk from the catalog and all storage systems
Drops the specified chunk from the catalog and all storage systems
pub fn drop_chunk(&self, partition_key: &str, table_name: &str, chunk_id: u32) -> Result<()> {
        debug!(%partition_key, %table_name, %chunk_id, "dropping chunk");
        let partition = self
            .preserved_catalog
            .state()
            .valid_partition(partition_key)
            .context(DroppingChunk {
                partition_key,
                table_name,
                chunk_id,
            })?;
        // lock the partition so that no one else can be messing /
        // with it while we drop the chunk
        let mut partition = partition.write();
        {
            let chunk = partition
                .chunk(table_name, chunk_id)
                .context(DroppingChunk {
                    partition_key,
                    table_name,
                    chunk_id,
                })?;
            let chunk = chunk.read();
            let chunk_state = chunk.stage().name();
            // prevent chunks that are actively being moved. TODO it
            // would be nicer to allow this to happen have the chunk
            // migration logic cleanup afterwards so that users
            // weren't prevented from dropping chunks due to
            // background tasks
            if let Some(lifecycle_action) = chunk.lifecycle_action() {
                return DropMovingChunk {
                    partition_key,
                    table_name,
                    chunk_id,
                    action: lifecycle_action.metadata().name(),
                }
                .fail();
            }
            debug!(%partition_key, %table_name, %chunk_id, %chunk_state, "dropping chunk");
        }
        partition
            .drop_chunk(table_name, chunk_id)
            .context(DroppingChunk {
                partition_key,
                table_name,
                chunk_id,
            })
    }
pub fn drop_chunk ( & self , partition_key : & str , table_name : & str , chunk_id : u32 ) -> Result < ( ) > { debug ! ( partition_key table_name chunk_id " " ) ; let partition = self . preserved_catalog . state ( ) . valid_partition ( partition_key ) . context ( DroppingChunk { partition_key , table_name , chunk_id , } ) ? ; // lock the partition so that no one else can be messing / // with it while we drop the chunk let mut partition = partition . write ( ) ; { let chunk = partition . chunk ( table_name , chunk_id ) . context ( DroppingChunk { partition_key , table_name , chunk_id , } ) ? ; let chunk = chunk . read ( ) ; let chunk_state = chunk . stage ( ) . name ( ) ; // prevent chunks that are actively being moved. TODO it // would be nicer to allow this to happen have the chunk // migration logic cleanup afterwards so that users // weren't prevented from dropping chunks due to // background tasks if let Some ( lifecycle_action ) = chunk . lifecycle_action ( ) { return DropMovingChunk { partition_key , table_name , chunk_id , action : lifecycle_action . metadata ( ) . name ( ) , } . fail ( ) ; } debug ! ( partition_key table_name chunk_id chunk_state " " ) ; } partition . drop_chunk ( table_name , chunk_id ) . context ( DroppingChunk { partition_key , table_name , chunk_id , } ) }
Drops the specified chunk from the catalog and all storage systems
Drops the specified chunk from the catalog and all storage systems
&self
partition_key
&str
table_name
&str
chunk_id
u32
&self
partition_key
&str
table_name
&str
chunk_id
u32