Bug 799487 - Unable to save gnucash DB file as XML file

Not quite true, it just takes a really long time for a large database.

The underlying problem is gnc_file_do_save_as reloads the data to make
sure that the save-as saves everything. On the SQL backend that
triggers a scrub. The scrub itseld doesn't take long, but every
transaction commit was logged in the transaction log and did a refresh
of the registers. So:
* Suspend logging while doing the scrub.
* Suspend UI refreshes and QOF events while reloading the data.
This commit is contained in:
John Ralls
2024-12-17 16:23:13 -08:00
parent 579eed1fac
commit bda17ff4d8
2 changed files with 8 additions and 1 deletions

View File

@@ -30,6 +30,7 @@
#include <gncTaxTable.h>
#include <gncInvoice.h>
#include <gnc-pricedb.h>
#include <TransLog.h>
#include <algorithm>
#include <cassert>
@@ -347,8 +348,10 @@ GncSqlBackend::load (QofBook* book, QofBackendLoadType loadType)
* m_loading true prevents changes from being written back to the
* database. Do that now.
*/
xaccLogDisable();
auto transactions = qof_book_get_collection (book, GNC_ID_TRANS);
qof_collection_foreach(transactions, scrub_txn_callback, nullptr);
xaccLogEnable();
/* Mark the session as clean -- though it should never be marked
* dirty with this backend