]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/sql.c
Fix #1648 about make_catalog_backup.pl with multiple catalog
[bacula/bacula] / bacula / src / cats / sql.c
index 54e4671c69e3c338af675a68ce4c7d85d60f43ae..1f79a814b806461cf32f1bb76b16ba62cd983bd9 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -185,31 +185,29 @@ static int db_max_connections_handler(void *ctx, int num_fields, char **row)
  */
 bool db_check_max_connections(JCR *jcr, B_DB *mdb, uint32_t max_concurrent_jobs)
 {
-   uint32_t max_conn=0;
-   int ret=true;
+#ifdef HAVE_BATCH_FILE_INSERT
 
-   /* Without Batch insert, no need to verify max_connections */
-#ifndef HAVE_BATCH_FILE_INSERT
-   return ret;
-#endif
+   uint32_t max_conn = 0;
 
-   /* Check max_connections setting */
+   /* With Batch insert, verify max_connections */
    if (!db_sql_query(mdb, sql_get_max_connections[db_type], 
                      db_max_connections_handler, &max_conn)) {
       Jmsg(jcr, M_ERROR, 0, "Can't verify max_connections settings %s", mdb->errmsg);
-      return ret;
+      return false;
    }
-   if (max_conn && max_concurrent_jobs && max_concurrent_jobs > max_conn) {
+   if (max_conn && max_concurrent_jobs > max_conn) {
       Mmsg(mdb->errmsg, 
            _("Potential performance problem:\n"
              "max_connections=%d set for %s database \"%s\" should be larger than Director's "
              "MaxConcurrentJobs=%d\n"),
            max_conn, db_get_type(), mdb->db_name, max_concurrent_jobs);
       Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
-      ret = false;
+      return false;
    }
 
-   return ret;
+#endif
+
+   return true;
 }
 
 /* NOTE!!! The following routines expect that the
@@ -272,11 +270,7 @@ InsertDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
       }
       return 0;
    }
-   if (mdb->have_insert_id) {
-      mdb->num_rows = sql_affected_rows(mdb);
-   } else {
-      mdb->num_rows = 1;
-   }
+   mdb->num_rows = sql_affected_rows(mdb);
    if (mdb->num_rows != 1) {
       char ed1[30];
       m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"),