evolution-data-server r9074 - branches/camel-db-summary/camel
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9074 - branches/camel-db-summary/camel
- Date: Tue, 1 Jul 2008 06:01:46 +0000 (UTC)
Author: sragavan
Date: Tue Jul 1 06:01:46 2008
New Revision: 9074
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9074&view=rev
Log:
More sqlite coolness.
Modified:
branches/camel-db-summary/camel/camel-db.c
branches/camel-db-summary/camel/camel-db.h
branches/camel-db-summary/camel/camel-folder-summary.c
branches/camel-db-summary/camel/camel-folder-summary.h
branches/camel-db-summary/camel/camel-vee-summary.c
Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c (original)
+++ branches/camel-db-summary/camel/camel-db.c Tue Jul 1 06:01:46 2008
@@ -28,6 +28,8 @@
while (ret == SQLITE_BUSY || ret == SQLITE_LOCKED || ret == -1) {
ret = sqlite3_exec(db, stmt, 0, 0, &errmsg);
}
+
+ sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
if (ret != SQLITE_OK) {
d(g_print ("Error in SQL EXEC statement: %s [%s].\n", stmt, errmsg));
@@ -46,6 +48,8 @@
sqlite3 *db;
int ret;
+ sqlite3_enable_shared_cache(TRUE);
+
ret = sqlite3_open(path, &db);
if (ret) {
@@ -211,6 +215,8 @@
ret = sqlite3_exec (cdb->db, query, count_cb, count, &errmsg);
}
+ sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
+
if (ret != SQLITE_OK) {
g_print ("Error in SQL SELECT statement: %s [%s]\n", query, errmsg);
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _(errmsg));
@@ -355,6 +361,8 @@
ret = sqlite3_exec (cdb->db, stmt, callback, data, &errmsg);
}
+ sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
+
if (ret != SQLITE_OK) {
d(g_warning ("Error in select statement '%s' [%s].\n", stmt, errmsg));
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, errmsg);
Modified: branches/camel-db-summary/camel/camel-db.h
==============================================================================
--- branches/camel-db-summary/camel/camel-db.h (original)
+++ branches/camel-db-summary/camel/camel-db.h Tue Jul 1 06:01:46 2008
@@ -13,6 +13,7 @@
GMutex *lock;
};
+#define CAMEL_DB_FREE_CACHE_SIZE 2 * 1024 * 1024
/* The extensive DB format, supporting basic searching and sorting
uid, - Message UID
Modified: branches/camel-db-summary/camel/camel-folder-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.c (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.c Tue Jul 1 06:01:46 2008
@@ -65,7 +65,7 @@
/* To switch between e-memchunk and g-alloc */
#define ALWAYS_ALLOC 1
#define USE_GSLICE 1
-#define SUMMARY_CACHE_DROP 120
+#define SUMMARY_CACHE_DROP 180
static pthread_mutex_t info_lock = PTHREAD_MUTEX_INITIALIZER;
/* this lock is ONLY for the standalone messageinfo stuff */
@@ -712,16 +712,22 @@
remove_cache (CamelFolderSummary *s)
{
struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
+
/* Attempt to release 2MB*/
- sqlite3_release_memory(2*1024*1024);
+ sqlite3_release_memory(CAMEL_DB_FREE_CACHE_SIZE);
+
if (time(NULL) - s->cache_load_time < SUMMARY_CACHE_DROP)
return TRUE;
+
printf("removing cache for %s %d\n", s->folder->full_name, g_hash_table_size (s->loaded_infos));
#warning "hack. fix it"
CAMEL_SUMMARY_LOCK (s, summary_lock);
g_hash_table_foreach_remove (s->loaded_infos, remove_item, s);
CAMEL_SUMMARY_UNLOCK (s, summary_lock);
printf("done .. now %d\n",g_hash_table_size (s->loaded_infos));
+
+ s->cache_load_time = time(NULL);
+
return TRUE;
}
Modified: branches/camel-db-summary/camel/camel-folder-summary.h
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.h (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.h Tue Jul 1 06:01:46 2008
@@ -154,7 +154,7 @@
guint32 refcount; /* ??? */
char *uid;
/*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
- gboolean dirty;
+ int dirty:1;
};
/* For classes wishing to do the provided i/o, or for anonymous users,
@@ -166,7 +166,7 @@
guint32 refcount; /* ??? */
char *uid;
/*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
- gboolean dirty;
+ int dirty:1;
const char *subject;
const char *from;
Modified: branches/camel-db-summary/camel/camel-vee-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-vee-summary.c (original)
+++ branches/camel-db-summary/camel/camel-vee-summary.c Tue Jul 1 06:01:46 2008
@@ -307,7 +307,8 @@
mi = (CamelVeeMessageInfo *)camel_message_info_new(&s->summary);
mi->summary = summary;
camel_object_ref (summary);
- mi->info.uid = vuid;
+ mi->info.uid = camel_pstring_strdup (vuid);
+ g_free (vuid);
camel_message_info_ref (mi);
camel_folder_summary_insert(&s->summary, (CamelMessageInfo *)mi, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]