From: Eric Bollengier Date: Thu, 2 Feb 2012 20:11:20 +0000 (+0100) Subject: Ensure that bvfs SQL link is not shared X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56a5a0097804566d7642aaec3d15a1e0a4051df6;p=bacula%2Fbacula Ensure that bvfs SQL link is not shared --- diff --git a/bacula/src/cats/cats.c b/bacula/src/cats/cats.c index eed774c71c..4aef7206e3 100644 --- a/bacula/src/cats/cats.c +++ b/bacula/src/cats/cats.c @@ -49,11 +49,13 @@ bool B_DB::db_match_database(const char *db_driver, const char *db_name, match = strcasecmp(m_db_driver, db_driver) == 0 && bstrcmp(m_db_name, db_name) && bstrcmp(m_db_address, db_address) && - m_db_port == db_port; + m_db_port == db_port && + m_dedicated == false; } else { match = bstrcmp(m_db_name, db_name) && bstrcmp(m_db_address, db_address) && - m_db_port == db_port; + m_db_port == db_port && + m_dedicated == false; } return match; } diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index a22878c375..d46ba164f9 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -458,6 +458,7 @@ protected: char *m_db_password; /* database password */ int m_db_port; /* port for host name address */ bool m_disabled_batch_insert; /* explicitly disabled batch insert mode ? */ + bool m_dedicated; /* is this connection dedicated? */ public: POOLMEM *errmsg; /* nicely edited error message */ diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index 3181e8b49b..1bf948fecc 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -171,6 +171,13 @@ B_DB_DBI::B_DB_DBI(JCR *jcr, esc_obj = get_pool_memory(PM_FNAME); m_allow_transactions = mult_db_connections; + /* At this time, when mult_db_connections == true, this is for + * specific console command such as bvfs or batch mode, and we don't + * want to share a batch mode or bvfs. In the future, we can change + * the creation function to add this parameter. + */ + m_dedicated = mult_db_connections; + /* * Initialize the private members. */ diff --git a/bacula/src/cats/ingres.c b/bacula/src/cats/ingres.c index feb1aecf49..b48fcf9052 100755 --- a/bacula/src/cats/ingres.c +++ b/bacula/src/cats/ingres.c @@ -204,6 +204,13 @@ B_DB_INGRES::B_DB_INGRES(JCR *jcr, esc_obj = get_pool_memory(PM_FNAME); m_allow_transactions = mult_db_connections; + /* At this time, when mult_db_connections == true, this is for + * specific console command such as bvfs or batch mode, and we don't + * want to share a batch mode or bvfs. In the future, we can change + * the creation function to add this parameter. + */ + m_dedicated = mult_db_connections; + /* * Initialize the private members. */ diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 0cdf19d733..513e4bb5f8 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -116,6 +116,13 @@ B_DB_MYSQL::B_DB_MYSQL(JCR *jcr, esc_obj = get_pool_memory(PM_FNAME); m_allow_transactions = mult_db_connections; + /* At this time, when mult_db_connections == true, this is for + * specific console command such as bvfs or batch mode, and we don't + * want to share a batch mode or bvfs. In the future, we can change + * the creation function to add this parameter. + */ + m_dedicated = mult_db_connections; + /* * Initialize the private members. */ diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index 1f35b1634f..618b45b0ab 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -122,6 +122,13 @@ B_DB_POSTGRESQL::B_DB_POSTGRESQL(JCR *jcr, m_buf = get_pool_memory(PM_FNAME); m_allow_transactions = mult_db_connections; + /* At this time, when mult_db_connections == true, this is for + * specific console command such as bvfs or batch mode, and we don't + * want to share a batch mode or bvfs. In the future, we can change + * the creation function to add this parameter. + */ + m_dedicated = mult_db_connections; + /* * Initialize the private members. */ diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 0bb0e8533a..e012a7fd8e 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -112,6 +112,13 @@ B_DB_SQLITE::B_DB_SQLITE(JCR *jcr, esc_obj = get_pool_memory(PM_FNAME); m_allow_transactions = mult_db_connections; + /* At this time, when mult_db_connections == true, this is for + * specific console command such as bvfs or batch mode, and we don't + * want to share a batch mode or bvfs. In the future, we can change + * the creation function to add this parameter. + */ + m_dedicated = mult_db_connections; + /* * Initialize the private members. */