aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_db.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2010-04-26 12:56:01 -0700
committerPeter Seebach <peter.seebach@windriver.com>2010-04-27 10:14:01 -0700
commit7447c7adcf6ad7ef5c0bf97ce96da98cd724bb22 (patch)
tree1835aafc29700e72a2638d7099a1895ba193c485 /pseudo_db.c
parentb0dc7011bb3efb160223fd759544de9987129d99 (diff)
downloadpseudo-7447c7adcf6ad7ef5c0bf97ce96da98cd724bb22.tar.gz
pseudo-7447c7adcf6ad7ef5c0bf97ce96da98cd724bb22.tar.bz2
pseudo-7447c7adcf6ad7ef5c0bf97ce96da98cd724bb22.zip
Fix link(), improve startup performance.
Stop vacuuming the logs database under normal usage -- it's expensive and slow, and not useful. Make link(2) "correctly" (following Linux, rather than POSIX) link to a symlink rather than to the file the symlink links to.
Diffstat (limited to 'pseudo_db.c')
-rw-r--r--pseudo_db.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/pseudo_db.c b/pseudo_db.c
index 0af38eb..e4047fa 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -547,8 +547,17 @@ get_db(sqlite3 **db) {
}
sqlite3_free_table(results);
}
- /* cleanup database before getting started */
- sqlite3_exec(*db, "VACUUM;", NULL, NULL, &errmsg);
+ /* cleanup database before getting started
+ *
+ * On a large build, the logs database gets GIGANTIC... And
+ * we rarely-if-ever delete things from it. So instead of
+ * doing the vacuum operation on it at startup, which can impose
+ * a several-minute delay, we do it only on deletions.
+ *
+ */
+ if (db == &file_db) {
+ sqlite3_exec(*db, "VACUUM;", NULL, NULL, &errmsg);
+ }
return rc;
}
@@ -1089,6 +1098,9 @@ pdb_history(pseudo_query_t *traits, unsigned long fields, int unique, int do_del
int rc = sqlite3_step(select);
if (rc != SQLITE_DONE) {
dberr(log_db, "deletion failed");
+ } else {
+ pseudo_diag("Deleted records, vacuuming log database (may take a while).\n");
+ sqlite3_exec(log_db, "VACUUM;", NULL, NULL, NULL);
}
sqlite3_finalize(select);
return 0;