[tracker/miner-fs-rename-directory-to-hidden-name] libtracker-miner: Improve traces in the processing pool
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-rename-directory-to-hidden-name] libtracker-miner: Improve traces in the processing pool
- Date: Mon, 13 Dec 2010 15:32:54 +0000 (UTC)
commit 3e2c2d1835b35956012325368db4b39953ee2031
Author: Aleksander Morgado <aleksander lanedo com>
Date: Mon Dec 13 13:33:10 2010 +0100
libtracker-miner: Improve traces in the processing pool
.../tracker-miner-fs-processing-pool.c | 36 ++++++++++++++-----
.../tracker-miner-fs-processing-pool.h | 3 +-
src/libtracker-miner/tracker-miner-fs.c | 6 ++-
3 files changed, 32 insertions(+), 13 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.c b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
index 1395ef7..5078dc9 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.c
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
@@ -112,6 +112,7 @@
/* If defined, will dump additional traces */
#ifdef PROCESSING_POOL_ENABLE_TRACE
+#warning Processing pool traces are enabled
#define trace(message, ...) g_debug (message, ##__VA_ARGS__)
#else
#define trace(...)
@@ -527,7 +528,8 @@ tracker_processing_pool_sparql_update_array_cb (GObject *object,
}
void
-tracker_processing_pool_buffer_flush (TrackerProcessingPool *pool)
+tracker_processing_pool_buffer_flush (TrackerProcessingPool *pool,
+ const gchar *reason)
{
guint i;
gchar **sparql_array;
@@ -558,8 +560,10 @@ tracker_processing_pool_buffer_flush (TrackerProcessingPool *pool)
task->sparql_string);
}
- trace ("(Processing Pool) Flushing array-update of tasks %p with %u items",
- pool->sparql_buffer, pool->sparql_buffer->len);
+ trace ("(Processing Pool) Flushing array-update of tasks %p with %u items (%s)",
+ pool->sparql_buffer,
+ pool->sparql_buffer->len,
+ reason ? reason : "Unknown reason");
tracker_sparql_connection_update_array_async (pool->connection,
sparql_array,
@@ -617,12 +621,15 @@ tracker_processing_pool_push_ready_task (TrackerProcessingPool
task, task->file_uri);
/* Flush previous */
- tracker_processing_pool_buffer_flush (pool);
+ tracker_processing_pool_buffer_flush (pool,
+ "Before unbuffered task");
/* Set status of the task as PROCESSING (No READY status here!) */
task->status = TRACKER_PROCESSING_TASK_STATUS_PROCESSING;
g_queue_push_head (pool->tasks[TRACKER_PROCESSING_TASK_STATUS_PROCESSING], task);
+ trace ("(Processing Pool) Flushing single task %p", task);
+
/* And update the new one */
tracker_sparql_connection_update_async (pool->connection,
(task->sparql ?
@@ -669,12 +676,21 @@ tracker_processing_pool_push_ready_task (TrackerProcessingPool
* - Maximum number of READY items reached
* - Not flushed in the last MAX_SPARQL_BUFFER_TIME seconds
*/
- if (!parent ||
- !g_file_equal (parent, pool->sparql_buffer_current_parent) ||
- tracker_processing_pool_ready_limit_reached (pool) ||
- (time (NULL) - pool->sparql_buffer_start_time > MAX_SPARQL_BUFFER_TIME)) {
- /* Flush! */
- tracker_processing_pool_buffer_flush (pool);
+ if (!parent) {
+ tracker_processing_pool_buffer_flush (pool,
+ "File with no parent");
+ flushed = TRUE;
+ } else if (!g_file_equal (parent, pool->sparql_buffer_current_parent)) {
+ tracker_processing_pool_buffer_flush (pool,
+ "Different parent");
+ flushed = TRUE;
+ } else if (tracker_processing_pool_ready_limit_reached (pool)) {
+ tracker_processing_pool_buffer_flush (pool,
+ "Ready limit reached");
+ flushed = TRUE;
+ } else if (time (NULL) - pool->sparql_buffer_start_time > MAX_SPARQL_BUFFER_TIME) {
+ tracker_processing_pool_buffer_flush (pool,
+ "Buffer time reached");
flushed = TRUE;
}
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.h b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
index eb4ac9c..c8838f2 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.h
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
@@ -81,7 +81,8 @@ TrackerProcessingTask *tracker_processing_pool_get_last_wait (TrackerPro
void tracker_processing_pool_foreach (TrackerProcessingPool *pool,
GFunc func,
gpointer user_data);
-void tracker_processing_pool_buffer_flush (TrackerProcessingPool *pool);
+void tracker_processing_pool_buffer_flush (TrackerProcessingPool *pool,
+ const gchar *reason);
G_END_DECLS
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index aff61e9..05fd94e 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2402,7 +2402,8 @@ item_queue_handlers_cb (gpointer user_data)
* if there was a previous task on the same file we want to
* process now, we want it to get finished before we can go
* on with the queues... */
- tracker_processing_pool_buffer_flush (fs->private->processing_pool);
+ tracker_processing_pool_buffer_flush (fs->private->processing_pool,
+ "Queue handlers WAIT");
return FALSE;
}
@@ -2497,7 +2498,8 @@ item_queue_handlers_cb (gpointer user_data)
}
/* Flush any possible pending update here */
- tracker_processing_pool_buffer_flush (fs->private->processing_pool);
+ tracker_processing_pool_buffer_flush (fs->private->processing_pool,
+ "Queue handlers NONE");
tracker_thumbnailer_send ();
/* No more files left to process */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]