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,
|
db_path,
|
||||||
state: RwLock::new(State::new()),
|
state: RwLock::new(State::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state.save_metadata().await?;
|
||||||
Ok(state)
|
Ok(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,9 +278,13 @@ impl StateHandler {
|
||||||
response_writer.write_command_complete(CompleteStatus::Delete(count)).await.map_err(|e| RuntimeError::AnyhowError(e))
|
response_writer.write_command_complete(CompleteStatus::Delete(count)).await.map_err(|e| RuntimeError::AnyhowError(e))
|
||||||
}
|
}
|
||||||
CreateTable(table_schema) => {
|
CreateTable(table_schema) => {
|
||||||
|
{
|
||||||
let mut state = self.state.write().await;
|
let mut state = self.state.write().await;
|
||||||
let table = Table::new(table_schema, &self.db_path).await?;
|
let table = Table::new(table_schema, &self.db_path).await?;
|
||||||
state.attach_table(table).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))
|
response_writer.write_command_complete(CompleteStatus::CreateTable).await.map_err(|e| RuntimeError::AnyhowError(e))
|
||||||
}
|
}
|
||||||
CreateIndex(table_position, column) => {
|
CreateIndex(table_position, column) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue