[tracker] libtracker-data: Set interfaces' prepared statement LRUs on common code
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Set interfaces' prepared statement LRUs on common code
- Date: Sun, 9 Jul 2017 22:13:03 +0000 (UTC)
commit a707d0eb2b8c0ea83e448ff35d9b24ce08c7a5dc
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jul 9 14:01:52 2017 +0200
libtracker-data: Set interfaces' prepared statement LRUs on common code
All DB interfaces get the max number of items set, so just set those
in common code. Also, avoid allocating any space for update statements
in readonly interfaces.
src/libtracker-data/tracker-db-manager.c | 31 +++++++++++------------------
1 files changed, 12 insertions(+), 19 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index be9cda7..3ca253e 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -603,6 +603,8 @@ tracker_db_manager_new (TrackerDBManagerFlags flags,
g_info ("Setting database locations");
db_manager->flags = flags;
+ db_manager->s_cache_size = select_cache_size;
+ db_manager->u_cache_size = update_cache_size;
g_set_object (&db_manager->cache_location, cache_location);
g_set_object (&db_manager->data_location, data_location);
@@ -898,17 +900,6 @@ tracker_db_manager_new (TrackerDBManagerFlags flags,
}
}
- tracker_db_interface_set_max_stmt_cache_size (resources_iface,
- TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT,
- select_cache_size);
-
- tracker_db_interface_set_max_stmt_cache_size (resources_iface,
- TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE,
- update_cache_size);
-
- db_manager->s_cache_size = select_cache_size;
- db_manager->u_cache_size = update_cache_size;
-
g_private_replace (&interface_data_key, resources_iface);
return db_manager;
@@ -1006,6 +997,16 @@ tracker_db_manager_create_db_interface (TrackerDBManager *db_manager,
return NULL;
}
+ tracker_db_interface_set_max_stmt_cache_size (connection,
+ TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT,
+ db_manager->s_cache_size);
+
+ if (!readonly) {
+ tracker_db_interface_set_max_stmt_cache_size (connection,
+ TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE,
+ db_manager->u_cache_size);
+ }
+
return connection;
}
@@ -1043,14 +1044,6 @@ tracker_db_manager_get_db_interface (TrackerDBManager *db_manager)
tracker_data_manager_init_fts (interface, FALSE);
- tracker_db_interface_set_max_stmt_cache_size (interface,
- TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT,
- db_manager->s_cache_size);
-
- tracker_db_interface_set_max_stmt_cache_size (interface,
- TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE,
- db_manager->u_cache_size);
-
g_private_set (&interface_data_key, interface);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]