tracker r1439 - in branches/indexer-split: . data src/libtracker-common src/libtracker-db src/tracker-search-tool src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1439 - in branches/indexer-split: . data src/libtracker-common src/libtracker-db src/tracker-search-tool src/trackerd
- Date: Fri, 16 May 2008 16:35:24 +0100 (BST)
Author: pvanhoof
Date: Fri May 16 15:35:23 2008
New Revision: 1439
URL: http://svn.gnome.org/viewvc/tracker?rev=1439&view=rev
Log:
2008-05-16 Philip Van Hoof <pvanhoof gnome org>
* Merge from our own repository back to GNOME's Subversion server. We
did this because caused by the SSH exploit, the GNOME Subversion
servers were closed for commit access.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/data/sqlite-stored-procs.sql
branches/indexer-split/src/libtracker-common/tracker-config.c
branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c
branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.h
branches/indexer-split/src/libtracker-db/tracker-db-interface.c
branches/indexer-split/src/libtracker-db/tracker-db-interface.h
branches/indexer-split/src/tracker-search-tool/tracker-search-tool.c
branches/indexer-split/src/trackerd/tracker-db-sqlite.c
branches/indexer-split/src/trackerd/tracker-db-sqlite.h
branches/indexer-split/src/trackerd/tracker-dbus-daemon.c
branches/indexer-split/src/trackerd/tracker-dbus.c
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-main.h
branches/indexer-split/src/trackerd/tracker-process-files.c
Modified: branches/indexer-split/data/sqlite-stored-procs.sql
==============================================================================
--- branches/indexer-split/data/sqlite-stored-procs.sql (original)
+++ branches/indexer-split/data/sqlite-stored-procs.sql Fri May 16 15:35:23 2008
@@ -76,7 +76,7 @@
DeleteEmbeddedServiceMetadata2 DELETE FROM ServiceKeywordMetaData WHERE ServiceID = ? and MetaDataID in (select ID from MetaDataTypes where Embedded = 1);
DeleteEmbeddedServiceMetadata3 DELETE FROM ServiceNumericMetaData WHERE ServiceID = ? and MetaDataID in (select ID from MetaDataTypes where Embedded = 1);
-GetByServiceType SELECT DISTINCT F.Path || '/' || F.Name as uri FROM Services F WHERE F.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = ? or Parent = ?) LIMIT ?,?;
+GetByServiceType SELECT DISTINCT F.Path || '/' || F.Name as uri FROM Services F WHERE F.ServiceTypeID in (select TypeId from common.ServiceTypes where TypeName = ? or Parent = ?) LIMIT ?,?;
SaveServiceContents REPLACE into ServiceContents (ServiceID, MetadataID, Content) values (?,?,?);
DeleteContent DELETE FROM ServiceContents where ServiceID = ? and MetadataId = ?;
Modified: branches/indexer-split/src/libtracker-common/tracker-config.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-config.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-config.c Fri May 16 15:35:23 2008
@@ -455,7 +455,7 @@
DEFAULT_MAX_TEXT_TO_INDEX,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
- PROP_MAX_TEXT_TO_INDEX,
+ PROP_MAX_WORDS_TO_INDEX,
g_param_spec_int ("max-words-to-index",
"Maximum words to index",
"Maximum unique words to index "
@@ -2258,7 +2258,7 @@
priv = GET_PRIV (config);
priv->max_text_to_index = value;
- g_object_notify (G_OBJECT (config), "max_text_to_index");
+ g_object_notify (G_OBJECT (config), "max-text-to-index");
}
void
@@ -2276,7 +2276,7 @@
priv = GET_PRIV (config);
priv->max_words_to_index = value;
- g_object_notify (G_OBJECT (config), "max_words_to_index");
+ g_object_notify (G_OBJECT (config), "max-words-to-index");
}
void
@@ -2401,7 +2401,7 @@
priv = GET_PRIV (config);
- priv->padding = value;
+ priv->thread_stack_size = value;
g_object_notify (G_OBJECT (config), "thread-stack-size");
}
Modified: branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c Fri May 16 15:35:23 2008
@@ -17,6 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
+#include <sqlite3.h>
#include "tracker-db-interface-sqlite.h"
#define TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_INTERFACE_SQLITE, TrackerDBInterfaceSqlitePrivate))
@@ -24,26 +25,6 @@
typedef struct TrackerDBInterfaceSqlitePrivate TrackerDBInterfaceSqlitePrivate;
typedef struct SqliteFunctionData SqliteFunctionData;
-typedef enum {
- QUERY,
- PROCEDURE,
- PROCEDURE_LEN
-}TrackerDBQueryType;
-
-typedef struct {
- GError **error;
- TrackerDBResultSet *retval;
- gboolean nowait;
- va_list args;
- gchar *query;
- GObject *iface;
- TrackerDBQueryType type;
-
- GCond* condition;
- gboolean had_callback;
- GMutex *mutex;
-} TrackerDBQueryTask;
-
struct TrackerDBInterfaceSqlitePrivate {
gchar *filename;
sqlite3 *db;
@@ -54,8 +35,6 @@
GSList *function_data;
guint in_transaction : 1;
-
- GThreadPool *pool;
};
struct SqliteFunctionData {
@@ -63,15 +42,12 @@
TrackerDBFunc func;
};
-
static void tracker_db_interface_sqlite_iface_init (TrackerDBInterfaceIface *iface);
-static void free_db_query_task (TrackerDBQueryTask *task);
enum {
PROP_0,
PROP_FILENAME,
- PROP_IN_TRANSACTION,
- PROP_POOL
+ PROP_IN_TRANSACTION
};
G_DEFINE_TYPE_WITH_CODE (TrackerDBInterfaceSqlite, tracker_db_interface_sqlite, G_TYPE_OBJECT,
@@ -119,9 +95,6 @@
case PROP_IN_TRANSACTION:
priv->in_transaction = g_value_get_boolean (value);
break;
- case PROP_POOL:
- priv->pool = g_value_get_pointer (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -144,9 +117,6 @@
case PROP_IN_TRANSACTION:
g_value_set_boolean (value, priv->in_transaction);
break;
- case PROP_POOL:
- g_value_set_pointer (value, priv->pool);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -194,13 +164,6 @@
PROP_IN_TRANSACTION,
"in-transaction");
- g_object_class_install_property (object_class,
- PROP_POOL,
- g_param_spec_pointer ("pool",
- "DB thread pool",
- "Database connection pool",
- G_PARAM_WRITABLE|G_PARAM_READABLE));
-
g_type_class_add_private (object_class,
sizeof (TrackerDBInterfaceSqlitePrivate));
}
@@ -212,15 +175,12 @@
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
- priv->pool = NULL;
-
priv->procedures = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_free);
priv->statements = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) sqlite3_finalize);
-
}
static void
@@ -469,162 +429,6 @@
return stmt;
}
-
-void
-tracker_db_interface_sqlite_process_query (gpointer data, gpointer user_data)
-{
- TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBQueryTask *task = (TrackerDBQueryTask *) data;
- gboolean finalize_stmt = FALSE;
- sqlite3_stmt *stmt = NULL;
-
- priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (task->iface);
-
- switch (task->type) {
- case QUERY: {
- /* If it's a plain query, no need for argument checking */
-
- sqlite3_prepare_v2 (priv->db, task->query, -1, &stmt, NULL);
-
- if (!stmt) {
- g_set_error (task->error,
- TRACKER_DB_INTERFACE_ERROR,
- TRACKER_DB_QUERY_ERROR,
- sqlite3_errmsg (priv->db));
-
- goto ending;
- }
-
- /* If the stmt was created, we must free it up later, since
- * unlike with procedures, we don't cache the stmt */
-
- finalize_stmt = TRUE;
- } break;
- case PROCEDURE_LEN: {
- /* If it's a procedure called with _len argument passing */
-
- gint stmt_args, n_args, len;
- gchar *str;
-
- stmt = get_stored_stmt (TRACKER_DB_INTERFACE_SQLITE (task->iface), task->query);
- stmt_args = sqlite3_bind_parameter_count (stmt);
- n_args = 1;
-
- while ((str = va_arg (task->args, gchar *)) != NULL) {
- len = va_arg (task->args, gint);
-
- if (len == -1) {
- /* Assume we're dealing with strings */
- sqlite3_bind_text (stmt, n_args, str, len, SQLITE_STATIC);
- } else {
- /* Deal with it as a blob */
- sqlite3_bind_blob (stmt, n_args, str, len, SQLITE_STATIC);
- }
-
- n_args++;
- }
-
- /* Just panic if the number of arguments don't match */
- g_assert (n_args != stmt_args);
- } break;
- default:
- case PROCEDURE: {
- /* If it's a normal procedure with normal argument passing */
- gchar *str;
- gint stmt_args, n_args;
-
- stmt = get_stored_stmt (TRACKER_DB_INTERFACE_SQLITE (task->iface), task->query);
- stmt_args = sqlite3_bind_parameter_count (stmt);
- n_args = 1;
-
- while ((str = va_arg (task->args, gchar *)) != NULL) {
- sqlite3_bind_text (stmt, n_args, str, -1, SQLITE_STATIC);
- n_args++;
- }
-
- /* Just panic if the number of arguments don't match */
- g_assert (n_args != stmt_args);
- } break;
- }
-
- /* If any of those three cases, execute the stmt */
-
- task->retval = create_result_set_from_stmt (
- TRACKER_DB_INTERFACE_SQLITE (task->iface),
- stmt,
- task->error);
-
-ending:
-
- if (!task->nowait) {
- /* If we are a blocking call, the caller will freeup and
- * might consume the retval */
-
- g_mutex_lock (task->mutex);
- g_cond_broadcast (task->condition);
- task->had_callback = TRUE;
- g_mutex_unlock (task->mutex);
-
- } else {
- /* If not we freeup the retval, of course */
-
- if (task->retval)
- g_object_unref (task->retval);
- free_db_query_task (task);
- }
-
- /* In case we were a succeeded query (procedures's stmt are cached) */
-
- if (finalize_stmt)
- sqlite3_finalize (stmt);
-}
-
-static TrackerDBQueryTask*
-create_db_query_task (TrackerDBInterface *iface, const gchar *query, TrackerDBQueryType type, va_list args, GError **error)
-{
- TrackerDBQueryTask *task = g_slice_new (TrackerDBQueryTask);
-
- /* GCond infrastructure */
- task->mutex = g_mutex_new ();
- task->condition = g_cond_new ();
- task->had_callback = FALSE;
-
- /* Must set */
- task->error = error;
- task->iface = g_object_ref (iface);
- task->type = type;
- task->query = g_strdup (query);
- task->args = args;
-
- /* Defaults */
- task->nowait = FALSE;
-
- return task;
-}
-
-static void
-wait_for_db_query_task (TrackerDBQueryTask *task)
-{
- /* This simply waits for the GCond to become broadcasted */
-
- g_mutex_lock (task->mutex);
- if (!task->had_callback)
- g_cond_wait (task->condition, task->mutex);
- g_mutex_unlock (task->mutex);
-}
-
-static void
-free_db_query_task (TrackerDBQueryTask *task)
-{
- /* Freeing up resources of a db-query-task */
-
- g_free (task->query);
- g_object_unref (task->iface);
- g_mutex_free (task->mutex);
- g_cond_free (task->condition);
- g_slice_free (TrackerDBQueryTask, task);
-}
-
static TrackerDBResultSet *
tracker_db_interface_sqlite_execute_procedure (TrackerDBInterface *db_interface,
GError **error,
@@ -632,55 +436,26 @@
va_list args)
{
TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBResultSet *retval;
- TrackerDBQueryTask *task;
+ sqlite3_stmt *stmt;
+ gint stmt_args, n_args;
+ gchar *str;
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
+ stmt = get_stored_stmt (TRACKER_DB_INTERFACE_SQLITE (db_interface), procedure_name);
+ stmt_args = sqlite3_bind_parameter_count (stmt);
+ n_args = 1;
- task = create_db_query_task (db_interface,
- procedure_name,
- PROCEDURE,
- args,
- error);
-
- g_thread_pool_push (priv->pool, task, NULL);
- wait_for_db_query_task (task);
- retval = task->retval;
- free_db_query_task (task);
-
- return retval;
-}
-
-
-
-static void
-tracker_db_interface_sqlite_execute_procedure_no_reply (TrackerDBInterface *db_interface,
- GError **error,
- const gchar *procedure_name,
- va_list args)
-{
- TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBQueryTask *task;
-
- priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
+ while ((str = va_arg (args, gchar *)) != NULL) {
+ sqlite3_bind_text (stmt, n_args, str, -1, SQLITE_STATIC);
+ n_args++;
+ }
- task = create_db_query_task (db_interface,
- procedure_name,
- PROCEDURE,
- args,
- error);
-
- g_thread_pool_push (priv->pool, task, NULL);
-
- wait_for_db_query_task (task);
- if (task->retval)
- g_object_unref (task->retval);
- free_db_query_task (task);
+ /* Just panic if the number of arguments don't match */
+ g_assert (n_args != stmt_args);
- return;
+ return create_result_set_from_stmt (TRACKER_DB_INTERFACE_SQLITE (db_interface), stmt, error);
}
-
static TrackerDBResultSet *
tracker_db_interface_sqlite_execute_procedure_len (TrackerDBInterface *db_interface,
GError **error,
@@ -688,25 +463,33 @@
va_list args)
{
TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBResultSet *retval;
- TrackerDBQueryTask *task;
+ sqlite3_stmt *stmt;
+ gint stmt_args, n_args, len;
+ gchar *str;
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
+ stmt = get_stored_stmt (TRACKER_DB_INTERFACE_SQLITE (db_interface), procedure_name);
+ stmt_args = sqlite3_bind_parameter_count (stmt);
+ n_args = 1;
+
+ while ((str = va_arg (args, gchar *)) != NULL) {
+ len = va_arg (args, gint);
+
+ if (len == -1) {
+ /* Assume we're dealing with strings */
+ sqlite3_bind_text (stmt, n_args, str, len, SQLITE_STATIC);
+ } else {
+ /* Deal with it as a blob */
+ sqlite3_bind_blob (stmt, n_args, str, len, SQLITE_STATIC);
+ }
- task = create_db_query_task (db_interface,
- procedure_name,
- PROCEDURE_LEN,
- args,
- error);
-
- g_thread_pool_push (priv->pool, task, NULL);
-
- wait_for_db_query_task (task);
- retval = task->retval;
+ n_args++;
+ }
- free_db_query_task (task);
+ /* Just panic if the number of arguments don't match */
+ g_assert (n_args != stmt_args);
- return retval;
+ return create_result_set_from_stmt (TRACKER_DB_INTERFACE_SQLITE (db_interface), stmt, error);
}
static TrackerDBResultSet *
@@ -715,50 +498,25 @@
const gchar *query)
{
TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBResultSet *retval;
- TrackerDBQueryTask *task;
+ TrackerDBResultSet *result_set;
+ sqlite3_stmt *stmt;
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
- task = create_db_query_task (db_interface,
- query,
- QUERY,
- NULL,
- error);
-
- g_thread_pool_push (priv->pool, task, NULL);
+ sqlite3_prepare_v2 (priv->db, query, -1, &stmt, NULL);
- wait_for_db_query_task (task);
- retval = task->retval;
-
- free_db_query_task (task);
-
- return retval;
-
-}
-
-static void
-tracker_db_interface_sqlite_execute_query_no_reply (TrackerDBInterface *db_interface,
- GError **error,
- const gchar *query)
-{
- TrackerDBInterfaceSqlitePrivate *priv;
- TrackerDBQueryTask *task;
+ if (!stmt) {
+ g_set_error (error,
+ TRACKER_DB_INTERFACE_ERROR,
+ TRACKER_DB_QUERY_ERROR,
+ sqlite3_errmsg (priv->db));
+ return NULL;
+ }
- priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
+ result_set = create_result_set_from_stmt (TRACKER_DB_INTERFACE_SQLITE (db_interface), stmt, error);
+ sqlite3_finalize (stmt);
- task = create_db_query_task (db_interface,
- query,
- QUERY,
- NULL,
- error);
-
- g_thread_pool_push (priv->pool, task, NULL);
-
- wait_for_db_query_task (task);
- if (task->retval)
- g_object_unref (task->retval);
- free_db_query_task (task);
+ return result_set;
}
static void
@@ -766,17 +524,15 @@
{
iface->set_procedure_table = tracker_db_interface_sqlite_set_procedure_table;
iface->execute_procedure = tracker_db_interface_sqlite_execute_procedure;
- iface->execute_procedure_no_reply = tracker_db_interface_sqlite_execute_procedure_no_reply;
iface->execute_procedure_len = tracker_db_interface_sqlite_execute_procedure_len;
iface->execute_query = tracker_db_interface_sqlite_execute_query;
- iface->execute_query_no_reply = tracker_db_interface_sqlite_execute_query_no_reply;
}
TrackerDBInterface *
-tracker_db_interface_sqlite_new (const gchar *filename, GThreadPool *pool)
+tracker_db_interface_sqlite_new (const gchar *filename)
{
return g_object_new (TRACKER_TYPE_DB_INTERFACE_SQLITE,
- "filename", filename, "pool", pool,
+ "filename", filename,
NULL);
}
Modified: branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.h
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.h (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.h Fri May 16 15:35:23 2008
@@ -20,8 +20,6 @@
#ifndef __TRACKER_DB_INTERFACE_SQLITE_H__
#define __TRACKER_DB_INTERFACE_SQLITE_H__
-#include <sqlite3.h>
-
#include "tracker-db-interface.h"
G_BEGIN_DECLS
@@ -33,7 +31,6 @@
#define TRACKER_IS_DB_INTERFACE_SQLITE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((o), TRACKER_TYPE_DB_INTERFACE_SQLITE))
#define TRACKER_DB_INTERFACE_SQLITE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_DB_INTERFACE_SQLITE, TrackerDBInterfaceSqliteClass))
-
typedef struct TrackerDBInterfaceSqlite TrackerDBInterfaceSqlite;
typedef struct TrackerDBInterfaceSqliteClass TrackerDBInterfaceSqliteClass;
@@ -55,7 +52,7 @@
GType tracker_db_interface_sqlite_get_type (void);
-TrackerDBInterface * tracker_db_interface_sqlite_new (const gchar *filename, GThreadPool *pool);
+TrackerDBInterface * tracker_db_interface_sqlite_new (const gchar *filename);
void tracker_db_interface_sqlite_create_function (TrackerDBInterface *interface,
const gchar *name,
@@ -67,7 +64,6 @@
gint64 tracker_db_interface_sqlite_get_last_insert_id (TrackerDBInterfaceSqlite *interface);
-void tracker_db_interface_sqlite_process_query (gpointer data, gpointer user_data);
G_END_DECLS
Modified: branches/indexer-split/src/libtracker-db/tracker-db-interface.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-interface.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-interface.c Fri May 16 15:35:23 2008
@@ -255,27 +255,6 @@
}
-void
-tracker_db_interface_execute_vquery_no_reply (TrackerDBInterface *interface,
- GError **error,
- const gchar *query,
- va_list args)
-{
- gchar *str;
-
- g_return_if_fail (TRACKER_IS_DB_INTERFACE (interface));
- g_return_if_fail (query != NULL);
-
- if (!TRACKER_DB_INTERFACE_GET_IFACE (interface)->execute_query_no_reply) {
- g_critical ("Database abstraction %s doesn't implement the method execute_vquery()", G_OBJECT_TYPE_NAME (interface));
- return;
- }
-
- str = g_strdup_vprintf (query, args);
- TRACKER_DB_INTERFACE_GET_IFACE (interface)->execute_query_no_reply (interface, error, str);
- g_free (str);
-}
-
TrackerDBResultSet *
tracker_db_interface_execute_query (TrackerDBInterface *interface,
@@ -330,23 +309,6 @@
}
-void
-tracker_db_interface_execute_vprocedure_no_reply (TrackerDBInterface *interface,
- GError **error,
- const gchar *procedure,
- va_list args)
-{
- g_return_if_fail (TRACKER_IS_DB_INTERFACE (interface));
- g_return_if_fail (procedure != NULL);
-
- if (!TRACKER_DB_INTERFACE_GET_IFACE (interface)->execute_procedure_no_reply) {
- g_critical ("Database abstraction %s doesn't implement the method execute_procedure()", G_OBJECT_TYPE_NAME (interface));
- return;
- }
-
- TRACKER_DB_INTERFACE_GET_IFACE (interface)->execute_procedure_no_reply (interface, error, procedure, args);
-}
-
TrackerDBResultSet *
tracker_db_interface_execute_vprocedure_len (TrackerDBInterface *interface,
Modified: branches/indexer-split/src/libtracker-db/tracker-db-interface.h
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-interface.h (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-interface.h Fri May 16 15:35:23 2008
@@ -59,11 +59,6 @@
GError **error,
const gchar *procedure,
va_list args);
- void (* execute_procedure_no_reply)
- (TrackerDBInterface *interface,
- GError **error,
- const gchar *procedure,
- va_list args);
TrackerDBResultSet * (* execute_procedure_len) (TrackerDBInterface *interface,
GError **error,
const gchar *procedure,
@@ -71,9 +66,6 @@
TrackerDBResultSet * (* execute_query) (TrackerDBInterface *interface,
GError **error,
const gchar *query);
- void (* execute_query_no_reply)(TrackerDBInterface *interface,
- GError **error,
- const gchar *query);
};
@@ -98,11 +90,6 @@
GError **error,
const gchar *query,
va_list args);
-void tracker_db_interface_execute_vquery_no_reply
- (TrackerDBInterface *interface,
- GError **error,
- const gchar *query,
- va_list args);
TrackerDBResultSet * tracker_db_interface_execute_query (TrackerDBInterface *interface,
GError **error,
const gchar *query,
@@ -113,11 +100,6 @@
GError **error,
const gchar *procedure,
va_list args);
-void tracker_db_interface_execute_vprocedure_no_reply
- (TrackerDBInterface *interface,
- GError **error,
- const gchar *procedure,
- va_list args);
TrackerDBResultSet * tracker_db_interface_execute_procedure (TrackerDBInterface *interface,
GError **error,
const gchar *procedure,
Modified: branches/indexer-split/src/tracker-search-tool/tracker-search-tool.c
==============================================================================
--- branches/indexer-split/src/tracker-search-tool/tracker-search-tool.c (original)
+++ branches/indexer-split/src/tracker-search-tool/tracker-search-tool.c Fri May 16 15:35:23 2008
@@ -123,6 +123,9 @@
"Contacts",
"Emails",
"EmailAttachments",
+"EvolutionEmails",
+"ModestEmails",
+"ThunderbirdEmails",
"Appointments",
"Tasks",
"Bookmarks",
@@ -131,9 +134,13 @@
NULL
};
-static service_info_t services[13] = {
-
+static service_info_t services[16] = {
{ "Emails", N_("Emails"), "stock_mail", NULL, SERVICE_EMAILS, NULL, FALSE, 0, 0},
+ { "EvolutionEmails",
+ N_("Emails"), "stock_mail", NULL, SERVICE_EMAILS, NULL, FALSE, 0, 0},
+ { "ModestEmails", N_("Emails"), "stock_mail", NULL, SERVICE_EMAILS, NULL, FALSE, 0, 0},
+ { "ThunderbirdEmails",
+ N_("Emails"), "stock_mail", NULL, SERVICE_EMAILS, NULL, FALSE, 0, 0},
{ "Files", N_("All Files"), "system-file-manager", NULL, SERVICE_FILES, NULL, FALSE, 0, 0},
{ "Folders", N_("Folders"), "folder", NULL, SERVICE_FOLDERS, NULL, FALSE, 0, 0},
{ "Documents", N_("Documents"), "x-office-document", NULL, SERVICE_DOCUMENTS, NULL, FALSE, 0, 0},
Modified: branches/indexer-split/src/trackerd/tracker-db-sqlite.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db-sqlite.c (original)
+++ branches/indexer-split/src/trackerd/tracker-db-sqlite.c Fri May 16 15:35:23 2008
@@ -874,19 +874,6 @@
}
-/* TODO: refactor this to a better location. This is the threadpool shared by
- * all SQLite connections. I noticed that having a thread per connection is
- * not sufficient. All statements must happen sequential ... */
-
-static GThreadPool *pool = NULL;
-
-/* TODO: the rafactor to a better location should perform this at-exit. For
- * example when the desktop-session alarms that the system is shutting down,
- * and when the trackerd process is exiting.
- *
- * g_thread_pool_free (priv->pool, TRUE, TRUE);
- **/
-
/*
* If the file doesnt exist, creates a new file of size 0
*/
@@ -896,16 +883,12 @@
TrackerDBInterface *iface;
const gchar *dbname;
- if (!pool) {
- pool = g_thread_pool_new (tracker_db_interface_sqlite_process_query,
- NULL, 1, TRUE, NULL);
- }
dbname = tracker_db_manager_get_file (database);
/* We pass a GThreadPool here, it should be the same pool for all opened
* SQLite databases */
- iface = tracker_db_interface_sqlite_new (dbname, pool);
+ iface = tracker_db_interface_sqlite_new (dbname);
tracker_db_interface_set_procedure_table (iface, prepared_queries);
@@ -972,9 +955,55 @@
DBConnection *emails_db_con= NULL;
Indexer *email_word_index_db_con= NULL;
- db_con = tracker_db_connect ();
+ db_con = tracker_db_connect_file_meta ();
+ emails_db_con = tracker_db_connect_email_meta ();
+
+ blob_db_con = tracker_db_connect_file_content ();
+ emails_blob_db_con = tracker_db_connect_email_content ();
+ common_db_con = tracker_db_connect_common ();
+
+ word_index_db_con = tracker->file_index;
+ email_word_index_db_con = tracker->email_index;
+
+ db_con->cache = tracker_db_connect_cache ();
+
+ db_con->blob = blob_db_con;
+ db_con->data = db_con;
+ db_con->emails = emails_db_con;
+ db_con->common = common_db_con;
+ db_con->word_index = word_index_db_con;
+
+ emails_db_con->common = common_db_con;
+ emails_db_con->blob = emails_blob_db_con;
+ emails_db_con->data = db_con;
+ emails_db_con->word_index = email_word_index_db_con;
+ emails_db_con->cache = db_con->cache;
+
+ tracker_db_attach_db (db_con, TRACKER_DB_COMMON);
+ tracker_db_attach_db (db_con, TRACKER_DB_CACHE);
+
+ return db_con;
+
+}
+
+
+
+/* convenience function for process files thread */
+DBConnection *
+tracker_db_connect_xesam ()
+{
+
+ DBConnection *db_con;
+ DBConnection *blob_db_con = NULL;
+ Indexer *word_index_db_con = NULL;
+
+ DBConnection *common_db_con = NULL;
+
+ DBConnection *emails_blob_db_con = NULL;
+ DBConnection *emails_db_con= NULL;
+ Indexer *email_word_index_db_con= NULL;
- // db_con = tracker_db_connect_file_meta ();
+ db_con = tracker_db_connect_file_meta ();
emails_db_con = tracker_db_connect_email_meta ();
blob_db_con = tracker_db_connect_file_content ();
@@ -997,6 +1026,9 @@
emails_db_con->data = db_con;
emails_db_con->word_index = email_word_index_db_con;
emails_db_con->cache = db_con->cache;
+
+ tracker_db_attach_db (db_con, TRACKER_DB_COMMON);
+ tracker_db_attach_db (db_con, TRACKER_DB_CACHE);
return db_con;
@@ -1393,13 +1425,16 @@
gboolean
tracker_db_exec_no_reply (TrackerDBInterface *iface, const char *query, ...)
{
+ TrackerDBResultSet *result_set;
va_list args;
tracker_nfs_lock_obtain ();
va_start (args, query);
- tracker_db_interface_execute_vquery_no_reply (iface, NULL, query, args);
+ result_set = tracker_db_interface_execute_vquery (iface, NULL, query, args);
va_end (args);
+ if (result_set)
+ g_object_unref (result_set);
tracker_nfs_lock_release ();
@@ -1454,11 +1489,14 @@
static gboolean
tracker_exec_proc_no_reply (TrackerDBInterface *iface, const char *procedure, ...)
{
+ TrackerDBResultSet *result_set;
va_list args;
va_start (args, procedure);
- tracker_db_interface_execute_vprocedure_no_reply (iface, NULL, procedure, args);
+ result_set = tracker_db_interface_execute_vprocedure (iface, NULL, procedure, args);
va_end (args);
+ if (result_set)
+ g_object_unref (result_set);
return TRUE;
}
@@ -1971,7 +2009,7 @@
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config));
- result_set = tracker_exec_proc (db_con->common, "GetRelatedServiceIDs", service, service, NULL);
+ result_set = tracker_exec_proc (db_con, "GetRelatedServiceIDs", service, service, NULL);
if (result_set) {
gboolean valid = TRUE;
Modified: branches/indexer-split/src/trackerd/tracker-db-sqlite.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db-sqlite.h (original)
+++ branches/indexer-split/src/trackerd/tracker-db-sqlite.h Fri May 16 15:35:23 2008
@@ -107,6 +107,7 @@
DBConnection * tracker_db_connect_email_meta (void);
DBConnection * tracker_db_connect_file_meta (void);
DBConnection * tracker_db_connect_all (void);
+DBConnection * tracker_db_connect_xesam (void);
void tracker_db_close_all (DBConnection *db_con);
void tracker_db_refresh_all (DBConnection *db_con);
void tracker_db_refresh_email (DBConnection *db_con);
Modified: branches/indexer-split/src/trackerd/tracker-dbus-daemon.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus-daemon.c (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus-daemon.c Fri May 16 15:35:23 2008
@@ -387,7 +387,7 @@
tracker_dbus_request_new (request_id,
"DBus request to get daemon service stats");
- result_set = tracker_exec_proc (db_con->common, "GetStats", 0);
+ result_set = tracker_exec_proc (db_con, "GetStats", 0);
*values = tracker_dbus_query_result_to_ptr_array (result_set);
if (result_set) {
Modified: branches/indexer-split/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.c (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.c Fri May 16 15:35:23 2008
@@ -169,7 +169,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
g_object_set (object, "config", tracker->config, NULL);
g_object_set (object, "tracker", tracker, NULL);
objects = g_slist_prepend (objects, object);
@@ -183,7 +183,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Keywords */
@@ -195,7 +195,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Metadata */
@@ -207,7 +207,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Search */
@@ -219,7 +219,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
g_object_set (object, "config", tracker->config, NULL);
g_object_set (object, "language", tracker->language, NULL);
g_object_set (object, "file-index", tracker->file_index, NULL);
@@ -236,7 +236,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->index_db, NULL);
+ g_object_set (object, "db-connection", tracker->xesam_db, NULL);
dbus_g_proxy_add_signal (proxy, "NameOwnerChanged",
G_TYPE_STRING, G_TYPE_STRING,
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Fri May 16 15:35:23 2008
@@ -141,7 +141,7 @@
static gboolean fatal_errors;
static gboolean low_memory;
static gint throttle = -1;
-static gint verbosity;
+static gint verbosity = -1;
static gint initial_sleep = -1;
static GOptionEntry entries[] = {
@@ -299,6 +299,18 @@
no_index_file_types = tracker_config_get_no_index_file_types (tracker->config);
+ if (!tracker_config_get_low_memory_mode (tracker->config)) {
+ tracker->memory_limit = 16000 *1024;
+
+ tracker->max_process_queue_size = 5000;
+ tracker->max_extract_queue_size = 5000;
+ } else {
+ tracker->memory_limit = 8192 * 1024;
+
+ tracker->max_process_queue_size = 500;
+ tracker->max_extract_queue_size = 500;
+ }
+
tracker_log ("Tracker configuration options:");
tracker_log (" Verbosity ............................ %d",
tracker_config_get_verbosity (tracker->config));
@@ -318,36 +330,49 @@
tracker_log ("Tracker indexer parameters:");
tracker_log (" Indexer language code ................ %s",
tracker_config_get_language (tracker->config));
- tracker_log (" Minimum index word length ............ %d",
- tracker_config_get_min_word_length (tracker->config));
- tracker_log (" Maximum index word length ............ %d",
- tracker_config_get_max_word_length (tracker->config));
tracker_log (" Stemmer enabled ...................... %s",
tracker_config_get_enable_stemmer (tracker->config) ? "yes" : "no");
+ tracker_log (" Fast merges enabled .................. %s",
+ tracker_config_get_fast_merges (tracker->config) ? "yes" : "no");
+ tracker_log (" Disable indexing on battery............ %s (initially = %s)",
+ tracker_config_get_disable_indexing_on_battery (tracker->config) ? "yes" : "no",
+ tracker_config_get_disable_indexing_on_battery_init (tracker->config) ? "yes" : "no");
- tracker->word_count = 0;
- tracker->word_detail_count = 0;
- tracker->word_update_count = 0;
-
- if (!tracker_config_get_low_memory_mode (tracker->config)) {
- tracker->memory_limit = 16000 *1024;
-
- tracker->max_process_queue_size = 5000;
- tracker->max_extract_queue_size = 5000;
+ if (tracker_config_get_low_disk_space_limit (tracker->config) == -1) {
+ tracker_log (" Low disk space limit .................. Disabled");
} else {
- tracker->memory_limit = 8192 * 1024;
-
- tracker->max_process_queue_size = 500;
- tracker->max_extract_queue_size = 500;
+ tracker_log (" Low disk space limit .................. %d%%",
+ tracker_config_get_low_disk_space_limit (tracker->config));
}
+ tracker_log (" Minimum index word length ............ %d",
+ tracker_config_get_min_word_length (tracker->config));
+ tracker_log (" Maximum index word length ............ %d",
+ tracker_config_get_max_word_length (tracker->config));
+ tracker_log (" Maximum text to index ................. %d",
+ tracker_config_get_max_text_to_index (tracker->config));
+ tracker_log (" Maximum words to index ................ %d",
+ tracker_config_get_max_words_to_index (tracker->config));
+ tracker_log (" Maximum bucket count .................. %d",
+ tracker_config_get_max_bucket_count (tracker->config));
+ tracker_log (" Minimum bucket count .................. %d",
+ tracker_config_get_min_bucket_count (tracker->config));
+ tracker_log (" Divisions ............................. %d",
+ tracker_config_get_divisions (tracker->config));
+ tracker_log (" Padding ............................... %d",
+ tracker_config_get_padding (tracker->config));
+ tracker_log (" Optimization sweep count .............. %d",
+ tracker_config_get_optimization_sweep_count (tracker->config));
+ tracker_log (" Thread stack size ..................... %d",
+ tracker_config_get_thread_stack_size (tracker->config));
+ tracker_log (" Throttle level ........................ %d",
+ tracker_config_get_throttle (tracker->config));
+
log_option_list (watch_directory_roots, "Watching directory roots");
log_option_list (crawl_directory_roots, "Crawling directory roots");
log_option_list (no_watch_directory_roots, "NOT watching directory roots");
log_option_list (no_index_file_types, "NOT indexing file types");
- tracker_log ("Throttle level is %d\n", tracker_config_get_throttle (tracker->config));
-
tracker->metadata_table = g_hash_table_new_full (g_str_hash,
g_str_equal,
NULL,
@@ -574,8 +599,10 @@
}
/* Create connections */
- db_con->cache = tracker_db_connect_cache ();
- db_con->common = tracker_db_connect_common ();
+ // you shouldn't have to do this at all !
+ // In fact, it's even terribly wrong to do this!
+ //db_con->cache = tracker_db_connect_cache ();
+ //db_con->common = tracker_db_connect_common ();
main_thread_db_con = db_con;
@@ -879,6 +906,48 @@
tracker->config = tracker_config_new ();
tracker->language = tracker_language_new (tracker->config);
+ /* Deal with config options with defaults, config file and
+ * option params.
+ */
+ if (watch_dirs) {
+ tracker_config_add_watch_directory_roots (tracker->config, watch_dirs);
+ }
+
+ if (crawl_dirs) {
+ tracker_config_add_crawl_directory_roots (tracker->config, crawl_dirs);
+ }
+
+ if (no_watch_dirs) {
+ tracker_config_add_no_watch_directory_roots (tracker->config, no_watch_dirs);
+ }
+
+ if (language) {
+ tracker_config_set_language (tracker->config, language);
+ }
+
+ if (disable_indexing) {
+ tracker_config_set_enable_indexing (tracker->config, FALSE);
+ }
+
+ if (low_memory) {
+ tracker_config_set_low_memory_mode (tracker->config, TRUE);
+ }
+
+ if (throttle != -1) {
+ tracker_config_set_throttle (tracker->config, throttle);
+ }
+
+ if (verbosity > -1) {
+ tracker_config_set_verbosity (tracker->config, verbosity);
+ }
+
+ if (initial_sleep > -1) {
+ tracker_config_set_initial_sleep (tracker->config, initial_sleep);
+ }
+
+ sanity_check_option_values ();
+
+ /* Initialise other subsystems */
tracker_log_init (log_filename,
tracker_config_get_verbosity (tracker->config),
fatal_errors);
@@ -919,47 +988,6 @@
ioprio ();
#endif
- /* Deal with config options with defaults, config file and
- * option params.
- */
- if (watch_dirs) {
- tracker_config_add_watch_directory_roots (tracker->config, watch_dirs);
- }
-
- if (crawl_dirs) {
- tracker_config_add_crawl_directory_roots (tracker->config, crawl_dirs);
- }
-
- if (no_watch_dirs) {
- tracker_config_add_no_watch_directory_roots (tracker->config, no_watch_dirs);
- }
-
- if (disable_indexing) {
- tracker_config_set_enable_indexing (tracker->config, FALSE);
- }
-
- if (language) {
- tracker_config_set_language (tracker->config, language);
- }
-
- if (throttle != -1) {
- tracker_config_set_throttle (tracker->config, throttle);
- }
-
- if (low_memory) {
- tracker_config_set_low_memory_mode (tracker->config, TRUE);
- }
-
- if (verbosity != 0) {
- tracker_config_set_verbosity (tracker->config, verbosity);
- }
-
- if (initial_sleep >= 0) {
- tracker_config_set_initial_sleep (tracker->config, initial_sleep);
- }
-
- sanity_check_option_values ();
-
if (!tracker_db_load_prepared_queries ()) {
tracker_error ("Could not initialize database engine!");
return EXIT_FAILURE;
@@ -973,7 +1001,8 @@
tracker->is_running = TRUE;
/* Connect to databases */
- tracker->index_db = tracker_db_connect_all ();
+ tracker->mainloop_db = tracker_db_connect_all ();
+ tracker->xesam_db = tracker_db_connect_xesam ();
/* If we are already running, this should return some
* indication.
@@ -983,10 +1012,11 @@
}
if (!tracker->readonly) {
- if (G_UNLIKELY (!tracker_start_watching ())) {
+ if (!tracker_start_watching ()) {
tracker->is_running = FALSE;
tracker_error ("File monitoring failed to start");
- } else {
+ }
+ else if (tracker_config_get_enable_indexing (tracker->config)) {
thread = g_thread_create_full ((GThreadFunc) tracker_process_files,
tracker,
(gulong) tracker_config_get_thread_stack_size (tracker->config),
@@ -994,6 +1024,8 @@
FALSE,
G_THREAD_PRIORITY_NORMAL,
NULL);
+ } else {
+ tracker_log ("Indexing disabled, waiting for DBus requests...");
}
}
Modified: branches/indexer-split/src/trackerd/tracker-main.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.h (original)
+++ branches/indexer-split/src/trackerd/tracker-main.h Fri May 16 15:35:23 2008
@@ -58,7 +58,8 @@
/* Config options */
guint32 watch_limit;
- gpointer index_db;
+ gpointer mainloop_db;
+ gpointer xesam_db;
/* Data directories */
gchar *data_dir;
Modified: branches/indexer-split/src/trackerd/tracker-process-files.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-process-files.c (original)
+++ branches/indexer-split/src/trackerd/tracker-process-files.c Fri May 16 15:35:23 2008
@@ -208,7 +208,8 @@
static void
process_watch_directories (Tracker *tracker,
- GSList *dirs)
+ GSList *dirs,
+ DBConnection *db_con)
{
GSList *list;
@@ -267,7 +268,7 @@
watches = tracker_count_watch_dirs () + g_slist_length (list);
if (watches < tracker->watch_limit) {
- if (!tracker_add_watch_dir (dir, tracker->index_db)) {
+ if (!tracker_add_watch_dir (dir, db_con)) {
tracker_debug ("Watch failed for %s", dir);
}
}
@@ -287,47 +288,51 @@
}
}
+typedef struct {
+ Tracker *tracker;
+ DBConnection *db_con;
+} ForEachDBCon;
+
static void
process_schedule_directory_check_foreach (const gchar *uri,
- Tracker *tracker)
+ ForEachDBCon *info)
{
- if (!tracker->is_running) {
+ if (!info->tracker->is_running) {
return;
}
- g_return_if_fail (tracker_check_uri (uri));
- g_return_if_fail (tracker->index_db);
- tracker_db_insert_pending_file (tracker->index_db, 0, uri, NULL, "unknown", 0,
+ tracker_db_insert_pending_file (info->db_con, 0, uri, NULL, "unknown", 0,
TRACKER_DB_ACTION_DIRECTORY_REFRESH, TRUE, FALSE, -1);
}
static void
process_schedule_file_check_foreach (const gchar *uri,
- Tracker *tracker)
+ ForEachDBCon *info)
{
- if (!tracker->is_running) {
+ if (!info->tracker->is_running) {
return;
}
g_return_if_fail (tracker_check_uri (uri));
- g_return_if_fail (tracker->index_db);
+ g_return_if_fail (info->db_con);
/* Keep mainloop responsive */
process_my_yield ();
if (!tracker_file_is_directory (uri)) {
- tracker_db_insert_pending_file (tracker->index_db, 0, uri, NULL, "unknown", 0,
+ tracker_db_insert_pending_file (info->db_con, 0, uri, NULL, "unknown", 0,
TRACKER_DB_ACTION_CHECK, 0, FALSE, -1);
} else {
- process_schedule_directory_check_foreach (uri, tracker);
+ process_schedule_directory_check_foreach (uri, info);
}
}
static inline void
process_directory_list (Tracker *tracker,
GSList *list,
- gboolean recurse)
+ gboolean recurse,
+ DBConnection *db_con)
{
crawl_directories = NULL;
@@ -335,16 +340,21 @@
return;
}
- process_watch_directories (tracker, list);
+ ForEachDBCon *info = g_slice_new (ForEachDBCon);
+
+ info->db_con = db_con;
+ info->tracker = tracker;
+
+ process_watch_directories (tracker, list, db_con);
g_slist_foreach (list,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
+ info);
if (recurse && crawl_directories) {
g_slist_foreach (crawl_directories,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
+ info);
}
if (crawl_directories) {
@@ -352,19 +362,22 @@
g_slist_free (crawl_directories);
crawl_directories = NULL;
}
+ g_slice_free (ForEachDBCon, info);
}
static void
process_scan_directory (Tracker *tracker,
- const gchar *uri)
+ const gchar *uri,
+ DBConnection *db_con)
{
GSList *files;
+ ForEachDBCon *info;
if (!tracker->is_running) {
return;
}
- g_return_if_fail (tracker->index_db);
+ g_return_if_fail (db_con);
g_return_if_fail (tracker_check_uri (uri));
g_return_if_fail (tracker_file_is_directory (uri));
@@ -375,9 +388,14 @@
tracker_debug ("Scanning %s for %d files", uri, g_slist_length (files));
+ info = g_slice_new (ForEachDBCon);
+ info->tracker = tracker;
+ info->db_con = db_con;
+
g_slist_foreach (files,
(GFunc) process_schedule_file_check_foreach,
- tracker);
+ info);
+
g_slist_foreach (files,
(GFunc) g_free,
NULL);
@@ -386,7 +404,12 @@
/* Recheck directory to update its mtime if its changed whilst
* scanning.
*/
- process_schedule_directory_check_foreach (uri, tracker);
+
+
+ process_schedule_directory_check_foreach (uri, info);
+
+ g_slice_free (ForEachDBCon, info);
+
tracker_debug ("Finished scanning");
}
@@ -455,7 +478,8 @@
static void
process_index_entity (Tracker *tracker,
- TrackerDBFileInfo *info)
+ TrackerDBFileInfo *info,
+ DBConnection *db_con)
{
TrackerService *def;
gchar *service_info;
@@ -493,7 +517,7 @@
if (info->is_directory) {
info->is_hidden = !tracker_service_get_show_service_directories (def);
- tracker_db_index_file (tracker->index_db, info, NULL, NULL);
+ tracker_db_index_file (db_con, info, NULL, NULL);
g_free (service_info);
return;
} else {
@@ -501,24 +525,20 @@
}
if (g_str_has_suffix (service_info, "Emails")) {
- DBConnection *db_con;
-
- db_con = tracker->index_db;
-
if (!tracker_email_index_file (db_con->emails, info)) {
g_free (service_info);
return;
}
} else if (strcmp (service_info, "Files") == 0) {
- tracker_db_index_file (tracker->index_db, info, NULL, NULL);
+ tracker_db_index_file (db_con, info, NULL, NULL);
} else if (strcmp (service_info, "WebHistory") ==0 ) {
- tracker_db_index_webhistory (tracker->index_db, info);
+ tracker_db_index_webhistory (db_con, info);
} else if (g_str_has_suffix (service_info, "Conversations")) {
- tracker_db_index_conversation (tracker->index_db, info);
+ tracker_db_index_conversation (db_con, info);
} else if (strcmp (service_info, "Applications") == 0) {
- tracker_db_index_application (tracker->index_db, info);
+ tracker_db_index_application (db_con, info);
} else {
- tracker_db_index_service (tracker->index_db, info, NULL, NULL, NULL, FALSE, TRUE, TRUE, TRUE);
+ tracker_db_index_service (db_con, info, NULL, NULL, NULL, FALSE, TRUE, TRUE, TRUE);
}
g_free (service_info);
@@ -526,7 +546,8 @@
static void
process_index_delete_file (Tracker *tracker,
- TrackerDBFileInfo *info)
+ TrackerDBFileInfo *info,
+ DBConnection *db_con)
{
/* Info struct may have been deleted in transit here so check
* if still valid and intact.
@@ -540,14 +561,15 @@
return;
}
- tracker_db_delete_file (tracker->index_db, info->file_id);
+ tracker_db_delete_file (db_con, info->file_id);
tracker_log ("Deleting file %s", info->uri);
}
static void
process_index_delete_directory (Tracker *tracker,
- TrackerDBFileInfo *info)
+ TrackerDBFileInfo *info,
+ DBConnection *db_con)
{
/* Info struct may have been deleted in transit here so check
* if still valid and intact.
@@ -561,22 +583,23 @@
return;
}
- tracker_db_delete_directory (tracker->index_db, info->file_id, info->uri);
+ tracker_db_delete_directory (db_con, info->file_id, info->uri);
- tracker_remove_watch_dir (info->uri, TRUE, tracker->index_db);
+ tracker_remove_watch_dir (info->uri, TRUE, db_con);
tracker_log ("Deleting dir %s and subdirs", info->uri);
}
static void
process_index_delete_directory_check (Tracker *tracker,
- const gchar *uri)
+ const gchar *uri,
+ DBConnection *db_con)
{
gchar **files;
gchar **p;
/* Check for any deletions*/
- files = tracker_db_get_files_in_folder (tracker->index_db, uri);
+ files = tracker_db_get_files_in_folder (db_con, uri);
if (!files) {
return;
@@ -589,12 +612,12 @@
TrackerDBFileInfo *info;
info = tracker_db_file_info_new (str, 1, 0, 0);
- info = tracker_db_get_file_info (tracker->index_db, info);
+ info = tracker_db_get_file_info (db_con, info);
if (!info->is_directory) {
- process_index_delete_file (tracker, info);
+ process_index_delete_file (tracker, info, db_con);
} else {
- process_index_delete_directory (tracker, info);
+ process_index_delete_directory (tracker, info, db_con);
}
tracker_db_file_info_free (info);
}
@@ -646,28 +669,25 @@
* Actual Indexing functions
*/
static void
-process_index_config (Tracker *tracker)
+process_index_config (Tracker *tracker, DBConnection *db_con)
{
tracker_log ("Starting config indexing");
}
static void
-process_index_applications (Tracker *tracker)
+process_index_applications (Tracker *tracker, DBConnection *db_con)
{
GSList *list;
- DBConnection *db_con;
tracker_log ("Starting application indexing");
- db_con = tracker->index_db;
-
tracker_db_start_index_transaction (db_con);
tracker_db_interface_start_transaction (db_con->cache->db);
tracker_applications_add_service_directories ();
list = tracker_service_directories_get ("Applications");
- process_directory_list (tracker, list, FALSE);
+ process_directory_list (tracker, list, FALSE, db_con);
tracker_db_interface_end_transaction (db_con->cache->db);
@@ -760,16 +780,15 @@
}
static void
-process_index_files (Tracker *tracker)
+process_index_files (Tracker *tracker, DBConnection *db_con)
{
- DBConnection *db_con;
GObject *object;
GSList *index_include;
GSList *index_exclude;
+ ForEachDBCon *info;
tracker_log ("Starting file indexing...");
- db_con = tracker->index_db;
object = tracker_dbus_get_object (TRACKER_TYPE_DBUS_DAEMON);
tracker_db_end_index_transaction (db_con);
@@ -822,11 +841,15 @@
tracker_db_interface_start_transaction (db_con->cache->db);
/* Index watched dirs first */
- process_watch_directories (tracker, index_include);
+ process_watch_directories (tracker, index_include, db_con);
+ info = g_slice_new (ForEachDBCon);
+ info->tracker = tracker;
+ info->db_con = db_con;
+
g_slist_foreach (crawl_directories,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
+ info);
if (crawl_directories) {
g_slist_foreach (crawl_directories,
@@ -838,7 +861,7 @@
g_slist_foreach (index_include,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
+ info);
if (crawl_directories) {
g_slist_foreach (crawl_directories,
@@ -847,7 +870,8 @@
g_slist_free (crawl_directories);
crawl_directories = NULL;
}
-
+ g_slice_free (ForEachDBCon, info);
+
tracker_db_interface_end_transaction (db_con->cache->db);
/* Signal progress */
@@ -908,12 +932,10 @@
}
static void
-process_index_crawl_files (Tracker *tracker)
+process_index_crawl_files (Tracker *tracker, DBConnection *db_con)
{
- DBConnection *db_con;
GSList *crawl_directory_roots;
-
- db_con = tracker->index_db;
+ ForEachDBCon *info;
tracker_log ("Starting directory crawling...");
@@ -928,10 +950,13 @@
tracker_db_interface_start_transaction (db_con->cache->db);
process_index_crawl_add_directories (tracker, crawl_directory_roots);
-
+ info = g_slice_new (ForEachDBCon);
+ info->tracker = tracker;
+ info->db_con = db_con;
+
g_slist_foreach (crawl_directories,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
+ info);
if (crawl_directories) {
g_slist_foreach (crawl_directories, (GFunc) g_free, NULL);
@@ -941,8 +966,10 @@
g_slist_foreach (crawl_directory_roots,
(GFunc) process_schedule_directory_check_foreach,
- tracker);
-
+ info);
+
+ g_slice_free (ForEachDBCon, info);
+
if (crawl_directories) {
g_slist_foreach (crawl_directories, (GFunc) g_free, NULL);
g_slist_free (crawl_directories);
@@ -953,7 +980,7 @@
}
static void
-process_index_conversations (Tracker *tracker)
+process_index_conversations (Tracker *tracker, DBConnection *db_con)
{
gchar *gaim, *purple;
gboolean has_logs = FALSE;
@@ -975,13 +1002,10 @@
}
if (has_logs) {
- DBConnection *db_con;
-
- db_con = tracker->index_db;
tracker_log ("Starting chat log indexing...");
tracker_db_interface_start_transaction (db_con->cache->db);
- process_directory_list (tracker, list, TRUE);
+ process_directory_list (tracker, list, TRUE, db_con);
tracker_db_interface_end_transaction (db_con->cache->db);
g_slist_free (list);
}
@@ -991,7 +1015,7 @@
}
static void
-process_index_webhistory (Tracker *tracker)
+process_index_webhistory (Tracker *tracker, DBConnection *db_con)
{
GSList *list = NULL;
gchar *firefox_dir;
@@ -999,17 +1023,13 @@
firefox_dir = g_build_filename (g_get_home_dir(), ".xesam/Firefox/ToIndex", NULL);
if (tracker_file_is_valid (firefox_dir)) {
- DBConnection *db_con;
-
- db_con = tracker->index_db;
-
list = g_slist_prepend( NULL, firefox_dir);
tracker_log ("Starting Firefox web history indexing...");
tracker_service_directories_add ("WebHistory", firefox_dir);
tracker_db_interface_start_transaction (db_con->cache->db);
- process_directory_list (tracker, list, TRUE);
+ process_directory_list (tracker, list, TRUE, db_con);
tracker_db_interface_end_transaction (db_con->cache->db);
g_slist_free (list);
}
@@ -1018,13 +1038,11 @@
}
static void
-process_index_emails (Tracker *tracker)
+process_index_emails (Tracker *tracker, DBConnection *db_con)
{
- DBConnection *db_con;
TrackerConfig *config;
GObject *daemon;
- db_con = tracker->index_db;
config = tracker->config;
tracker_db_end_index_transaction (db_con);
@@ -1051,7 +1069,7 @@
tracker_indexer_apply_changes (tracker->file_index, tracker->file_update_index, TRUE);
}
- tracker_db_start_index_transaction (tracker->index_db);
+ tracker_db_start_index_transaction (db_con);
if (tracker_config_get_email_client (tracker->config)) {
const gchar *name;
@@ -1067,7 +1085,7 @@
GSList *list;
list = tracker_service_directories_get (name);
- process_directory_list (tracker, list, TRUE);
+ process_directory_list (tracker, list, TRUE, db_con);
g_slist_free (list);
}
@@ -1076,13 +1094,11 @@
}
static gboolean
-process_files (Tracker *tracker)
+process_files (Tracker *tracker, DBConnection *db_con)
{
- DBConnection *db_con;
GObject *object;
TrackerIndexStage stage;
- db_con = tracker->index_db;
object = tracker_dbus_get_object (TRACKER_TYPE_DBUS_DAEMON);
/* Check dir_queue in case there are
@@ -1107,34 +1123,34 @@
switch (stage) {
case TRACKER_INDEX_STAGE_CONFIG:
- process_index_config (tracker);
+ process_index_config (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_APPLICATIONS:
- process_index_applications (tracker);
+ process_index_applications (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_FILES:
- process_index_files (tracker);
+ process_index_files (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_CRAWL_FILES:
- process_index_crawl_files (tracker);
+ process_index_crawl_files (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_CONVERSATIONS:
- process_index_conversations (tracker);
+ process_index_conversations (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_WEBHISTORY:
- process_index_webhistory (tracker);
+ process_index_webhistory (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_EXTERNAL:
break;
case TRACKER_INDEX_STAGE_EMAILS:
- process_index_emails (tracker);
+ process_index_emails (tracker, db_con);
break;
case TRACKER_INDEX_STAGE_FINISHED:
@@ -1142,13 +1158,13 @@
}
tracker_index_stage_set (++stage);
-
return TRUE;
}
tracker_db_end_index_transaction (db_con);
tracker_cache_flush_all ();
- tracker_db_refresh_all (db_con);
+ /* I am unsure about this one (Philip Van Hoof)
+ tracker_db_refresh_all (db_con); */
tracker_indexer_merge_indexes (INDEX_TYPE_FILES);
if (tracker->shutdown) {
@@ -1249,12 +1265,11 @@
static gboolean
process_action (Tracker *tracker,
- TrackerDBFileInfo *info)
+ TrackerDBFileInfo *info,
+ DBConnection *db_con)
{
- DBConnection *db_con;
gboolean need_index;
- db_con = tracker->index_db;
need_index = info->mtime > info->indextime;
switch (info->action) {
@@ -1292,7 +1307,7 @@
g_async_queue_push (tracker->dir_queue, g_strdup (info->uri));
if (info->indextime > 0) {
- process_index_delete_directory_check (tracker, info->uri);
+ process_index_delete_directory_check (tracker, info->uri, db_con);
}
}
@@ -1318,8 +1333,8 @@
*/
list = g_slist_prepend (NULL, info->uri);
- process_watch_directories (tracker, list);
- process_scan_directory (tracker, info->uri);
+ process_watch_directories (tracker, list, db_con);
+ process_scan_directory (tracker, info->uri, db_con);
g_slist_free (list);
} else {
@@ -1338,9 +1353,9 @@
static gboolean
process_action_prechecks (Tracker *tracker,
- TrackerDBFileInfo *info)
+ TrackerDBFileInfo *info,
+ DBConnection *db_con)
{
- DBConnection *db_con;
/* Info struct may have been deleted in transit here
* so check if still valid and intact.
@@ -1349,7 +1364,6 @@
return TRUE;
}
- db_con = tracker->index_db;
if (info->file_id == 0 &&
info->action != TRACKER_DB_ACTION_CREATE &&
@@ -1402,14 +1416,14 @@
*/
} else {
if (info->action == TRACKER_DB_ACTION_FILE_DELETED) {
- process_index_delete_file (tracker, info);
+ process_index_delete_file (tracker, info, db_con);
info = tracker_db_file_info_unref (info);
return TRUE;
} else {
if (info->action == TRACKER_DB_ACTION_DIRECTORY_DELETED ||
info->action == TRACKER_DB_ACTION_DIRECTORY_UNMOUNTED) {
- process_index_delete_file (tracker, info);
- process_index_delete_directory (tracker, info);
+ process_index_delete_file (tracker, info, db_con);
+ process_index_delete_directory (tracker, info, db_con);
info = tracker_db_file_info_unref (info);
return TRUE;
}
@@ -1442,25 +1456,27 @@
static void
process_mount_point_added_cb (TrackerHal *hal,
const gchar *mount_point,
- Tracker *tracker)
+ Tracker *tracker,
+ DBConnection *db_con)
{
GSList *list;
tracker_log ("** TRAWLING THROUGH NEW MOUNT POINT '%s'", mount_point);
list = g_slist_prepend (NULL, (gchar*) mount_point);
- process_directory_list (tracker, list, TRUE);
+ process_directory_list (tracker, list, TRUE, db_con);
g_slist_free (list);
}
static void
process_mount_point_removed_cb (TrackerHal *hal,
const gchar *mount_point,
- Tracker *tracker)
+ Tracker *tracker,
+ DBConnection *db_con)
{
tracker_log ("** CLEANING UP OLD MOUNT POINT '%s'", mount_point);
- process_index_delete_directory_check (tracker, mount_point);
+ process_index_delete_directory_check (tracker, mount_point, db_con);
}
#endif /* HAVE_HAL */
@@ -1485,6 +1501,7 @@
gpointer
tracker_process_files (gpointer data)
{
+ DBConnection *db_con = tracker_db_connect_all ();
Tracker *tracker;
GObject *object;
GSList *moved_from_list; /* List to hold moved_from
@@ -1586,7 +1603,7 @@
TrackerDBFileInfo *info;
gboolean need_index;
- if (!tracker_cache_process_events (tracker->index_db, TRUE) ) {
+ if (!tracker_cache_process_events (db_con, TRUE) ) {
tracker_status_set_and_signal (TRACKER_STATUS_SHUTDOWN,
tracker->first_time_index,
tracker->in_merge,
@@ -1612,12 +1629,12 @@
TrackerDBResultSet *result_set;
gint k;
- if (!tracker_db_has_pending_files (tracker->index_db)) {
+ if (!tracker_db_has_pending_files (db_con)) {
gboolean should_continue;
/* Set mutex to indicate we are in "check" state */
g_mutex_lock (tracker->files_check_mutex);
- should_continue = process_files (tracker);
+ should_continue = process_files (tracker, db_con);
g_mutex_unlock (tracker->files_check_mutex);
if (should_continue) {
@@ -1629,7 +1646,7 @@
}
}
- result_set = tracker_db_get_pending_files (tracker->index_db);
+ result_set = tracker_db_get_pending_files (db_con);
k = 0;
pushed_events = FALSE;
@@ -1669,7 +1686,7 @@
continue;
}
- tracker_db_remove_pending_files (tracker->index_db);
+ tracker_db_remove_pending_files (db_con);
/* Pending files are present but not yet ready
* as we are waiting til they stabilize so we
@@ -1691,15 +1708,15 @@
tracker->pause_io,
tracker_config_get_enable_indexing (tracker->config));
- if (process_action_prechecks (tracker, info)) {
+ if (process_action_prechecks (tracker, info, db_con)) {
continue;
}
/* Check if file needs indexing */
- need_index = process_action (tracker, info);
+ need_index = process_action (tracker, info, db_con);
if (need_index) {
- if (tracker_db_regulate_transactions (tracker->index_db, 250)) {
+ if (tracker_db_regulate_transactions (db_con, 250)) {
if (tracker_config_get_verbosity (tracker->config) == 1) {
tracker_log ("indexing #%d - %s", tracker->index_count, info->uri);
}
@@ -1715,7 +1732,7 @@
tracker->folders_count);
}
- process_index_entity (tracker, info);
+ process_index_entity (tracker, info, db_con);
}
tracker_db_file_info_unref (info);
@@ -1732,12 +1749,13 @@
xdg_mime_shutdown ();
- tracker_db_close_all (tracker->index_db);
+ tracker_db_close_all (db_con);
g_mutex_unlock (tracker->files_signal_mutex);
tracker_log ("Process thread:%p now finishing", g_thread_self ());
+ g_thread_exit (NULL);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]