From: Kern Sibbald Date: Wed, 26 Sep 2007 21:21:35 +0000 (+0000) Subject: kes Setup SQLite busy handler before doing queries. X-Git-Tag: Release-7.0.0~5596 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cb9d31f973f0b6fc5b8e1d4d4fa1acd89b88055f;p=bacula%2Fbacula kes Setup SQLite busy handler before doing queries. kes Don't overwrite error message in check_tables_version. kes Unlock batch insert tables with same calls used elsewhere. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5662 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 10bfaf3085..8a61c449d9 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -115,7 +115,6 @@ bool check_tables_version(JCR *jcr, B_DB *mdb) bacula_db_version = 0; if (!db_sql_query(mdb, query, int_handler, (void *)&bacula_db_version)) { - Mmsg(mdb->errmsg, "Database not created or server not running.\n"); Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg); return false; } diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index c619146c4d..5c9c11fa5a 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -795,7 +795,7 @@ bool db_write_batch_file_records(JCR *jcr) if (!db_sql_query(jcr->db_batch,sql_batch_fill_filename_query, NULL,NULL)) { Jmsg(jcr,M_FATAL,0,"Can't fill Filename table %s\n",jcr->db_batch->errmsg); - QUERY_DB(jcr, jcr->db_batch, sql_batch_unlock_tables_query); + db_sql_query(jcr->db_batch, sql_batch_unlock_tables_query, NULL, NULL); return false; } diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 9b0ede7ac9..9459f3b8b5 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -211,6 +211,13 @@ db_open_database(JCR *jcr, B_DB *mdb) mdb->connected = true; free(db_name); + /* set busy handler to wait when we use mult_db_connections = 1 */ +#ifdef HAVE_SQLITE3 + sqlite3_busy_handler(mdb->db, my_busy_handler, NULL); +#else + sqlite_busy_handler(mdb->db, my_busy_handler, NULL); +#endif + #if defined(HAVE_SQLITE3) && defined(SQLITE3_INIT_QUERY) db_sql_query(mdb, SQLITE3_INIT_QUERY, NULL, NULL); #endif @@ -220,12 +227,6 @@ db_open_database(JCR *jcr, B_DB *mdb) return 0; } - /* set busy handler to wait when we use mult_db_connections = 1 */ -#ifdef HAVE_SQLITE3 - sqlite3_busy_handler(mdb->db, my_busy_handler, NULL); -#else - sqlite_busy_handler(mdb->db, my_busy_handler, NULL); -#endif V(mutex); return 1; diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index c64ba8795b..2aec7b22c4 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -2,6 +2,9 @@ General: 26Sep07 +kes Setup SQLite busy handler before doing queries. +kes Don't overwrite error message in check_tables_version. +kes Unlock batch insert tables with same calls used elsewhere. kes Allow starting 59 jobs a second. kes Make SD session key more random. kes Add retry for SQLite opening db if it fails.