tracker r1823 - in branches/indexer-split: . src/libtracker-common src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1823 - in branches/indexer-split: . src/libtracker-common src/trackerd
- Date: Wed, 2 Jul 2008 11:57:29 +0000 (UTC)
Author: pvanhoof
Date: Wed Jul 2 11:57:28 2008
New Revision: 1823
URL: http://svn.gnome.org/viewvc/tracker?rev=1823&view=rev
Log:
2008-07-02 Philip Van Hoof <pvanhoof gnome org>
* src/trackerd/tracker-metadata.c:
* src/trackerd/tracker-main.c:
* src/trackerd/tracker-daemon.c:
* src/trackerd/tracker-db.c:
Various database connection usage improvements
* src/libtracker-common/tracker-log.c:
Added a perror() to find out about a race condition while writing to
the log file
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-log.c
branches/indexer-split/src/trackerd/tracker-daemon.c
branches/indexer-split/src/trackerd/tracker-db.c
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-metadata.c
Modified: branches/indexer-split/src/libtracker-common/tracker-log.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-log.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-log.c Wed Jul 2 11:57:28 2008
@@ -66,6 +66,7 @@
fd = g_fopen (log->filename, "a");
if (!fd) {
+ perror ("log");
g_warning ("Could not open log: '%s'", log->filename);
g_mutex_unlock (log->mutex);
return;
Modified: branches/indexer-split/src/trackerd/tracker-daemon.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-daemon.c (original)
+++ branches/indexer-split/src/trackerd/tracker-daemon.c Wed Jul 2 11:57:28 2008
@@ -319,10 +319,17 @@
tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
- tracker_dbus_request_new (request_id,
+ tracker_dbus_request_new (request_id,
"DBus request to get daemon services");
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
result_set = tracker_db_exec_proc (iface, "GetServices", 0);
*values = tracker_dbus_query_result_to_hash_table (result_set);
@@ -349,13 +356,20 @@
tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
- tracker_dbus_request_new (request_id,
+ tracker_dbus_request_new (request_id,
"DBus request to get daemon service stats");
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
result_set = tracker_db_exec_proc (iface, "GetStats", 0);
- *values = tracker_dbus_query_result_to_ptr_array (result_set);
+ *values = tracker_dbus_query_result_to_ptr_array (result_set);
if (result_set) {
g_object_unref (result_set);
Modified: branches/indexer-split/src/trackerd/tracker-db.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.c (original)
+++ branches/indexer-split/src/trackerd/tracker-db.c Wed Jul 2 11:57:28 2008
@@ -2719,7 +2719,6 @@
{
TrackerDBResultSet *result_set;
TrackerDBResultSet *result_set_proc;
- TrackerDBInterface *iface_common;
gint i;
guint32 id = 0;
gchar *sid;
@@ -2748,10 +2747,8 @@
path = tracker_file_get_vfs_path (info->uri);
}
- iface_common = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
-
/* Get a new unique ID for the service - use mutex to prevent race conditions */
- result_set = tracker_db_exec_proc (iface_common, "GetNewID", NULL);
+ result_set = tracker_db_exec_proc (iface, "GetNewID", NULL);
if (!result_set) {
g_critical ("Could not create service, GetNewID failed");
@@ -2764,7 +2761,7 @@
i++;
sid = tracker_int_to_string (i);
- result_set_proc = tracker_db_exec_proc (iface_common, "UpdateNewID", sid, NULL);
+ result_set_proc = tracker_db_exec_proc (iface, "UpdateNewID", sid, NULL);
if (result_set_proc) {
g_object_unref (result_set_proc);
@@ -2849,7 +2846,7 @@
(int) id);
}
- result_set_proc = tracker_db_exec_proc (iface_common,
+ result_set_proc = tracker_db_exec_proc (iface,
"IncStat",
service,
NULL);
@@ -2861,7 +2858,7 @@
parent = tracker_ontology_get_parent_service (service);
if (parent) {
- result_set_proc = tracker_db_exec_proc (iface_common,
+ result_set_proc = tracker_db_exec_proc (iface,
"IncStat",
parent,
NULL);
@@ -3196,7 +3193,7 @@
g_return_if_fail (uri != NULL);
g_return_if_fail (mime != NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_CACHE);
time (&time_now);
@@ -3251,7 +3248,7 @@
g_return_if_fail (action != NULL);
g_return_if_fail (uri != NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_CACHE);
time (&time_now);
@@ -3430,7 +3427,7 @@
g_return_val_if_fail (dir != NULL, NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_CACHE);
folder = g_build_filename (dir, "*", NULL);
result_set = tracker_db_exec_proc (iface,
@@ -3453,7 +3450,7 @@
g_return_val_if_fail (dir != NULL, NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_CACHE);
folder = g_build_filename (dir, "*", NULL);
result_set = tracker_db_exec_proc (iface,
@@ -3808,7 +3805,7 @@
g_return_val_if_fail (option != NULL, NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON);
result_set = tracker_db_exec_proc (iface, "GetOption", option, NULL);
if (result_set) {
@@ -3830,7 +3827,7 @@
g_return_if_fail (option != NULL);
g_return_if_fail (value != NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON);
result_set = tracker_db_exec_proc (iface, "SetOption", value, option, NULL);
if (result_set) {
@@ -3849,7 +3846,15 @@
g_return_val_if_fail (option != NULL, 0);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
+
result_set = tracker_db_exec_proc (iface, "GetOption", option, NULL);
if (result_set) {
@@ -3876,8 +3881,15 @@
g_return_if_fail (option != NULL);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
-
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
+
str = tracker_int_to_string (value);
result_set = tracker_db_exec_proc (iface, "SetOption", str, option, NULL);
g_free (str);
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 Wed Jul 2 11:57:28 2008
@@ -455,8 +455,16 @@
tracker->first_time_index = TRUE;
/* Reset stats for embedded services if they are being reindexed */
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
-
+
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
+
g_message ("*** DELETING STATS *** ");
tracker_db_exec_no_reply (iface,
"update ServiceTypes set TypeCount = 0 where Embedded = 1");
Modified: branches/indexer-split/src/trackerd/tracker-metadata.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-metadata.c (original)
+++ branches/indexer-split/src/trackerd/tracker-metadata.c Wed Jul 2 11:57:28 2008
@@ -305,7 +305,14 @@
tracker_dbus_return_val_if_fail (is_embedded != NULL, FALSE, error);
tracker_dbus_return_val_if_fail (is_writable != NULL, FALSE, error);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
tracker_dbus_request_new (request_id,
"DBus request to get metadata details, "
@@ -359,7 +366,14 @@
"class:'%s'",
class);
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
result_set = tracker_db_metadata_get_types (iface, class, FALSE);
if (result_set) {
@@ -388,7 +402,14 @@
tracker_dbus_request_new (request_id,
"DBus request to get registered classes");
- iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
+ /* Here it doesn't matter which one we ask, as long as it has common.db
+ * attached. The service ones are cached connections, so we can use
+ * those instead of asking for an individual-file connection (like what
+ * the original code had) */
+
+ /* iface = tracker_db_manager_get_db_interfaceX (TRACKER_DB_COMMON); */
+
+ iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
result_set = tracker_db_exec_proc (iface,
"SelectMetadataClasses",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]