fix: Shut down a database when it's deleted

pull/24376/head
Carol (Nichols || Goulding) 2021-09-13 11:41:54 -04:00
parent 7b6d8f9327
commit 7c81c280cf
1 changed files with 9 additions and 0 deletions

View File

@ -205,6 +205,7 @@ impl Database {
/// Mark this database as deleted.
pub async fn delete(&self) -> Result<(), Error> {
let db_name = &self.shared.config.name;
info!(%db_name, "marking database deleted");
let handle = {
let state = self.shared.state.read();
@ -244,12 +245,19 @@ impl Database {
shared.state_notify.notify_waiters();
}
self.shutdown();
Ok(())
}
/// Mark this database as restored.
pub async fn restore(&self, iox_object_store: IoxObjectStore) -> Result<(), Error> {
let db_name = &self.shared.config.name;
info!(
%db_name,
object_store_path=%iox_object_store.debug_database_path(),
"restoring database"
);
let handle = {
let state = self.shared.state.read();
@ -272,6 +280,7 @@ impl Database {
DatabaseState::DatabaseObjectStoreFound(DatabaseStateDatabaseObjectStoreFound {
iox_object_store: Arc::new(iox_object_store),
});
info!(%db_name, "set database state to object store found");
}
Ok(())