tracker r1346 - in branches/indexer-split: . src/trackerd
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1346 - in branches/indexer-split: . src/trackerd
- Date: Mon, 5 May 2008 13:01:42 +0100 (BST)
Author: ifrade
Date: Mon May 5 12:01:41 2008
New Revision: 1346
URL: http://svn.gnome.org/viewvc/tracker?rev=1346&view=rev
Log:
Removed unusued fields in DBConnection
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-cache.c
branches/indexer-split/src/trackerd/tracker-db-sqlite.c
branches/indexer-split/src/trackerd/tracker-db-sqlite.h
branches/indexer-split/src/trackerd/trackerd.c
Modified: branches/indexer-split/src/trackerd/tracker-cache.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-cache.c (original)
+++ branches/indexer-split/src/trackerd/tracker-cache.c Mon May 5 12:01:41 2008
@@ -452,7 +452,11 @@
}
- if (stopped_trans && db_con && !db_con->in_transaction) tracker_db_start_index_transaction (db_con);
+ if (stopped_trans
+ && db_con
+ && !tracker_db_is_in_transaction (db_con)) {
+ tracker_db_start_index_transaction (db_con);
+ }
tracker_throttle (5000);
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 Mon May 5 12:01:41 2008
@@ -81,9 +81,6 @@
} ServiceTypeInfo;
-
-
-
/* sqlite utf-8 user defined collation sequence */
static int
@@ -311,18 +308,6 @@
}
-static inline void
-lock_connection (DBConnection *db_con)
-{
-}
-
-
-static inline void
-unlock_connection (DBConnection *db_con)
-{
-}
-
-
gboolean
tracker_db_initialize (void)
{
@@ -414,54 +399,16 @@
db_con->db = NULL;
}
- tracker_debug ("Database closed for thread %s", db_con->thread);
+ tracker_debug ("Database closed");
}
void
tracker_db_close (DBConnection *db_con)
{
- if (!db_con->thread) {
- db_con->thread = "main";
- }
-
close_db (db_con);
}
-
-
-
-
-/*
-static void
-test_data (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- DBConnection *db_con;
- sqlite3_stmt *stmt;
- int rc;
-
- db_con = user_data;
-
- rc = sqlite3_prepare (db_con->db, query, -1, &stmt, 0);
-
- if (rc == SQLITE_OK && stmt != NULL) {
- char *procedure, *query;
-
- procedure = (char *) key;
- query = (char *) value;
-
- //tracker_log ("successfully prepared query %s", procedure);
- //g_hash_table_insert (db_con->statements, g_strdup (procedure), stmt);
- } else {
- tracker_error ("ERROR: failed to prepare query %s with sql %s due to %s", procedure, query, sqlite3_errmsg (db_con->db));
- return;
- }
-}
-*/
-
-
static TrackerDBInterface *
open_user_db (const char *name, gboolean *create_table)
{
@@ -568,18 +515,11 @@
open_common_db (db_con);
- db_con->db_type = TRACKER_DB_TYPE_COMMON;
-
db_con->cache = NULL;
db_con->emails = NULL;
- db_con->others = NULL;
db_con->blob = NULL;
db_con->common = db_con;
- db_con->thread = NULL;
-
- db_con->in_transaction = FALSE;
-
return db_con;
}
@@ -706,6 +646,16 @@
}
+gboolean
+tracker_db_is_in_transaction (DBConnection *db_con)
+{
+ gboolean in_transaction;
+
+ g_object_get (db_con->db, "in-transaction", &in_transaction, NULL);
+
+ return in_transaction;
+}
+
void
tracker_db_start_index_transaction (DBConnection *db_con)
{
@@ -776,9 +726,6 @@
tracker_db_interface_set_procedure_table (db_con->db, prepared_queries);
g_free (dbname);
- db_con->db_type = TRACKER_DB_TYPE_DATA;
- db_con->db_category = DB_CATEGORY_FILES;
-
db_con->data = db_con;
tracker_db_set_default_pragmas (db_con);
@@ -832,8 +779,6 @@
db_con->cache = db_con;
db_con->common = db_con;
- db_con->thread = NULL;
-
return db_con;
}
@@ -866,14 +811,10 @@
db_con = g_new0 (DBConnection, 1);
- db_con->db_type = TRACKER_DB_TYPE_INDEX;
- db_con->db_category = DB_CATEGORY_FILES;
db_con->index = db_con;
open_file_db (db_con);
- db_con->thread = NULL;
-
return db_con;
}
@@ -895,16 +836,11 @@
db_con = g_new0 (DBConnection, 1);
- db_con->db_type = TRACKER_DB_TYPE_INDEX;
- db_con->db_category = DB_CATEGORY_EMAILS;
-
db_con->index = db_con;
db_con->emails = db_con;
open_email_db (db_con);
- db_con->thread = NULL;
-
return db_con;
}
@@ -933,14 +869,10 @@
db_con = g_new0 (DBConnection, 1);
- db_con->db_type = TRACKER_DB_TYPE_CONTENT;
- db_con->db_category = DB_CATEGORY_FILES;
db_con->blob = db_con;
open_file_content_db (db_con);
- db_con->thread = NULL;
-
return db_con;
}
@@ -969,14 +901,10 @@
db_con = g_new0 (DBConnection, 1);
- db_con->db_type = TRACKER_DB_TYPE_CONTENT;
- db_con->db_category = DB_CATEGORY_EMAILS;
db_con->blob = db_con;
open_email_content_db (db_con);
- db_con->thread = NULL;
-
return db_con;
}
@@ -1066,9 +994,6 @@
tracker_db_interface_set_procedure_table (db_con->db, prepared_queries);
g_free (dbname);
- db_con->db_type = TRACKER_DB_TYPE_CACHE;
- db_con->cache = db_con;
-
tracker_db_set_default_pragmas (db_con);
if (!tracker_config_get_low_memory_mode (tracker->config)) {
@@ -1083,8 +1008,6 @@
tracker_db_exec_no_reply (db_con, "ANALYZE");
}
- db_con->thread = NULL;
-
return db_con;
}
@@ -1113,9 +1036,6 @@
g_free (dbname);
- db_con->db_type = TRACKER_DB_TYPE_EMAIL;
- db_con->db_category = DB_CATEGORY_EMAILS;
-
db_con->emails = db_con;
tracker_db_exec_no_reply (db_con, "PRAGMA page_size = %d", 4096);
@@ -1149,8 +1069,6 @@
tracker_db_attach_db (db_con, "common");
tracker_db_attach_db (db_con, "cache");
- db_con->thread = NULL;
-
return db_con;
}
@@ -1475,9 +1393,7 @@
str_file_id = tracker_uint_to_string (id);
- lock_connection (db_con);
result_set = tracker_db_interface_execute_procedure (db_con->db, NULL, "GetAllContents", str_file_id, NULL);
- unlock_connection (db_con);
g_free (str_file_id);
@@ -3090,7 +3006,7 @@
tracker_debug ("LiveSearchUpdateQuery: %s", m_query);
- result = tracker_db_interface_execute_query (db_con->common, NULL, m_query);
+ result = tracker_db_interface_execute_query (db_con->common->db, NULL, m_query);
g_static_rec_mutex_unlock (&events_table_lock);
@@ -3270,19 +3186,15 @@
if (service_type_id != -1) {
gchar *parent;
- // gchar *apath = tracker_escape_string (path);
- // gchar *aname = tracker_escape_string (name);
-
b = tracker_exec_proc (db_con, "CreateService", sid, path, name,
str_service_type_id, info->mime, str_filesize,
str_is_dir, str_is_link, str_offset, str_mtime, str_aux, NULL);
- // g_free (apath);
- // g_free (aname);
- if (b)
+ if (b) {
g_object_unref (b);
-
- if (db_con->in_error) {
+ }
+ /*
+ Undetectable error
tracker_error ("ERROR: CreateService uri is %s/%s", path, name);
g_free (name);
g_free (path);
@@ -3294,7 +3206,7 @@
g_free (str_offset);
g_static_rec_mutex_unlock (&events_table_lock);
return 0;
- }
+ */
id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (db_con->db));
if (info->is_hidden) {
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 Mon May 5 12:01:41 2008
@@ -33,27 +33,14 @@
struct DBConnection {
TrackerDBInterface *db;
- TrackerDBType db_type;
- DBCategory db_category;
- char *err;
- char *name;
- char *file_name;
- int rc;
- char *thread; /* name of the thread that created this */
-
- guint in_transaction : 1;
- guint in_error : 1;
/* pointers to other database connection objects */
DBConnection *data;
DBConnection *common;
- DBConnection *files;
DBConnection *index;
DBConnection *emails;
- DBConnection *others;
DBConnection *blob;
DBConnection *cache;
- DBConnection *user;
gpointer word_index;
};
@@ -306,6 +293,7 @@
gint field_count,
gboolean is_select,
gboolean is_condition);
+gboolean tracker_db_is_in_transaction (DBConnection *db_con);
void tracker_db_start_index_transaction (DBConnection *db_con);
void tracker_db_end_index_transaction (DBConnection *db_con);
gboolean tracker_db_regulate_transactions (DBConnection *db_con,
Modified: branches/indexer-split/src/trackerd/trackerd.c
==============================================================================
--- branches/indexer-split/src/trackerd/trackerd.c (original)
+++ branches/indexer-split/src/trackerd/trackerd.c Mon May 5 12:01:41 2008
@@ -867,8 +867,6 @@
/* Set up main database connection */
db_con = tracker_db_connect ();
- db_con->thread = "main";
-
/* check db integrity if not previously shut down cleanly */
if (!tracker->readonly && !need_index && tracker_db_get_option_int (db_con, "IntegrityCheck") == 1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]