www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 249f9c6495ae717da9768972311d9e98b1aaf102
parent c6b78da69d660e2a15bc5729309c64a091211893
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 23 Jan 2017 07:20:36 -0500

Temporary prefs buttons to debug slow DB issue

Diffstat:
Mchrome/content/zotero/preferences/preferences_advanced_standalone.xul | 6++++++
Mchrome/content/zotero/xpcom/db.js | 20+++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/preferences/preferences_advanced_standalone.xul b/chrome/content/zotero/preferences/preferences_advanced_standalone.xul @@ -31,6 +31,12 @@ <button id="openAboutMemory" label="&zotero.preferences.openAboutMemory;" oncommand="Zotero_Preferences.openInViewer('about:memory')"/> + <button id="db-info" + label="DB Info" + oncommand="Zotero.DB.info().then(json => Zotero.alert(null, '', JSON.stringify(json, null, 4)))"/> + <button id="vacuum" + label="Vacuum DB" + oncommand="Zotero.DB.vacuum().then(() => Zotero.alert(null, '', 'Done'))"/> </hbox> </groupbox> </overlay> diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js @@ -42,7 +42,6 @@ Zotero.DBConnection = function(dbName) { this.closed = false; this.skipBackup = false; - this.transactionVacuum = false; // JS Date this.__defineGetter__('transactionDate', function () { @@ -500,6 +499,8 @@ Zotero.DBConnection.prototype.executeTransaction = Zotero.Promise.coroutine(func if (options.vacuumOnCommit) { Zotero.debug('Vacuuming database'); yield this.queryAsync('VACUUM'); + Zotero.debug('Done vacuuming'); + } this._transactionID = null; @@ -868,6 +869,23 @@ Zotero.DBConnection.prototype.observe = function(subject, topic, data) { } +// TEMP +Zotero.DBConnection.prototype.vacuum = function () { + return this.executeTransaction(function* () {}, { vacuumOnCommit: true }); +}; + + +// TEMP +Zotero.DBConnection.prototype.info = Zotero.Promise.coroutine(function* () { + var info = {}; + var pragmas = ['auto_vacuum', 'cache_size', 'locking_mode', 'page_size']; + for (let p of pragmas) { + info[p] = yield Zotero.DB.valueQueryAsync(`PRAGMA ${p}`); + } + return info; +}); + + Zotero.DBConnection.prototype.integrityCheck = Zotero.Promise.coroutine(function* () { var ok = yield this.valueQueryAsync("PRAGMA integrity_check"); return ok == 'ok';