tracker r1709 - in branches/xesam-support: . data src/libtracker-common src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1709 - in branches/xesam-support: . data src/libtracker-common src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- Date: Wed, 18 Jun 2008 12:49:24 +0000 (UTC)
Author: pvanhoof
Date: Wed Jun 18 12:49:24 2008
New Revision: 1709
URL: http://svn.gnome.org/viewvc/tracker?rev=1709&view=rev
Log:
2008-06-18 Philip Van Hoof <pvanhoof gnome org>
* svn merge -r 1705:1708 ../indexer-split
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/data/sqlite-tracker.sql
branches/xesam-support/src/libtracker-common/tracker-ontology.c
branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c
branches/xesam-support/src/libtracker-db/tracker-db-manager.c
branches/xesam-support/src/tracker-indexer/modules/files.c
branches/xesam-support/src/tracker-indexer/tracker-indexer.c
branches/xesam-support/src/tracker-indexer/tracker-main.c
branches/xesam-support/src/trackerd/tracker-db.c
branches/xesam-support/src/trackerd/tracker-db.h
branches/xesam-support/src/trackerd/tracker-email-evolution.c
branches/xesam-support/src/trackerd/tracker-email-modest.c
branches/xesam-support/src/trackerd/tracker-email-utils.c
branches/xesam-support/src/trackerd/tracker-main.c
Modified: branches/xesam-support/data/sqlite-tracker.sql
==============================================================================
--- branches/xesam-support/data/sqlite-tracker.sql (original)
+++ branches/xesam-support/data/sqlite-tracker.sql Wed Jun 18 12:49:24 2008
@@ -99,4 +99,3 @@
);
-ANALYZE;
Modified: branches/xesam-support/src/libtracker-common/tracker-ontology.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-ontology.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-ontology.c Wed Jun 18 12:49:24 2008
@@ -31,6 +31,8 @@
gint service;
} ServiceMimePrefixes;
+static gboolean initialized;
+
/* Hash (gint service_type_id, TrackerService *service) */
static GHashTable *service_id_table;
@@ -54,9 +56,7 @@
static GHashTable *metadata_table;
/* FieldType enum class */
-static gpointer field_type_enum_class;
-
-
+static gpointer field_type_enum_class;
static void
ontology_mime_prefix_foreach (gpointer data,
@@ -74,7 +74,7 @@
ontology_hash_lookup_by_str (GHashTable *hash_table,
const gchar *str)
{
- gpointer *data;
+ gpointer data;
gchar *str_lower;
str_lower = g_utf8_collate_key (str, -1);
@@ -88,7 +88,7 @@
ontology_hash_lookup_by_id (GHashTable *hash_table,
gint id)
{
- gpointer *data;
+ gpointer data;
gchar *str;
str = g_strdup_printf ("%d", id);
@@ -101,10 +101,9 @@
void
tracker_ontology_init (void)
{
-
- g_return_if_fail (service_id_table == NULL
- && service_table == NULL
- && mime_service == NULL);
+ if (initialized) {
+ return;
+ }
service_id_table = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -136,26 +135,44 @@
* created beforehand.
*/
field_type_enum_class = g_type_class_ref (TRACKER_TYPE_FIELD_TYPE);
+
+ initialized = TRUE;
}
void
tracker_ontology_shutdown (void)
{
+ if (!initialized) {
+ return;
+ }
+
g_hash_table_remove_all (service_directory_table);
+ service_directory_table = NULL;
+
g_hash_table_remove_all (service_id_table);
+ service_id_table = NULL;
+
g_hash_table_remove_all (service_table);
+ service_table = NULL;
+
g_hash_table_remove_all (mime_service);
+ mime_service = NULL;
+
g_hash_table_remove_all (metadata_table);
+ metadata_table = NULL;
if (mime_prefix_service) {
g_slist_foreach (mime_prefix_service,
ontology_mime_prefix_foreach,
NULL);
g_slist_free (mime_prefix_service);
+ mime_prefix_service = NULL;
}
g_type_class_unref (field_type_enum_class);
field_type_enum_class = NULL;
+
+ initialized = FALSE;
}
void
@@ -219,7 +236,7 @@
gchar *
tracker_ontology_get_service_type_for_mime (const gchar *mime)
{
- gpointer *id;
+ gpointer id;
ServiceMimePrefixes *item;
GSList *prefix_service;
Modified: branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c Wed Jun 18 12:49:24 2008
@@ -69,8 +69,10 @@
g_assert (priv->filename != NULL);
if (sqlite3_open (priv->filename, &priv->db) != SQLITE_OK) {
- g_critical ("Can't open DB at: %s\n", priv->filename);
- }
+ g_critical ("Could not open sqlite3 database:'%s'", priv->filename);
+ } else {
+ g_message ("Opened sqlite3 database:'%s'", priv->filename);
+ }
sqlite3_extended_result_codes (priv->db, 0);
sqlite3_busy_timeout (priv->db, 10000000);
@@ -129,8 +131,6 @@
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (object);
- g_free (priv->filename);
-
g_hash_table_destroy (priv->statements);
if (priv->procedures) {
@@ -141,6 +141,9 @@
g_slist_free (priv->function_data);
sqlite3_close (priv->db);
+ g_message ("Closed sqlite3 database:'%s'", priv->filename);
+
+ g_free (priv->filename);
G_OBJECT_CLASS (tracker_db_interface_sqlite_parent_class)->finalize (object);
}
@@ -215,7 +218,7 @@
/* just ignore NULLs */
break;
default:
- g_critical ("Unknown database column type: %d\n", col_type);
+ g_critical ("Unknown sqlite3 database column type:%d", col_type);
}
if (G_VALUE_TYPE (&value) != G_TYPE_INVALID) {
@@ -269,7 +272,8 @@
break;
}
default:
- g_critical ("Unknown database value type: %d\n", sqlite3_value_type (argv[i]));
+ g_critical ("Unknown sqlite3 database value type:%d",
+ sqlite3_value_type (argv[i]));
}
}
@@ -294,7 +298,8 @@
} else if (G_VALUE_HOLDS (&result, G_TYPE_INVALID)) {
sqlite3_result_null (context);
} else {
- g_critical ("Returned type not managed: %s\n", G_VALUE_TYPE_NAME (&result));
+ g_critical ("Sqlite3 returned type not managed:'%s'",
+ G_VALUE_TYPE_NAME (&result));
sqlite3_result_null (context);
}
@@ -388,7 +393,8 @@
g_hash_table_foreach (priv->statements, foreach_print_error, stmt);
if (result == SQLITE_CORRUPT) {
- g_critical ("Database %s is corrupt. Can't live without it", priv->filename);
+ g_critical ("Sqlite3 database:'%s' is corrupt, can not live without it",
+ priv->filename);
g_assert_not_reached ();
}
@@ -429,7 +435,8 @@
procedure = g_hash_table_lookup (priv->procedures, procedure_name);
if (!procedure) {
- g_critical ("Prepared query %s not found", procedure_name);
+ g_critical ("Sqlite3 prepared query:'%s' was not found",
+ procedure_name);
return NULL;
}
Modified: branches/xesam-support/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-manager.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-manager.c Wed Jun 18 12:49:24 2008
@@ -2143,6 +2143,9 @@
return;
}
+ /* Make sure we initialize all other modules we depend on */
+ tracker_ontology_init ();
+
attach_all = attach_all_dbs;
/* Since we don't reference this enum anywhere, we do
@@ -2229,6 +2232,9 @@
g_object_unref (attach_interface);
}
+ /* Make sure we shutdown all other modules we depend on */
+ tracker_ontology_shutdown ();
+
initialized = FALSE;
}
@@ -2256,6 +2262,23 @@
g_return_if_fail (initialized != FALSE);
+ /* Save the current attach setting */
+ current_attach_all = attach_all;
+
+ /* Don't attach while we do this... */
+ attach_all = FALSE;
+
+ /* Close all dbs first. */
+ for (i = 0; i < G_N_ELEMENTS (dbs); i++) {
+ if (dbs[i].iface) {
+ g_object_unref (dbs[i].iface);
+ dbs[i].iface = NULL;
+ }
+ }
+
+ /* Clean up any ontology information we have */
+ tracker_ontology_shutdown ();
+
if (remove_all_first) {
g_message ("Removing directory:'%s'", db_data_dir);
tracker_path_remove (db_data_dir);
@@ -2277,23 +2300,24 @@
g_message ("Creating directory:'%s'", db_sys_tmp_dir);
g_mkdir_with_parents (db_sys_tmp_dir, 00755);
- /* Save the current attach setting */
- current_attach_all = attach_all;
-
- /* Don't attach while we do this... */
- attach_all = FALSE;
+ /* Initialize ontology information */
+ tracker_ontology_init ();
/* Create all interfaces (and dbs as a result) and then unref
* them to close the dbs.
*/
for (i = 0; i < G_N_ELEMENTS (dbs); i++) {
tracker_db_manager_get_db_interface (i);
- g_object_unref (dbs[i].iface);
- /* Reset the interface value so we get a new object
- * next time it is needed.
- */
- dbs[i].iface = NULL;
+ if (dbs[i].iface) {
+ g_object_unref (dbs[i].iface);
+
+
+ /* Reset the interface value so we get a new
+ * object next time it is needed.
+ */
+ dbs[i].iface = NULL;
+ }
}
/* Set the attach setting back to what it was */
Modified: branches/xesam-support/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/modules/files.c (original)
+++ branches/xesam-support/src/tracker-indexer/modules/files.c Wed Jun 18 12:49:24 2008
@@ -344,8 +344,9 @@
service_type = tracker_ontology_get_service_type_for_mime (mimetype);
/* No need to filter text based files - index them directly */
- if (strcmp (service_type, "Text") == 0 ||
- strcmp (service_type, "Development") == 0) {
+ if (service_type &&
+ (strcmp (service_type, "Text") == 0 ||
+ strcmp (service_type, "Development") == 0)) {
GMappedFile *mapped_file;
mapped_file = g_mapped_file_new (file, FALSE, NULL);
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.c Wed Jun 18 12:49:24 2008
@@ -148,12 +148,15 @@
priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
+ /* These are unreffed for us by the TrackerDBManager */
priv->common = NULL;
priv->metadata = NULL;
priv->contents = NULL;
+ /* Now create the new databases */
tracker_db_manager_set_up_databases (TRUE);
+ /* Now establish new connections */
priv->common = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
priv->metadata = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA);
priv->contents = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_CONTENTS);
@@ -237,22 +240,22 @@
object_class->set_property = tracker_indexer_set_property;
object_class->get_property = tracker_indexer_get_property;
- signals [FINISHED] = g_signal_new ("finished",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TrackerIndexerClass, finished),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-
- signals [INDEX_UPDATED] = g_signal_new ("index-updated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TrackerIndexerClass, index_updated),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ signals [FINISHED] =
+ g_signal_new ("finished",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerIndexerClass, finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ signals [INDEX_UPDATED] =
+ g_signal_new ("index-updated",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerIndexerClass, index_updated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_RUNNING,
@@ -262,8 +265,7 @@
TRUE,
G_PARAM_READWRITE));
- g_type_class_add_private (object_class,
- sizeof (TrackerIndexerPrivate));
+ g_type_class_add_private (object_class, sizeof (TrackerIndexerPrivate));
}
static void
Modified: branches/xesam-support/src/tracker-indexer/tracker-main.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-main.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-main.c Wed Jun 18 12:49:24 2008
@@ -141,8 +141,6 @@
{
gchar *data_dir, *user_data_dir, *sys_tmp_dir, *filename;
- tracker_ontology_init ();
-
data_dir = g_build_filename (g_get_user_cache_dir (),
"tracker",
NULL);
@@ -171,7 +169,6 @@
{
g_message ("Shutting down...\n");
- tracker_ontology_shutdown ();
tracker_db_manager_shutdown ();
}
Modified: branches/xesam-support/src/trackerd/tracker-db.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db.c Wed Jun 18 12:49:24 2008
@@ -626,49 +626,6 @@
/* Nothing to do? */
}
-void
-tracker_db_close (TrackerDBInterface *iface)
-{
- if (iface) {
- g_object_unref (iface);
- }
-
- g_message ("Closed database");
-}
-
-void
-tracker_db_refresh_all (TrackerDBInterface *iface)
-{
-#if 0
- gboolean cache_trans = FALSE;
- DBConnection *cache = db_con->cache;
- DBConnection *emails = db_con->emails;
-
- if (cache && tracker_db_interface_end_transaction (cache->db)) {
- cache_trans = TRUE;
- }
-
- /* close and reopen all databases */
- tracker_db_close (db_con->db);
- tracker_db_close (db_con->blob->db);
-
- tracker_db_close (emails->blob->db);
- tracker_db_close (emails->common->db);
- tracker_db_close (emails->db);
-
- db_con->db = open_db_interface (TRACKER_DB_FILE_METADATA);
-
- emails->common->db = open_db_interface (TRACKER_DB_COMMON);
-
- open_email_db (emails);
-
- if (cache_trans) {
- tracker_db_interface_start_transaction (cache->db);
- }
-
-#endif
-}
-
gboolean
tracker_db_exec_no_reply (TrackerDBInterface *iface,
const gchar *query,
Modified: branches/xesam-support/src/trackerd/tracker-db.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db.h (original)
+++ branches/xesam-support/src/trackerd/tracker-db.h Wed Jun 18 12:49:24 2008
@@ -40,11 +40,8 @@
void tracker_db_init (void);
void tracker_db_shutdown (void);
-void tracker_db_refresh_all (TrackerDBInterface *iface);
-
/* Operations for TrackerDBInterface */
-void tracker_db_close (TrackerDBInterface *iface);
TrackerDBResultSet *tracker_db_exec_proc (TrackerDBInterface *iface,
const gchar *procedure,
...);
Modified: branches/xesam-support/src/trackerd/tracker-email-evolution.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-evolution.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-evolution.c Wed Jun 18 12:49:24 2008
@@ -1464,7 +1464,7 @@
if (tracker->index_count % 1000 == 0) {
tracker_db_interface_end_transaction (iface);
- tracker_db_refresh_all (iface);
+ /* tracker_db_refresh_all (iface); */
tracker_db_interface_start_transaction (iface);
}
Modified: branches/xesam-support/src/trackerd/tracker-email-modest.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-modest.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-modest.c Wed Jun 18 12:49:24 2008
@@ -953,7 +953,7 @@
if (tracker->index_count % 1000 == 0) {
tracker_db_interface_end_transaction (iface);
- tracker_db_refresh_all (iface);
+ /* tracker_db_refresh_all (iface); */
tracker_db_interface_start_transaction (iface);
}
Modified: branches/xesam-support/src/trackerd/tracker-email-utils.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-utils.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-utils.c Wed Jun 18 12:49:24 2008
@@ -199,7 +199,7 @@
if (tracker->index_count % 2500 == 0) {
tracker_db_interface_end_transaction (iface);
- tracker_db_refresh_all (iface);
+ /* tracker_db_refresh_all (iface); */
tracker_db_interface_start_transaction (iface);
}
Modified: branches/xesam-support/src/trackerd/tracker-main.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-main.c (original)
+++ branches/xesam-support/src/trackerd/tracker-main.c Wed Jun 18 12:49:24 2008
@@ -826,7 +826,6 @@
initialize_directories (&need_index);
tracker_nfs_lock_init (tracker_config_get_nfs_locking (tracker->config));
- tracker_ontology_init ();
tracker_db_init ();
tracker_db_manager_init (TRUE, data_dir, user_data_dir, sys_tmp_dir); /* Using TRUE=broken */
tracker_xesam_manager_init ();
@@ -908,7 +907,6 @@
tracker_xesam_manager_shutdown ();
tracker_db_shutdown ();
tracker_db_manager_shutdown ();
- tracker_ontology_shutdown ();
tracker_monitor_shutdown ();
tracker_nfs_lock_shutdown ();
tracker_log_shutdown ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]