mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
move update schema global on commit and not on rollback txn
This commit is contained in:
parent
2414502268
commit
5d856499c4
1 changed files with 11 additions and 11 deletions
|
|
@ -639,27 +639,27 @@ impl Pager {
|
|||
) -> Result<PagerCacheflushStatus> {
|
||||
tracing::trace!("end_tx(rollback={})", rollback);
|
||||
if rollback {
|
||||
let maybe_schema_pair = if change_schema {
|
||||
let schema = connection.schema.borrow().clone();
|
||||
// Lock first before writing to the database schema in case someone tries to read the schema before it's updated
|
||||
let db_schema = connection._db.schema.write();
|
||||
Some((schema, db_schema))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.wal.borrow().end_write_tx()?;
|
||||
self.wal.borrow().end_read_tx()?;
|
||||
if let Some((schema, mut db_schema)) = maybe_schema_pair {
|
||||
*db_schema = schema;
|
||||
}
|
||||
return Ok(PagerCacheflushStatus::Done(PagerCacheflushResult::Rollback));
|
||||
}
|
||||
let cacheflush_status = self.cacheflush()?;
|
||||
match cacheflush_status {
|
||||
PagerCacheflushStatus::IO => Ok(PagerCacheflushStatus::IO),
|
||||
PagerCacheflushStatus::Done(_) => {
|
||||
let maybe_schema_pair = if change_schema {
|
||||
let schema = connection.schema.borrow().clone();
|
||||
// Lock first before writing to the database schema in case someone tries to read the schema before it's updated
|
||||
let db_schema = connection._db.schema.write();
|
||||
Some((schema, db_schema))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.wal.borrow().end_write_tx()?;
|
||||
self.wal.borrow().end_read_tx()?;
|
||||
if let Some((schema, mut db_schema)) = maybe_schema_pair {
|
||||
*db_schema = schema;
|
||||
}
|
||||
Ok(cacheflush_status)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue