From ff4f37d14fe88b3870a07f65d44bd90e3db66edf Mon Sep 17 00:00:00 2001 From: Martin Raiber Date: Sat, 29 Oct 2011 22:06:37 +0200 Subject: [PATCH 1/2] Fixed build with Berkley DB --- Database.cpp | 14 ++++++++++++ Database.h | 1 + Interface/Database.h | 2 ++ Query.cpp | 7 +++++- bdbplugin/Makefile.am | 7 +++--- bdbplugin/configure.ac | 6 +++-- bdbplugin/dllmain.cpp | 5 +++++ bdbplugin/m4/ax_berkeley_db.m4 | 2 +- bdbplugin/m4/ax_berkeley_db_sql.m4 | 35 +++++++++++++++++++++--------- start_urbackup_server | 8 ++++++- switch_build.sh | 19 +++++++++++----- urbackup/dllmain.cpp | 9 +++----- urbackup/server_cleanup.cpp | 8 +++++-- urbackup/server_update_stats.cpp | 15 ++++++++++--- 14 files changed, 103 insertions(+), 35 deletions(-) diff --git a/Database.cpp b/Database.cpp index 353aabf5..3544b9dd 100644 --- a/Database.cpp +++ b/Database.cpp @@ -26,7 +26,12 @@ #ifndef BDBPLUGIN #include "Server.h" #else +#ifdef LINUX +#include "bdbplugin/config.h" +#include DB_HEADER +#else #include +#endif #include "Interface/Server.h" #endif #include "Query.h" @@ -404,5 +409,14 @@ bool CDatabase::Dump(const std::string &pFile) return true; } + +std::string CDatabase::getEngineName(void) +{ + #ifndef BDBPLUGIN + return "sqlite"; + #else + return "bdb"; + #endif +} #endif \ No newline at end of file diff --git a/Database.h b/Database.h index 9c4f9fe1..24f6bfbb 100644 --- a/Database.h +++ b/Database.h @@ -44,6 +44,7 @@ public: virtual bool Import(const std::string &pFile); virtual bool Dump(const std::string &pFile); + virtual std::string getEngineName(void); private: db_nresults results; diff --git a/Interface/Database.h b/Interface/Database.h index c2b59fd7..5e93dc39 100644 --- a/Interface/Database.h +++ b/Interface/Database.h @@ -25,6 +25,8 @@ public: virtual bool Import(const std::string &pFile)=0; virtual bool Dump(const std::string &pFile)=0; + + virtual std::string getEngineName(void)=0; }; #endif diff --git a/Query.cpp b/Query.cpp index 609aee8f..e9be795f 100644 --- a/Query.cpp +++ b/Query.cpp @@ -24,7 +24,12 @@ #include "Server.h" #else #include "Interface/Server.h" -#include "db.h" +#ifdef LINUX +#include "bdbplugin/config.h" +#include DB_HEADER +#else +#include +#endif #endif #include "sqlite/sqlite3.h" #include "Database.h" diff --git a/bdbplugin/Makefile.am b/bdbplugin/Makefile.am index 66a504f3..ffc3234e 100644 --- a/bdbplugin/Makefile.am +++ b/bdbplugin/Makefile.am @@ -1,7 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = liburbackupserver_bdbplugin.la liburbackupserver_bdbplugin_la_SOURCES = dllmain.cpp BDBFactory.cpp ../Database.cpp ../Query.cpp ../sqlite/shell.c -noinst_HEADERS = IUrlFactory.h pluginmgr.h UrlFactory.h -AM_CXXFLAGS = -DLINUX -DBDBPLUGIN $(BDBSQL_CFLAGS) $(BDB_CFLAGS) -AM_LDFLAGS =$(BDBSQL_LIBS) $(BDB_LIBS) -noinst_HEADERS=../Interface/DatabaseInt.h ../Interface/DatabaseFactory.h ../Interface/Server.h ../Interface/File.h ../sqlite/sqlite3.h ../sqlite/shell.h ../Query.h ../Database.h ../vld.h \ No newline at end of file +AM_CXXFLAGS = -DLINUX -DBDBPLUGIN +AM_LDFLAGS =$(DB_SQL_LIBS) +noinst_HEADERS=../Interface/Database.h ../Interface/Query.h ../Interface/Object.h ../Interface/Mutex.h ../Interface/Condition.h ../Interface/DatabaseInt.h ../Interface/DatabaseFactory.h ../Interface/Server.h ../Interface/File.h ../sqlite/sqlite3.h ../sqlite/shell.h ../Query.h ../Database.h ../vld.h ../Interface/Types.h BDBFactory.h \ No newline at end of file diff --git a/bdbplugin/configure.ac b/bdbplugin/configure.ac index 6b17d085..b36e3289 100644 --- a/bdbplugin/configure.ac +++ b/bdbplugin/configure.ac @@ -14,8 +14,10 @@ AC_PROG_LIBTOOL # Checks for libraries. -AX_BERKELEY_DB(5.1,, AC_MSG_ERROR([Sorry, you need BerkleyDB. Please look for distribution packages(libdb-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/])) -AX_BERKELEY_DB_SQL(5.1,, AC_MSG_ERROR([Sorry, you need SQL support for BerkleyDB. Please look for distribution packages(libdb-sql-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/])) +#AX_BERKELEY_DB(5.1,, AC_MSG_ERROR([Sorry, you need BerkleyDB. Please look for distribution packages(libdb-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/])) +AX_BERKELEY_DB_SQL(5.1,, [ + AC_MSG_ERROR([Sorry, you need BerkleyDB with SQL support. Please look for distribution packages(libdb-sql-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/]) +]) # Checks for header files. AC_HEADER_STDC diff --git a/bdbplugin/dllmain.cpp b/bdbplugin/dllmain.cpp index 10e14bd9..b21ee8d7 100644 --- a/bdbplugin/dllmain.cpp +++ b/bdbplugin/dllmain.cpp @@ -28,7 +28,12 @@ #include "../Interface/Server.h" #include "../Database.h" #include "BDBFactory.h" +#ifdef LINUX +#include "config.h" +#include DB_HEADER +#else #include +#endif #include "../sqlite/sqlite3.h" IServer *Server=NULL; diff --git a/bdbplugin/m4/ax_berkeley_db.m4 b/bdbplugin/m4/ax_berkeley_db.m4 index 136427ce..a7965208 100644 --- a/bdbplugin/m4/ax_berkeley_db.m4 +++ b/bdbplugin/m4/ax_berkeley_db.m4 @@ -56,7 +56,7 @@ AC_DEFUN([AX_BERKELEY_DB], AC_MSG_CHECKING([for Berkeley DB >= $minversion]) fi - for version in "" 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do + for version in "" 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do if test -z $version ; then db_lib="-ldb" diff --git a/bdbplugin/m4/ax_berkeley_db_sql.m4 b/bdbplugin/m4/ax_berkeley_db_sql.m4 index e3a5166b..6b1f1e44 100644 --- a/bdbplugin/m4/ax_berkeley_db_sql.m4 +++ b/bdbplugin/m4/ax_berkeley_db_sql.m4 @@ -30,7 +30,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AC_DEFUN([AX_BERKELEY_DB_SQL], [ @@ -39,13 +39,13 @@ AC_DEFUN([AX_BERKELEY_DB_SQL], minversion=ifelse([$1], ,,$1) DB_HEADER="" - DB_LIBS="" + DB_SQL_LIBS="" if test -z $minversion ; then minvermajor=0 minverminor=0 minverpatch=0 - AC_MSG_CHECKING([for Berkeley DB]) + AC_MSG_CHECKING([for Berkeley DB SQL]) else minvermajor=`echo $minversion | cut -d. -f1` minverminor=`echo $minversion | cut -d. -f2` @@ -53,18 +53,32 @@ AC_DEFUN([AX_BERKELEY_DB_SQL], minvermajor=${minvermajor:-0} minverminor=${minverminor:-0} minverpatch=${minverpatch:-0} - AC_MSG_CHECKING([for Berkeley DB >= $minversion]) + AC_MSG_CHECKING([for Berkeley DB SQL>= $minversion]) fi for version in "" 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do + for version2 in "" 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do if test -z $version ; then - db_lib="-ldb_sql -ldb" - try_headers="db.h" + if test -z $version2 ; then + db_lib="-ldb_sql -ldb -ldl" + try_headers="db.h" + else + db_lib="-ldb_sql-$version2 -ldb -ldl" + try_headers="db.h" + fi else - db_lib="-ldb_sql-$version -ldb-$version" + if test "x$version2" != "x"; then + continue 1; + fi + db_lib="-ldb_sql-$version -ldb-$version -ldl" try_headers="db$version/db.h db`echo $version | sed -e 's,\..*,,g'`/db.h" + + fi + + #echo $db_lib + #echo $try_headers LIBS="$old_LIBS $db_lib" @@ -92,20 +106,21 @@ AC_DEFUN([AX_BERKELEY_DB_SQL], AC_MSG_RESULT([header $db_hdr, library $db_lib]) DB_HEADER="$db_hdr" - DB_LIBS="$db_lib" + DB_SQL_LIBS="$db_lib" ]) fi done done + done LIBS="$old_LIBS" - if test -z $DB_HEADER ; then + if test -z "$DB_HEADER" ; then AC_MSG_RESULT([not found]) ifelse([$3], , :, [$3]) else AC_DEFINE_UNQUOTED(DB_HEADER, ["$DB_HEADER"], ["Berkeley DB Header File"]) - AC_SUBST(DB_LIBS) + AC_SUBST(DB_SQL_LIBS) ifelse([$2], , :, [$2]) fi ]) diff --git a/start_urbackup_server b/start_urbackup_server index 448a3e4a..40ee2ca2 100755 --- a/start_urbackup_server +++ b/start_urbackup_server @@ -32,7 +32,13 @@ then PLUGIN_URL="" fi -DAEMON_PLUGINS="$PLUGIN_PYCHART $PLUGIN_URL --plugin $DAEMON_LIBS/liburbackupserver_downloadplugin.so --plugin $DAEMON_LIBS/liburbackupserver_fsimageplugin.so --plugin $DAEMON_LIBS/liburbackupserver.so --plugin $DAEMON_LIBS/liburbackupserver_httpserver.so --http_root $DAEMON_DIR/urbackup/www --workingdir $DAEMON_DIR --server true --user urbackup" +PLUGIN_BDB="--plugin $DAEMON_LIBS/liburbackupserver_bdbplugin.so" +if ! test -e $DAEMON_LIBS/liburbackupserver_bdbplugin.so +then + PLUGIN_BDB="" +fi + +DAEMON_PLUGINS="$PLUGIN_BDB $PLUGIN_PYCHART $PLUGIN_URL --plugin $DAEMON_LIBS/liburbackupserver_downloadplugin.so --plugin $DAEMON_LIBS/liburbackupserver_fsimageplugin.so --plugin $DAEMON_LIBS/liburbackupserver.so --plugin $DAEMON_LIBS/liburbackupserver_httpserver.so --http_root $DAEMON_DIR/urbackup/www --workingdir $DAEMON_DIR --server true --user urbackup" S_DAEMON="--daemon" print_help() diff --git a/switch_build.sh b/switch_build.sh index 627e037b..ee742b46 100755 --- a/switch_build.sh +++ b/switch_build.sh @@ -4,15 +4,21 @@ cbuild="" switch_m_build() { - cp defaults_$cbuild defaults - cp init.d_$cbuild init.d + if test -e defaults_$cbuild + then + cp defaults_$cbuild defaults + cp init.d_$cbuild init.d + fi } switch_build() { - pwd - cp Makefile.am_$cbuild Makefile.am - cp configure.ac_$cbuild configure.ac + if test -e Makefile.am_$cbuild + then + pwd + cp Makefile.am_$cbuild Makefile.am + cp configure.ac_$cbuild configure.ac + fi } switch() @@ -31,6 +37,9 @@ then elif [[ "x$1" == "xclient" ]] then cbuild="client" +elif [[ "x$1" == "xbdbplugin" ]] +then + cbuild="bdbplugin" else echo "No valid build enviroment. Available: client, server" exit 0 diff --git a/urbackup/dllmain.cpp b/urbackup/dllmain.cpp index b4dfc691..f532b1a1 100644 --- a/urbackup/dllmain.cpp +++ b/urbackup/dllmain.cpp @@ -310,16 +310,13 @@ DLLEXPORT void LoadActions(IServer* pServer) #ifndef CLIENT_ONLY if(both || (!both && !is_backup_client) ) { - std::string bdb_config="mutex_set_max 1000000\r\nset_tx_max 500000\r\nset_lg_regionmax 524288\r\nset_lg_bsize 4194304\r\nset_lg_max 20971520\r\nset_lk_max_locks 10000\r\nset_lk_max_lockers 10000\r\nset_lk_max_objects 10000\r\n"; + std::string bdb_config="mutex_set_max 1000000\r\nset_tx_max 500000\r\nset_lg_regionmax 10485760\r\nset_lg_bsize 4194304\r\nset_lg_max 20971520\r\nset_lk_max_locks 10000\r\nset_lk_max_lockers 10000\r\nset_lk_max_objects 10000\r\nset_cachesize 0 314572800 1"; - if( !FileExists("urbackup/backup_server.db") && FileExists("urbackup/backup_server.db.template") ) + if( !FileExists("urbackup/backup_server.bdb") && !FileExists("urbackup/backup_server.db") && FileExists("urbackup/backup_server.db.template") ) { copy_file(L"urbackup/backup_server.db.template", L"urbackup/backup_server.db"); } - else if( !FileExists("urbackup/backup_server.db") && !FileExists("urbackup/backup_server.bdb") && FileExists("urbackup/backup_server.bdb.template") ) - { - copy_file(L"urbackup/backup_server.bdb.template", L"urbackup/backup_server.bdb"); - } + if( !FileExists("urbackup/backup_server.db") ) { bool init=false; diff --git a/urbackup/server_cleanup.cpp b/urbackup/server_cleanup.cpp index a847be23..7bba714a 100644 --- a/urbackup/server_cleanup.cpp +++ b/urbackup/server_cleanup.cpp @@ -142,8 +142,12 @@ void ServerCleanupThread::updateStats(bool interruptible) void ServerCleanupThread::do_cleanup(void) { - db_results cache_res=db->Read("PRAGMA cache_size"); - db->Write("PRAGMA cache_size = 100000"); + db_results cache_res; + if(db->getEngineName()=="sqlite") + { + cache_res=db->Read("PRAGMA cache_size"); + db->Write("PRAGMA cache_size = 100000"); + } removeerr.clear(); cleanup_images(); diff --git a/urbackup/server_update_stats.cpp b/urbackup/server_update_stats.cpp index 7e52826a..81042fbf 100644 --- a/urbackup/server_update_stats.cpp +++ b/urbackup/server_update_stats.cpp @@ -15,7 +15,7 @@ const bool update_stats_use_transactions_del=true; const bool update_stats_use_transactions_done=false; const bool update_stats_autocommit=true; -const bool update_stats_bulk_done_files=true; +bool update_stats_bulk_done_files=true; ServerUpdateStats::ServerUpdateStats(bool image_repair_mode, bool interruptible) : image_repair_mode(image_repair_mode), interruptible(interruptible) @@ -77,8 +77,12 @@ void ServerUpdateStats::destroyQueries(void) void ServerUpdateStats::operator()(void) { db=Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER); - db_results cache_res=db->Read("PRAGMA cache_size"); - db->Write("PRAGMA cache_size = 100000"); + db_results cache_res; + if(db->getEngineName()=="sqlite") + { + cache_res=db->Read("PRAGMA cache_size"); + db->Write("PRAGMA cache_size = 100000"); + } createQueries(); @@ -184,6 +188,11 @@ void ServerUpdateStats::update_files(void) unsigned int last_commit_time=Server->getTimeMS(); std::map del_sizes; + + if(db->getEngineName()=="bdb") + { + update_stats_bulk_done_files=false; + } if(!update_stats_autocommit) { From bee572a72840e5844593abdd2068b0b562d08384 Mon Sep 17 00:00:00 2001 From: Martin Raiber Date: Sat, 5 Nov 2011 13:50:23 +0100 Subject: [PATCH 2/2] Optimized BerkeleyDB backend --- Database.cpp | 18 +++++++++++++++--- bdbplugin/configure.ac | 2 +- bdbplugin/m4/ax_berkeley_db_sql.m4 | 6 +++--- urbackup/dllmain.cpp | 2 +- urbackup/server_update_stats.cpp | 9 +++++---- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Database.cpp b/Database.cpp index 3544b9dd..99028dfd 100644 --- a/Database.cpp +++ b/Database.cpp @@ -105,9 +105,21 @@ bool CDatabase::Open(std::string pFile) } else { - sqlite3_busy_timeout(db, 50); - Write("PRAGMA foreign_keys = ON"); - Write("PRAGMA synchronous=NORMAL"); + + #ifdef BDBPLUGIN + db_results res=Read("PRAGMA multiversion"); + if(!res.empty() && res[0][L"multiversion"]!=L"1") + { + Write("PRAGMA multiversion=ON"); + } + Write("PRAGMA synchronous=ON"); + Write("PRAGMA snapshot_isolation=ON"); + //Write("PRAGMA bdbsql_error_file='urbackup/bdb_errors.log'"); + #else + Write("PRAGMA synchronous=NORMAL"); + #endif + Write("PRAGMA foreign_keys = ON"); + sqlite3_busy_timeout(db, 50); return true; } } diff --git a/bdbplugin/configure.ac b/bdbplugin/configure.ac index b36e3289..762bf574 100644 --- a/bdbplugin/configure.ac +++ b/bdbplugin/configure.ac @@ -15,7 +15,7 @@ AC_PROG_LIBTOOL # Checks for libraries. #AX_BERKELEY_DB(5.1,, AC_MSG_ERROR([Sorry, you need BerkleyDB. Please look for distribution packages(libdb-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/])) -AX_BERKELEY_DB_SQL(5.1,, [ +AX_BERKELEY_DB_SQL(5.2,, [ AC_MSG_ERROR([Sorry, you need BerkleyDB with SQL support. Please look for distribution packages(libdb-sql-dev) or get it from http://www.oracle.com/technetwork/database/berkeleydb/]) ]) diff --git a/bdbplugin/m4/ax_berkeley_db_sql.m4 b/bdbplugin/m4/ax_berkeley_db_sql.m4 index 6b1f1e44..2cdd2828 100644 --- a/bdbplugin/m4/ax_berkeley_db_sql.m4 +++ b/bdbplugin/m4/ax_berkeley_db_sql.m4 @@ -56,8 +56,8 @@ AC_DEFUN([AX_BERKELEY_DB_SQL], AC_MSG_CHECKING([for Berkeley DB SQL>= $minversion]) fi - for version in "" 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do - for version2 in "" 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ; do + for version in 5.2 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 ""; do + for version2 in "" 5.2 5.1 5.0 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1; do if test -z $version ; then if test -z $version2 ; then @@ -72,7 +72,7 @@ AC_DEFUN([AX_BERKELEY_DB_SQL], continue 1; fi db_lib="-ldb_sql-$version -ldb-$version -ldl" - try_headers="db$version/db.h db`echo $version | sed -e 's,\..*,,g'`/db.h" + try_headers="db$version/db.h db`echo $version | sed -e 's,\..*,,g'`/db.h db.h" fi diff --git a/urbackup/dllmain.cpp b/urbackup/dllmain.cpp index ce539228..e023e65e 100644 --- a/urbackup/dllmain.cpp +++ b/urbackup/dllmain.cpp @@ -310,7 +310,7 @@ DLLEXPORT void LoadActions(IServer* pServer) #ifndef CLIENT_ONLY if(both || (!both && !is_backup_client) ) { - std::string bdb_config="mutex_set_max 1000000\r\nset_tx_max 500000\r\nset_lg_regionmax 10485760\r\nset_lg_bsize 4194304\r\nset_lg_max 20971520\r\nset_lk_max_locks 10000\r\nset_lk_max_lockers 10000\r\nset_lk_max_objects 10000\r\nset_cachesize 0 314572800 1"; + std::string bdb_config="mutex_set_max 1000000\r\nset_tx_max 500000\r\nset_lg_regionmax 10485760\r\nset_lg_bsize 4194304\r\nset_lg_max 20971520\r\nset_lk_max_locks 100000\r\nset_lk_max_lockers 10000\r\nset_lk_max_objects 100000\r\nset_cachesize 0 104857600 1"; if( !FileExists("urbackup/backup_server.bdb") && !FileExists("urbackup/backup_server.db") && FileExists("urbackup/backup_server.db.template") ) { diff --git a/urbackup/server_update_stats.cpp b/urbackup/server_update_stats.cpp index aa41ed8e..37147963 100644 --- a/urbackup/server_update_stats.cpp +++ b/urbackup/server_update_stats.cpp @@ -12,7 +12,7 @@ #include "server_status.h" #include "server_get.h" -const bool update_stats_use_transactions_del=true; +bool update_stats_use_transactions_del=true; const bool update_stats_use_transactions_done=false; const bool update_stats_autocommit=true; bool update_stats_bulk_done_files=true; @@ -26,10 +26,10 @@ void ServerUpdateStats::createQueries(void) { q_get_images=db->Prepare("SELECT id,clientid,path FROM backup_images WHERE complete=1 AND runningPrepare("UPDATE clients SET bytes_used_images=? WHERE id=?", false); - q_get_ncount_files=db->Prepare("SELECT a.rowid AS id, shahash, filesize, rsize, clientid, backupid FROM files WHERE did_count=0 LIMIT 10000", false); + q_get_ncount_files=db->Prepare("SELECT rowid AS id, shahash, filesize, rsize, clientid, backupid FROM files WHERE did_count=0 LIMIT 10000", false); q_has_client=db->Prepare("SELECT count(*) AS c FROM files WHERE shahash=? AND filesize=? AND clientid=?", false); q_mark_done=db->Prepare("UPDATE files SET did_count=1 WHERE rowid=?", false); - q_get_clients=db->Prepare("SELECT clientid, SUM(rsize) AS s_rsize FROM files WHERE shahash=? AND filesize=? AND did_count=1 GROUP BY clientid", false); + q_get_clients=db->Prepare("SELECT clientid, SUM(rsize) AS s_rsize FROM files WHERE shahash=? AND filesize=? AND +did_count=1 GROUP BY clientid", false); q_get_sizes=db->Prepare("SELECT id,bytes_used_files FROM clients", false); q_size_update=db->Prepare("UPDATE clients SET bytes_used_files=? WHERE id=?", false); q_get_delfiles=db->Prepare("SELECT files_del.rowid AS id, shahash, filesize, rsize, clientid, backupid, incremental, is_del FROM files_del LIMIT 10000", false); @@ -42,7 +42,7 @@ void ServerUpdateStats::createQueries(void) q_save_client_hist=db->Prepare("INSERT INTO clients_hist (id, name, lastbackup, lastseen, lastbackup_image, bytes_used_files, bytes_used_images, hist_id) SELECT id, name, lastbackup, lastseen, lastbackup_image, bytes_used_files, bytes_used_images, ? AS hist_id FROM clients", false); q_set_file_backup_null=db->Prepare("UPDATE backups SET size_bytes=0 WHERE size_bytes=-1 AND complete=1", false); q_transfer_bytes=db->Prepare("UPDATE files SET rsize=? WHERE rowid=?", false); - q_get_transfer=db->Prepare("SELECT rowid AS id FROM files WHERE shahash=? AND filesize=? AND did_count=1 AND rsize=0 LIMIT 1", false); + q_get_transfer=db->Prepare("SELECT rowid AS id FROM files WHERE shahash=? AND filesize=? AND +did_count=1 AND +rsize=0 LIMIT 1", false); q_create_hist=db->Prepare("INSERT INTO clients_hist_id (created) VALUES (CURRENT_TIMESTAMP)", false); q_get_all_clients=db->Prepare("SELECT id FROM clients", false); q_mark_done_bulk_files=db->Prepare("UPDATE files SET did_count=1 WHERE rowid IN ( SELECT rowid FROM files WHERE did_count=0 LIMIT 10000 )"); @@ -192,6 +192,7 @@ void ServerUpdateStats::update_files(void) if(db->getEngineName()=="bdb") { update_stats_bulk_done_files=false; + update_stats_use_transactions_del=false; } if(!update_stats_autocommit)