Fix deadlock in integrity check before DB schema upgrade
One of the repair steps uses a transaction, which is reasonable, so don't run integrity check within transaction at startup.
This commit is contained in:
parent
d201fdc119
commit
b6fdeeca13
1 changed files with 24 additions and 24 deletions
|
@ -170,6 +170,25 @@ Zotero.Schema = new function(){
|
|||
var updated;
|
||||
await Zotero.DB.queryAsync("PRAGMA foreign_keys = false");
|
||||
try {
|
||||
// Auto-repair databases flagged for repair or coming from the DB Repair Tool
|
||||
//
|
||||
// If we need to run migration steps, skip the check until after the update, since
|
||||
// the integrity check is expecting to run on the current data model.
|
||||
let integrityCheckDone = false;
|
||||
let toVersion = await _getSchemaSQLVersion('userdata');
|
||||
if (integrityCheckRequired && userdata >= toVersion) {
|
||||
await this.integrityCheck(true);
|
||||
integrityCheckDone = true;
|
||||
}
|
||||
|
||||
// TEMP
|
||||
try {
|
||||
await _fixSciteValues();
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
}
|
||||
|
||||
updated = await Zotero.DB.executeTransaction(async function (conn) {
|
||||
var updated = await _updateSchema('system');
|
||||
|
||||
|
@ -179,25 +198,6 @@ Zotero.Schema = new function(){
|
|||
await _updateCustomTables();
|
||||
}
|
||||
|
||||
// Auto-repair databases flagged for repair or coming from the DB Repair Tool
|
||||
//
|
||||
// If we need to run migration steps, skip the check until after the update, since
|
||||
// the integrity check is expecting to run on the current data model.
|
||||
var integrityCheckDone = false;
|
||||
var toVersion = await _getSchemaSQLVersion('userdata');
|
||||
if (integrityCheckRequired && userdata >= toVersion) {
|
||||
await this.integrityCheck(true);
|
||||
integrityCheckDone = true;
|
||||
}
|
||||
|
||||
// TEMP
|
||||
try {
|
||||
await _fixSciteValues();
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
}
|
||||
|
||||
updated = await _migrateUserDataSchema(userdata, options);
|
||||
await _updateSchema('triggers');
|
||||
|
||||
|
@ -206,14 +206,14 @@ Zotero.Schema = new function(){
|
|||
// We do this again in case custom fields were changed during user data migration
|
||||
await _updateCustomTables();
|
||||
|
||||
// If we updated the DB, also do an integrity check for good measure
|
||||
if (updated && !integrityCheckDone) {
|
||||
await this.integrityCheck(true);
|
||||
}
|
||||
|
||||
return updated;
|
||||
}.bind(this));
|
||||
|
||||
// If we updated the DB, also do an integrity check for good measure
|
||||
if (updated && !integrityCheckDone) {
|
||||
await this.integrityCheck(true);
|
||||
}
|
||||
|
||||
// If bundled global schema file is newer than DB, apply it
|
||||
if (bundledGlobalSchemaVersionCompare === 1) {
|
||||
await Zotero.DB.executeTransaction(async function () {
|
||||
|
|
Loading…
Reference in a new issue