[tracker/wip/carlosg/wal-and-other-fixes: 7/8] libtracker-data: Set page_size first and foremost



commit 9e084ca8c3ea6db507a270ec710f207b29e3c639
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jul 1 18:14:04 2020 +0200

    libtracker-data: Set page_size first and foremost
    
    This is documented as not having effect after WAL is enabled, but we
    do enable it first. Make it sure this happens before the journal_mode
    change.
    
    Also drop the unused define.

 src/libtracker-data/tracker-db-manager.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 1bf2d6c93..08ab085bf 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -53,9 +53,6 @@
 /* Required minimum space needed to create databases (5Mb) */
 #define TRACKER_DB_MIN_REQUIRED_SPACE 5242880
 
-/* Default memory settings for databases */
-#define TRACKER_DB_PAGE_SIZE_DONT_SET -1
-
 /* Set current database version we are working with */
 #define TRACKER_DB_VERSION_NOW        TRACKER_DB_VERSION_2_3
 
@@ -194,6 +191,9 @@ db_set_params (TrackerDBInterface   *iface,
        GError *internal_error = NULL;
        TrackerDBStatement *stmt;
 
+       TRACKER_NOTE (SQLITE, g_message ("  Setting page size to %d", page_size));
+       tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".page_size = %d", database, page_size);
+
        tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".synchronous = NORMAL", database);
        tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".auto_vacuum = 0", database);
 
@@ -226,11 +226,6 @@ db_set_params (TrackerDBInterface   *iface,
 
        tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".journal_size_limit = 10240000", 
database);
 
-       if (page_size != TRACKER_DB_PAGE_SIZE_DONT_SET) {
-               TRACKER_NOTE (SQLITE, g_message ("  Setting page size to %d", page_size));
-               tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".page_size = %d", database, 
page_size);
-       }
-
        tracker_db_interface_execute_query (iface, NULL, "PRAGMA \"%s\".cache_size = %d", database, 
cache_size);
        TRACKER_NOTE (SQLITE, g_message ("  Setting cache size to %d", cache_size));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]