[tracker/wip/carlosg/domain-ontologies: 121/124] tracker-store: Use wal_checkpoint API from TrackerDBInterface
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/domain-ontologies: 121/124] tracker-store: Use wal_checkpoint API from TrackerDBInterface
- Date: Thu, 29 Jun 2017 18:49:17 +0000 (UTC)
commit 9c455f1afee0ba269888aa3bed9f6b60460bfb27
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jun 24 19:24:24 2017 +0200
tracker-store: Use wal_checkpoint API from TrackerDBInterface
Better than calling the pragma and involving prepared statements
src/tracker-store/tracker-resources.vala | 2 +-
src/tracker-store/tracker-store.vala | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-store/tracker-resources.vala b/src/tracker-store/tracker-resources.vala
index 2f524f6..96b729c 100644
--- a/src/tracker-store/tracker-resources.vala
+++ b/src/tracker-store/tracker-resources.vala
@@ -177,7 +177,7 @@ public class Tracker.Resources : Object {
var iface = data_manager.get_db_interface ();
// wal checkpoint implies sync
- Tracker.Store.wal_checkpoint (iface);
+ Tracker.Store.wal_checkpoint (iface, true);
// sync journal if available
data.sync ();
diff --git a/src/tracker-store/tracker-store.vala b/src/tracker-store/tracker-store.vala
index 4445575..20aa212 100644
--- a/src/tracker-store/tracker-store.vala
+++ b/src/tracker-store/tracker-store.vala
@@ -251,10 +251,10 @@ public class Tracker.Store {
});
}
- public static void wal_checkpoint (DBInterface iface) {
+ public static void wal_checkpoint (DBInterface iface, bool blocking) {
try {
debug ("Checkpointing database...");
- iface.execute_query ("PRAGMA wal_checkpoint");
+ iface.sqlite_wal_checkpoint (blocking);
debug ("Checkpointing complete...");
} catch (Error e) {
warning (e.message);
@@ -271,7 +271,7 @@ public class Tracker.Store {
if (n_pages >= 10000) {
// do immediate checkpointing (blocking updates)
// to prevent excessive wal file growth
- wal_checkpoint (iface);
+ wal_checkpoint (iface, true);
} else if (n_pages >= 1000) {
if (AtomicInt.compare_and_exchange (ref checkpointing, 0, 1)) {
// initiate asynchronous checkpointing (not blocking updates)
@@ -286,9 +286,11 @@ public class Tracker.Store {
}
static void checkpoint_dispatch_cb (DBInterface iface) {
- // run in checkpoint thread
+ // run in checkpoint thread, we must fetch the right
+ // interface for this thread.
+ var manager = (Data.Manager) iface.get_user_data ();
- wal_checkpoint (iface);
+ wal_checkpoint (manager.get_db_interface (), false);
AtomicInt.set (ref checkpointing, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]