Saving of metadata
This commit is contained in:
parent
b2b99f7614
commit
a4077658cf
1 changed files with 9 additions and 3 deletions
|
|
@ -201,6 +201,8 @@ impl StateHandler {
|
|||
db_path,
|
||||
state: RwLock::new(State::new()),
|
||||
};
|
||||
|
||||
state.save_metadata().await?;
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
|
|
@ -276,9 +278,13 @@ impl StateHandler {
|
|||
response_writer.write_command_complete(CompleteStatus::Delete(count)).await.map_err(|e| RuntimeError::AnyhowError(e))
|
||||
}
|
||||
CreateTable(table_schema) => {
|
||||
let mut state = self.state.write().await;
|
||||
let table = Table::new(table_schema, &self.db_path).await?;
|
||||
state.attach_table(table).await;
|
||||
{
|
||||
let mut state = self.state.write().await;
|
||||
let table = Table::new(table_schema, &self.db_path).await?;
|
||||
state.attach_table(table).await;
|
||||
// WARNING: We need to drop the write lock on state unless we want a deadlock.
|
||||
}
|
||||
self.save_metadata().await?;
|
||||
response_writer.write_command_complete(CompleteStatus::CreateTable).await.map_err(|e| RuntimeError::AnyhowError(e))
|
||||
}
|
||||
CreateIndex(table_position, column) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue