[tracker/lru-stmt-cache: 4/7] libtracker-data, -direct, tests: Make it possible to set the max cache size per connection



commit 417dee44d38b5262e08a9f28c85281241a6a3f7c
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Sep 22 14:21:37 2010 +0200

    libtracker-data, -direct, tests: Make it possible to set the max cache size per connection

 src/libtracker-data/libtracker-data.vapi           |    2 +-
 src/libtracker-data/tracker-data-backup.c          |    6 +-
 src/libtracker-data/tracker-data-manager.c         |    7 +-
 src/libtracker-data/tracker-data-manager.h         |    2 +
 src/libtracker-data/tracker-db-interface-sqlite.c  |   23 +++-
 src/libtracker-data/tracker-db-interface.h         |  154 ++++++++++----------
 src/libtracker-data/tracker-db-manager.c           |   29 +++-
 src/libtracker-data/tracker-db-manager.h           |    7 +-
 src/libtracker-direct/tracker-direct.vala          |    3 +-
 src/tracker-control/tracker-control.c              |    4 +-
 src/tracker-store/tracker-main.c                   |    5 +
 tests/libtracker-data/tracker-backup-test.c        |    4 +-
 .../libtracker-data/tracker-ontology-change-test.c |    4 +-
 tests/libtracker-data/tracker-ontology-test.c      |    6 +
 tests/libtracker-data/tracker-sparql-blank-test.c  |    2 +
 tests/libtracker-data/tracker-sparql-test.c        |    2 +-
 tests/libtracker-fts/tracker-fts-test.c            |    2 +-
 17 files changed, 164 insertions(+), 98 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index 98228b5..6902c54 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -150,7 +150,7 @@ namespace Tracker {
 
 	[CCode (cheader_filename = "libtracker-data/tracker-data-manager.h")]
 	namespace Data.Manager {
-		public bool init (DBManagerFlags flags, [CCode (array_length = false)] string[]? test_schema, out bool first_time, bool journal_check, BusyCallback? busy_callback, string? busy_status);
+		public bool init (DBManagerFlags flags, [CCode (array_length = false)] string[]? test_schema, out bool first_time, bool journal_check, uint select_cache_size, uint update_cache_size, BusyCallback? busy_callback, string? busy_status);
 		public void shutdown ();
 	}
 }
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 5b3c0a7..3f1042c 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -344,13 +344,16 @@ tracker_data_backup_restore (GFile *journal,
 	info->destroy = destroy;
 
 	if (g_file_query_exists (info->journal, NULL)) {
-		TrackerDBManagerFlags flags = tracker_db_manager_get_flags ();
+		TrackerDBManagerFlags flags;
 		gboolean is_first;
 		GFile *parent = g_file_get_parent (info->destination);
 		gchar *tmp_stdout = NULL;
 		gchar *tmp_stderr = NULL;
 		gchar **argv;
 		gint exit_status;
+		guint select_cache_size, update_cache_size;
+
+		flags = tracker_db_manager_get_flags (&select_cache_size, &update_cache_size);
 
 		tracker_db_manager_move_to_temp ();
 		tracker_data_manager_shutdown ();
@@ -401,6 +404,7 @@ tracker_data_backup_restore (GFile *journal,
 		tracker_db_journal_shutdown ();
 
 		tracker_data_manager_init (flags, test_schemas, &is_first, TRUE,
+		                           select_cache_size, update_cache_size,
 		                           busy_callback, busy_user_data,
 		                           "Restoring backup");
 
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 74d687d..89191d5 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1688,7 +1688,7 @@ db_get_static_data (TrackerDBInterface *iface)
 			/* xsd classes do not derive from rdfs:Resource and do not use separate tables */
 			/* no need to fetch resource count if we are running in read-only mode (direct access) */
 			if (!g_str_has_prefix (tracker_class_get_name (class), "xsd:") &&
-			    (tracker_db_manager_get_flags () & TRACKER_DB_MANAGER_READONLY) == 0) {
+			    (tracker_db_manager_get_flags (NULL, NULL) & TRACKER_DB_MANAGER_READONLY) == 0) {
 				/* update statistics */
 				stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT, &error,
 				                                              "SELECT COUNT(1) FROM \"%s\"",
@@ -2751,6 +2751,8 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
                            const gchar          **test_schemas,
                            gboolean              *first_time,
                            gboolean               journal_check,
+                           guint                  select_cache_size,
+                           guint                  update_cache_size,
                            TrackerBusyCallback    busy_callback,
                            gpointer               busy_user_data,
                            const gchar           *busy_status)
@@ -2783,7 +2785,8 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 
 	read_journal = FALSE;
 
-	if (!tracker_db_manager_init (flags, &is_first_time_index, FALSE)) {
+	if (!tracker_db_manager_init (flags, &is_first_time_index, FALSE,
+	                              select_cache_size, update_cache_size)) {
 		return FALSE;
 	}
 
diff --git a/src/libtracker-data/tracker-data-manager.h b/src/libtracker-data/tracker-data-manager.h
index b5ba1fc..4febad3 100644
--- a/src/libtracker-data/tracker-data-manager.h
+++ b/src/libtracker-data/tracker-data-manager.h
@@ -42,6 +42,8 @@ gboolean tracker_data_manager_init                   (TrackerDBManagerFlags  fla
                                                       const gchar          **test_schema,
                                                       gboolean              *first_time,
                                                       gboolean               journal_check,
+                                                      guint                  select_cache_size,
+                                                      guint                  update_cache_size,
                                                       TrackerBusyCallback    busy_callback,
                                                       gpointer               busy_user_data,
                                                       const gchar           *busy_status);
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index a43e473..9e0715c 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -38,13 +38,11 @@
 
 #include "tracker-db-interface-sqlite.h"
 
-/* Increase this after testing is done */
-#define TRACKER_STMT_LRU_SIZE	3
-
 typedef struct {
 	TrackerDBStatement *head;
 	TrackerDBStatement *tail;
 	guint size;
+	guint max;
 } TrackerDBStatementLru;
 
 struct TrackerDBInterface {
@@ -828,6 +826,23 @@ add_row (TrackerDBResultSet *result_set,
 	}
 }
 
+void
+tracker_db_interface_set_max_stmt_cache_size (TrackerDBInterface         *db_interface,
+                                              TrackerDBStatementCacheType cache_type,
+                                              guint                       max_size)
+{
+	TrackerDBStatementLru *stmt_lru;
+
+	if (cache_type == TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE) {
+		stmt_lru = &db_interface->update_stmt_lru;
+	} else if (cache_type == TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT) {
+		stmt_lru = &db_interface->select_stmt_lru;
+	} else {
+		return;
+	}
+
+	stmt_lru->max = max_size;
+}
 
 TrackerDBStatement *
 tracker_db_interface_create_statement (TrackerDBInterface           *db_interface,
@@ -904,7 +919,7 @@ tracker_db_interface_create_statement (TrackerDBInterface           *db_interfac
 			                      (gpointer) sqlite3_sql (sqlite_stmt),
 			                      stmt);
 
-			if (stmt_lru->size >= TRACKER_STMT_LRU_SIZE) {
+			if (stmt_lru->size >= stmt_lru->max) {
 				TrackerDBStatement *new_head;
 				/* Destroy old stmt_lru.head and fix the ring */
 				new_head = stmt_lru->head->next;
diff --git a/src/libtracker-data/tracker-db-interface.h b/src/libtracker-data/tracker-db-interface.h
index 577877f..3575fff 100644
--- a/src/libtracker-data/tracker-db-interface.h
+++ b/src/libtracker-data/tracker-db-interface.h
@@ -85,89 +85,93 @@ typedef struct TrackerDBCursor         TrackerDBCursor;
 typedef struct TrackerDBCursorClass    TrackerDBCursorClass;
 typedef struct TrackerDBResultSetPrivate TrackerDBResultSetPrivate;
 
-GQuark                  tracker_db_interface_error_quark        (void);
+GQuark                  tracker_db_interface_error_quark             (void);
 
-GType                   tracker_db_interface_get_type           (void);
-GType                   tracker_db_statement_get_type           (void);
-GType                   tracker_db_cursor_get_type              (void);
-GType                   tracker_db_result_set_get_type          (void);
+GType                   tracker_db_interface_get_type                (void);
+GType                   tracker_db_statement_get_type                (void);
+GType                   tracker_db_cursor_get_type                   (void);
+GType                   tracker_db_result_set_get_type               (void);
 
-/* Functions to create queries/procedures */
-TrackerDBStatement *    tracker_db_interface_create_statement   (TrackerDBInterface          *interface,
-                                                                 TrackerDBStatementCacheType  cache_type,
-                                                                 GError                     **error,
-                                                                 const gchar                 *query,
-                                                                 ...) G_GNUC_PRINTF (4, 5);
-TrackerDBResultSet *    tracker_db_interface_execute_vquery     (TrackerDBInterface          *interface,
-                                                                 GError                     **error,
-                                                                 const gchar                 *query,
-                                                                 va_list                      args);
-TrackerDBResultSet *    tracker_db_interface_execute_query      (TrackerDBInterface          *interface,
-                                                                 GError                     **error,
-                                                                 const gchar                 *query,
-                                                                  ...) G_GNUC_PRINTF (3, 4);
-gboolean                tracker_db_interface_start_transaction  (TrackerDBInterface         *interface);
-gboolean                tracker_db_interface_end_db_transaction (TrackerDBInterface         *interface);
-void                    tracker_db_statement_bind_double        (TrackerDBStatement         *stmt,
-                                                                 int                         index,
-                                                                 double                      value);
-void                    tracker_db_statement_bind_int           (TrackerDBStatement         *stmt,
-                                                                 int                         index,
-                                                                 gint64                      value);
-void                    tracker_db_statement_bind_null          (TrackerDBStatement         *stmt,
-                                                                 int                         index);
-void                    tracker_db_statement_bind_text          (TrackerDBStatement         *stmt,
-                                                                 int                         index,
-                                                                 const gchar                *value);
-TrackerDBResultSet *    tracker_db_statement_execute            (TrackerDBStatement         *stmt,
-                                                                 GError                    **error);
-TrackerDBCursor *       tracker_db_statement_start_cursor       (TrackerDBStatement         *stmt,
-                                                                 GError                    **error);
-TrackerDBCursor *       tracker_db_statement_start_sparql_cursor(TrackerDBStatement         *stmt,
-                                                                 TrackerPropertyType        *types,
-                                                                 gint                        n_types,
-                                                                 const gchar               **variable_names,
-                                                                 gint                        n_variable_names,
-                                                                 GError                    **error);
+void                    tracker_db_interface_set_max_stmt_cache_size (TrackerDBInterface         *db_interface,
+                                                                      TrackerDBStatementCacheType cache_type,
+                                                                      guint                       max_size);
 
+/* Functions to create queries/procedures */
+TrackerDBStatement *    tracker_db_interface_create_statement        (TrackerDBInterface          *interface,
+                                                                      TrackerDBStatementCacheType  cache_type,
+                                                                      GError                     **error,
+                                                                      const gchar                 *query,
+                                                                      ...) G_GNUC_PRINTF (4, 5);
+TrackerDBResultSet *    tracker_db_interface_execute_vquery          (TrackerDBInterface          *interface,
+                                                                      GError                     **error,
+                                                                      const gchar                 *query,
+                                                                      va_list                      args);
+TrackerDBResultSet *    tracker_db_interface_execute_query           (TrackerDBInterface          *interface,
+                                                                      GError                     **error,
+                                                                      const gchar                 *query,
+                                                                       ...) G_GNUC_PRINTF (3, 4);
+
+gboolean                tracker_db_interface_start_transaction       (TrackerDBInterface         *interface);
+gboolean                tracker_db_interface_end_db_transaction      (TrackerDBInterface         *interface);
+void                    tracker_db_statement_bind_double             (TrackerDBStatement         *stmt,
+                                                                      int                         index,
+                                                                      double                      value);
+void                    tracker_db_statement_bind_int                (TrackerDBStatement         *stmt,
+                                                                      int                         index,
+                                                                      gint64                      value);
+void                    tracker_db_statement_bind_null               (TrackerDBStatement         *stmt,
+                                                                      int                         index);
+void                    tracker_db_statement_bind_text               (TrackerDBStatement         *stmt,
+                                                                      int                         index,
+                                                                      const gchar                *value);
+TrackerDBResultSet *    tracker_db_statement_execute                 (TrackerDBStatement         *stmt,
+                                                                      GError                    **error);
+TrackerDBCursor *       tracker_db_statement_start_cursor            (TrackerDBStatement         *stmt,
+                                                                      GError                    **error);
+TrackerDBCursor *       tracker_db_statement_start_sparql_cursor     (TrackerDBStatement         *stmt,
+                                                                      TrackerPropertyType        *types,
+                                                                      gint                        n_types,
+                                                                      const gchar               **variable_names,
+                                                                      gint                        n_variable_names,
+                                                                      GError                    **error);
 /* Semi private TrackerDBResultSet functions */
-TrackerDBResultSet *    _tracker_db_result_set_new              (guint                       cols);
-void                    _tracker_db_result_set_append           (TrackerDBResultSet         *result_set);
-void                    _tracker_db_result_set_set_value        (TrackerDBResultSet         *result_set,
-                                                                 guint                       column,
-                                                                 const GValue               *value);
-void                    _tracker_db_result_set_get_value        (TrackerDBResultSet         *result_set,
-                                                                 guint                       column,
-                                                                 GValue                     *value);
+TrackerDBResultSet *    _tracker_db_result_set_new                   (guint                       cols);
+void                    _tracker_db_result_set_append                (TrackerDBResultSet         *result_set);
+void                    _tracker_db_result_set_set_value             (TrackerDBResultSet         *result_set,
+                                                                      guint                       column,
+                                                                      const GValue               *value);
+void                    _tracker_db_result_set_get_value             (TrackerDBResultSet         *result_set,
+                                                                      guint                       column,
+                                                                      GValue                     *value);
 
 /* Functions to deal with the resultset */
-void                    tracker_db_result_set_get               (TrackerDBResultSet         *result_set,
-                                                                 ...);
-void                    tracker_db_result_set_rewind            (TrackerDBResultSet         *result_set);
-gboolean                tracker_db_result_set_iter_next         (TrackerDBResultSet         *result_set);
-guint                   tracker_db_result_set_get_n_columns     (TrackerDBResultSet         *result_set);
-guint                   tracker_db_result_set_get_n_rows        (TrackerDBResultSet         *result_set);
+void                    tracker_db_result_set_get                    (TrackerDBResultSet         *result_set,
+                                                                      ...);
+void                    tracker_db_result_set_rewind                 (TrackerDBResultSet         *result_set);
+gboolean                tracker_db_result_set_iter_next              (TrackerDBResultSet         *result_set);
+guint                   tracker_db_result_set_get_n_columns          (TrackerDBResultSet         *result_set);
+guint                   tracker_db_result_set_get_n_rows             (TrackerDBResultSet         *result_set);
 
 /* Functions to deal with a cursor */
-void                    tracker_db_cursor_rewind                (TrackerDBCursor            *cursor);
-gboolean                tracker_db_cursor_iter_next             (TrackerDBCursor            *cursor,
-                                                                 GCancellable               *cancellable,
-                                                                 GError                    **error);
-guint                   tracker_db_cursor_get_n_columns         (TrackerDBCursor            *cursor);
-const gchar*            tracker_db_cursor_get_variable_name     (TrackerDBCursor            *cursor,
-                                                                 guint                       column);
-TrackerSparqlValueType  tracker_db_cursor_get_value_type        (TrackerDBCursor            *cursor,
-                                                                 guint                       column);
-void                    tracker_db_cursor_get_value             (TrackerDBCursor            *cursor,
-                                                                 guint                       column,
-                                                                 GValue                     *value);
-const gchar*            tracker_db_cursor_get_string            (TrackerDBCursor            *cursor,
-                                                                 guint                       column,
-                                                                 glong                      *length);
-gint64                  tracker_db_cursor_get_int               (TrackerDBCursor            *cursor,
-                                                                 guint                       column);
-gdouble                 tracker_db_cursor_get_double            (TrackerDBCursor            *cursor,
-                                                                 guint                       column);
+void                    tracker_db_cursor_rewind                     (TrackerDBCursor            *cursor);
+gboolean                tracker_db_cursor_iter_next                  (TrackerDBCursor            *cursor,
+                                                                      GCancellable               *cancellable,
+                                                                      GError                    **error);
+guint                   tracker_db_cursor_get_n_columns              (TrackerDBCursor            *cursor);
+const gchar*            tracker_db_cursor_get_variable_name          (TrackerDBCursor            *cursor,
+                                                                      guint                       column);
+TrackerSparqlValueType  tracker_db_cursor_get_value_type             (TrackerDBCursor            *cursor,
+                                                                      guint                       column);
+void                    tracker_db_cursor_get_value                  (TrackerDBCursor            *cursor,
+                                                                      guint                       column,
+                                                                      GValue                     *value);
+const gchar*            tracker_db_cursor_get_string                 (TrackerDBCursor            *cursor,
+                                                                      guint                       column,
+                                                                      glong                      *length);
+gint64                  tracker_db_cursor_get_int                    (TrackerDBCursor            *cursor,
+                                                                      guint                       column);
+gdouble                 tracker_db_cursor_get_double                 (TrackerDBCursor            *cursor,
+                                                                      guint                       column);
 
 G_END_DECLS
 
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 9df44e9..10d40c3 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -153,6 +153,8 @@ static gchar                *sys_tmp_dir = NULL;
 static gchar                *in_use_filename = NULL;
 static gpointer              db_type_enum_class_pointer;
 static TrackerDBManagerFlags old_flags = 0;
+static guint                 s_cache_size;
+static guint                 u_cache_size;
 
 static GStaticPrivate        interface_data_key = G_STATIC_PRIVATE_INIT;
 
@@ -191,8 +193,14 @@ db_exec_no_reply (TrackerDBInterface *iface,
 }
 
 TrackerDBManagerFlags
-tracker_db_manager_get_flags (void)
+tracker_db_manager_get_flags (guint *select_cache_size, guint *update_cache_size)
 {
+	if (select_cache_size)
+		*select_cache_size = s_cache_size;
+
+	if (update_cache_size)
+		*update_cache_size = u_cache_size;
+
 	return old_flags;
 }
 
@@ -683,7 +691,9 @@ tracker_db_manager_init_locations (void)
 gboolean
 tracker_db_manager_init (TrackerDBManagerFlags  flags,
                          gboolean              *first_time,
-                         gboolean               shared_cache)
+                         gboolean               shared_cache,
+                         guint                  select_cache_size,
+                         guint                  update_cache_size)
 {
 	GType               etype;
 	TrackerDBVersion    version;
@@ -966,6 +976,17 @@ tracker_db_manager_init (TrackerDBManagerFlags  flags,
 		                                                        TRACKER_DB_METADATA);
 	}
 
+	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);
+
+	s_cache_size = select_cache_size;
+	u_cache_size = update_cache_size;
+
 	g_static_private_set (&interface_data_key, resources_iface, (GDestroyNotify) g_object_unref);
 
 	return TRUE;
@@ -1018,13 +1039,13 @@ tracker_db_manager_shutdown (void)
 	initialized = FALSE;
 	locations_initialized = FALSE;
 
-	if ((tracker_db_manager_get_flags () & TRACKER_DB_MANAGER_READONLY) == 0) {
+	if ((tracker_db_manager_get_flags (NULL, NULL) & TRACKER_DB_MANAGER_READONLY) == 0) {
 		/* do not delete in-use file for read-only mode (direct access) */
 		g_unlink (in_use_filename);
 	}
 
 	g_free (in_use_filename);
-        in_use_filename = NULL;
+	in_use_filename = NULL;
 }
 
 void
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index 7c041e8..6c2f98d 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -49,7 +49,9 @@ typedef enum {
 GType               tracker_db_get_type                       (void) G_GNUC_CONST;
 gboolean            tracker_db_manager_init                   (TrackerDBManagerFlags  flags,
                                                                gboolean              *first_time,
-                                                               gboolean               shared_cache);
+                                                               gboolean               shared_cache,
+                                                               guint                  select_cache_size,
+                                                               guint                  update_cache_size);
 void                tracker_db_manager_shutdown               (void);
 void                tracker_db_manager_remove_all             (gboolean               rm_journal);
 void                tracker_db_manager_optimize               (void);
@@ -62,7 +64,8 @@ void                tracker_db_manager_init_locations         (void);
 gboolean            tracker_db_manager_has_enough_space       (void);
 
 TrackerDBManagerFlags
-                    tracker_db_manager_get_flags              (void);
+                    tracker_db_manager_get_flags              (guint *select_cache_size,
+                                                               guint *update_cache_size);
 
 gboolean            tracker_db_manager_get_first_index_done   (void);
 guint64             tracker_db_manager_get_last_crawl_done    (void);
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index dda2c82..b8f33bb 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -39,9 +39,10 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 			throw new Sparql.Error.INTERNAL ("Unable to initialize database");
 		}
 
-		if (!Data.Manager.init (DBManagerFlags.READONLY, null, null, false, null, null)) {
+		if (!Data.Manager.init (DBManagerFlags.READONLY, null, null, false, 100, 0, null, null)) {
 			throw new Sparql.Error.INTERNAL ("Unable to initialize database");
 		}
+
 		initialized = true;
 	}
 
diff --git a/src/tracker-control/tracker-control.c b/src/tracker-control/tracker-control.c
index 9292b45..ece1e93 100644
--- a/src/tracker-control/tracker-control.c
+++ b/src/tracker-control/tracker-control.c
@@ -438,8 +438,8 @@ main (int argc, char **argv)
 
 		g_object_unref (db_config);
 
-		/* Clean up */
-		if (!tracker_db_manager_init (TRACKER_DB_MANAGER_REMOVE_ALL, NULL, FALSE)) {
+		/* Clean up (select_cache_size and update_cache_size don't matter here) */
+		if (!tracker_db_manager_init (TRACKER_DB_MANAGER_REMOVE_ALL, NULL, FALSE, 100, 100)) {
 			return EXIT_FAILURE;
 		}
 
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index 6059b4b..e262a6b 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -67,6 +67,9 @@
 	"\n" \
 	"  http://www.gnu.org/licenses/gpl.txt\n";
 
+#define TRACKER_STORE_SELECT_CACHE_SIZE		100
+#define TRACKER_STORE_UPDATE_CACHE_SIZE		100
+
 typedef struct {
 	GMainLoop *main_loop;
 	gchar *log_filename;
@@ -478,6 +481,8 @@ main (gint argc, gchar *argv[])
 	                                NULL,
 	                                &is_first_time_index,
 	                                TRUE,
+	                                TRACKER_STORE_SELECT_CACHE_SIZE,
+	                                TRACKER_STORE_UPDATE_CACHE_SIZE,
 	                                busy_callback,
 	                                busy_user_data,
 	                                "Journal replaying")) {
diff --git a/tests/libtracker-data/tracker-backup-test.c b/tests/libtracker-data/tracker-backup-test.c
index a060f29..720aab7 100644
--- a/tests/libtracker-data/tracker-backup-test.c
+++ b/tests/libtracker-data/tracker-backup-test.c
@@ -109,7 +109,7 @@ test_backup_and_restore_helper (gboolean journal)
 
 	tracker_data_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
 	                           (const gchar **) test_schemas,
-	                           NULL, FALSE, NULL, NULL, NULL);
+	                           NULL, FALSE, 100, 100, NULL, NULL, NULL);
 
 	/* load data set */
 	data_filename = g_strconcat (data_prefix, ".data", NULL);
@@ -161,7 +161,7 @@ test_backup_and_restore_helper (gboolean journal)
 
 	tracker_data_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
 	                           (const gchar **) test_schemas,
-	                           NULL, FALSE, NULL, NULL, NULL);
+	                           NULL, FALSE, 100, 100, NULL, NULL, NULL);
 	check_content_in_db (0, 0);
 
 	test_schemas[0] = data_prefix;
diff --git a/tests/libtracker-data/tracker-ontology-change-test.c b/tests/libtracker-data/tracker-ontology-change-test.c
index 9ae8beb..1543258 100644
--- a/tests/libtracker-data/tracker-ontology-change-test.c
+++ b/tests/libtracker-data/tracker-ontology-change-test.c
@@ -246,7 +246,7 @@ test_ontology_change (void)
 		g_chmod (ontology_file, 0666);
 
 		tracker_data_manager_init (0, (const gchar **) test_schemas,
-		                           NULL, FALSE, NULL, NULL, NULL);
+		                           NULL, FALSE, 100, 100, NULL, NULL, NULL);
 
 		if (g_file_get_contents (update, &queries, NULL, NULL)) {
 			gchar *query = strtok (queries, "\n");
@@ -287,7 +287,7 @@ test_ontology_change (void)
 	delete_db (FALSE);
 
 	tracker_data_manager_init (0, (const gchar **) test_schemas,
-	                           NULL, TRUE, NULL, NULL, NULL);
+	                           NULL, TRUE, 100, 100, NULL, NULL, NULL);
 
 	for (i = 0; change_tests[i].test_name != NULL; i++) {
 		gchar *query_filename;
diff --git a/tests/libtracker-data/tracker-ontology-test.c b/tests/libtracker-data/tracker-ontology-test.c
index 5ff4b7a..cc340ef 100644
--- a/tests/libtracker-data/tracker-ontology-test.c
+++ b/tests/libtracker-data/tracker-ontology-test.c
@@ -197,6 +197,8 @@ test_ontology_init (void)
 	                           NULL,
 	                           NULL,
 	                           FALSE,
+	                           100,
+	                           100,
 	                           NULL,
 	                           NULL,
 	                           NULL);
@@ -210,6 +212,8 @@ test_ontology_init (void)
 	                           NULL,
 	                           NULL,
 	                           FALSE,
+	                           100,
+	                           100,
 	                           NULL,
 	                           NULL,
 	                           NULL);
@@ -243,6 +247,8 @@ test_query (gconstpointer test_data)
 	                           NULL,
 	                           NULL,
 	                           FALSE,
+	                           100,
+	                           100,
 	                           NULL,
 	                           NULL,
 	                           NULL);
diff --git a/tests/libtracker-data/tracker-sparql-blank-test.c b/tests/libtracker-data/tracker-sparql-blank-test.c
index e4850f0..ec14117 100644
--- a/tests/libtracker-data/tracker-sparql-blank-test.c
+++ b/tests/libtracker-data/tracker-sparql-blank-test.c
@@ -46,6 +46,8 @@ test_blank (void)
 	                           NULL,
 	                           NULL,
 	                           FALSE,
+	                           100,
+	                           100,
 	                           NULL,
 	                           NULL,
 	                           NULL);
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index d84a6b6..0380e56 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -250,7 +250,7 @@ test_sparql_query (gconstpointer test_data)
 
 	tracker_data_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
 	                           test_schemas,
-	                           NULL, FALSE, NULL, NULL, NULL);
+	                           NULL, FALSE, 100, 100, NULL, NULL, NULL);
 
 	/* data_path = g_build_path (G_DIR_SEPARATOR_S, TOP_SRCDIR, "tests", "libtracker-data", NULL); */
 
diff --git a/tests/libtracker-fts/tracker-fts-test.c b/tests/libtracker-fts/tracker-fts-test.c
index 333041d..6f93212 100644
--- a/tests/libtracker-fts/tracker-fts-test.c
+++ b/tests/libtracker-fts/tracker-fts-test.c
@@ -74,7 +74,7 @@ test_sparql_query (gconstpointer test_data)
 	tracker_db_journal_set_rotating (FALSE, G_MAXSIZE, NULL);
 	tracker_data_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
 	                           test_schemas,
-	                           NULL, FALSE, NULL, NULL, NULL);
+	                           NULL, FALSE, 100, 100, NULL, NULL, NULL);
 
 	/* load data / perform updates */
 



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