From: <gi...@ba...> - 2012-04-28 16:45:09
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Bacula Community source". The branch, Branch-5.2 has been updated via 0352cd9dd610366b25b43f853eaa370c23d77666 (commit) via 8ae3befe34506fb606b5aecd74e7aad41337f618 (commit) via 6037a0d9b249c0dc142f9b9b5bd29d57ac320b69 (commit) via ec207354cf58ff182f04ceeaa643a1767c336246 (commit) via 102c3e34e5c98b2bba7c542a3a44392bac7a9537 (commit) from cb1c5bf5c5116d463d8c5675b415b2db0c15baff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0352cd9dd610366b25b43f853eaa370c23d77666 Author: Marco van Wieringen <mv...@pl...> Date: Sun Apr 22 19:23:40 2012 +0200 Add missing dummy bVarPrefixLinks variable retrieval. commit 8ae3befe34506fb606b5aecd74e7aad41337f618 Author: Marco van Wieringen <mv...@pl...> Date: Sun Apr 22 19:21:49 2012 +0200 Rebuild configure. commit 6037a0d9b249c0dc142f9b9b5bd29d57ac320b69 Author: Marco van Wieringen <mv...@pl...> Date: Sun Apr 22 19:16:51 2012 +0200 Fix mysql config for older versions of mysql+config. On older versions of mysql_config the newly used flags are not supported. So we test if the new flag is supported and otherwise fallback to a kludge with some sed strings to get the info we want from the older mysql_config options. This fixes problems on : Centos 6 RHEL 6 SLES 11sp1 SLES 11sp2 OpenSuse 11.4 commit ec207354cf58ff182f04ceeaa643a1767c336246 Author: Eric Bollengier <er...@ba...> Date: Fri Apr 20 10:48:59 2012 +0200 Fix problem in BVFS with concurrent queries commit 102c3e34e5c98b2bba7c542a3a44392bac7a9537 Author: Eric Bollengier <er...@ba...> Date: Fri Apr 20 09:07:04 2012 +0200 Add more checks to bvfs ----------------------------------------------------------------------- Summary of changes: diff --git a/bacula/autoconf/bacula-macros/db.m4 b/bacula/autoconf/bacula-macros/db.m4 index 76a4748..7ef5551 100644 --- a/bacula/autoconf/bacula-macros/db.m4 +++ b/bacula/autoconf/bacula-macros/db.m4 @@ -326,10 +326,16 @@ AC_HELP_STRING([--with-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the My if test "$withval" != "no"; then if test "$withval" = "yes"; then MYSQL_CONFIG=`which mysql_config 2>/dev/null` - if test "x$MYSQL_CONFIG" != x; then + if test "x${MYSQL_CONFIG}" != x; then MYSQL_BINDIR="${MYSQL_CONFIG%/*}" - MYSQL_LIBDIR=`"$MYSQL_CONFIG" --variable=pkglibdir` - MYSQL_INCDIR=`"$MYSQL_CONFIG" --variable=pkgincludedir` + ${MYSQL_CONFIG} --variable=pkglibdir > /dev/null 2>&1 + if test $? = 0 ; then + MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir` + MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir` + else + MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs | sed -e 's/.*-L//' -e 's/ .*//'` + MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'` + fi elif test -f /usr/local/mysql/include/mysql/mysql.h; then MYSQL_INCDIR=/usr/local/mysql/include/mysql if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \ diff --git a/bacula/configure b/bacula/configure index 2a9bd8a..71a1c59 100755 --- a/bacula/configure +++ b/bacula/configure @@ -23968,10 +23968,16 @@ if test "${with_mysql+set}" = set; then : if test "$withval" != "no"; then if test "$withval" = "yes"; then MYSQL_CONFIG=`which mysql_config 2>/dev/null` - if test "x$MYSQL_CONFIG" != x; then + if test "x${MYSQL_CONFIG}" != x; then MYSQL_BINDIR="${MYSQL_CONFIG%/*}" - MYSQL_LIBDIR=`"$MYSQL_CONFIG" --variable=pkglibdir` - MYSQL_INCDIR=`"$MYSQL_CONFIG" --variable=pkgincludedir` + ${MYSQL_CONFIG} --variable=pkglibdir > /dev/null 2>&1 + if test $? = 0 ; then + MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir` + MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir` + else + MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs | sed -e 's/.*-L//' -e 's/ .*//'` + MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'` + fi elif test -f /usr/local/mysql/include/mysql/mysql.h; then MYSQL_INCDIR=/usr/local/mysql/include/mysql if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \ diff --git a/bacula/src/cats/bvfs.c b/bacula/src/cats/bvfs.c index 80a7cd7..c2b08d6 100644 --- a/bacula/src/cats/bvfs.c +++ b/bacula/src/cats/bvfs.c @@ -270,7 +270,10 @@ static void build_path_hierarchy(JCR *jcr, B_DB *mdb, "SELECT PPathId FROM PathHierarchy WHERE PathId = %s", pathid); - QUERY_DB(jcr, mdb, mdb->cmd); + if (!QUERY_DB(jcr, mdb, mdb->cmd)) { + goto bail_out; /* Query failed, just leave */ + } + /* Do we have a result ? */ if (sql_num_rows(mdb) > 0) { ppathid_cache.insert(pathid); @@ -293,7 +296,9 @@ static void build_path_hierarchy(JCR *jcr, B_DB *mdb, "VALUES (%s,%lld)", pathid, (uint64_t) parent.PathId); - INSERT_DB(jcr, mdb, mdb->cmd); + if (!INSERT_DB(jcr, mdb, mdb->cmd)) { + goto bail_out; /* Can't insert the record, just leave */ + } edit_uint64(parent.PathId, pathid); path = mdb->path; /* already done */ @@ -313,14 +318,16 @@ bail_out: /* * Internal function to update path_hierarchy cache with a shared pathid cache + * return Error 0 + * OK 1 */ -static void update_path_hierarchy_cache(JCR *jcr, +static int update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, pathid_cache &ppathid_cache, JobId_t JobId) { Dmsg0(dbglevel, "update_path_hierarchy_cache()\n"); - + int ret=0; uint32_t num; char jobid[50]; edit_uint64(JobId, jobid); @@ -332,6 +339,7 @@ static void update_path_hierarchy_cache(JCR *jcr, if (!QUERY_DB(jcr, mdb, mdb->cmd) || sql_num_rows(mdb) > 0) { Dmsg1(dbglevel, "already computed %d\n", (uint32_t)JobId ); + ret = 1; goto bail_out; } @@ -344,7 +352,11 @@ static void update_path_hierarchy_cache(JCR *jcr, "FROM BaseFiles JOIN File AS F USING (FileId) " "WHERE BaseFiles.JobId = %s) AS B", jobid, jobid); - QUERY_DB(jcr, mdb, mdb->cmd); + + if (!QUERY_DB(jcr, mdb, mdb->cmd)) { + Dmsg1(dbglevel, "Can't fill PathVisibility %d\n", (uint32_t)JobId ); + goto bail_out; + } /* Now we have to do the directory recursion stuff to determine missing * visibility We try to avoid recursion, to be as fast as possible We also @@ -360,7 +372,11 @@ static void update_path_hierarchy_cache(JCR *jcr, "AND PathHierarchy.PathId IS NULL " "ORDER BY Path", jobid); Dmsg1(dbglevel_sql, "q=%s\n", mdb->cmd); - QUERY_DB(jcr, mdb, mdb->cmd); + + if (!QUERY_DB(jcr, mdb, mdb->cmd)) { + Dmsg1(dbglevel, "Can't get new Path %d\n", (uint32_t)JobId ); + goto bail_out; + } /* TODO: I need to reuse the DB connection without emptying the result * So, now i'm copying the result in memory to be able to query the @@ -412,8 +428,8 @@ static void update_path_hierarchy_cache(JCR *jcr, } do { - QUERY_DB(jcr, mdb, mdb->cmd); - } while (sql_affected_rows(mdb) > 0); + ret = QUERY_DB(jcr, mdb, mdb->cmd); + } while (ret && sql_affected_rows(mdb) > 0); Mmsg(mdb->cmd, "UPDATE Job SET HasCache=1 WHERE JobId=%s", jobid); UPDATE_DB(jcr, mdb, mdb->cmd); @@ -421,6 +437,7 @@ static void update_path_hierarchy_cache(JCR *jcr, bail_out: db_end_transaction(jcr, mdb); db_unlock(mdb); + return ret; } /* @@ -511,24 +528,28 @@ void bvfs_update_cache(JCR *jcr, B_DB *mdb) /* * Update the bvfs cache for given jobids (1,2,3,4) */ -void +int bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids) { pathid_cache ppathid_cache; JobId_t JobId; char *p; + int ret=1; for (p=jobids; ; ) { int stat = get_next_jobid_from_list(&p, &JobId); if (stat < 0) { - return; + return 0; } if (stat == 0) { break; } Dmsg1(dbglevel, "Updating cache for %lld\n", (uint64_t)JobId); - update_path_hierarchy_cache(jcr, mdb, ppathid_cache, JobId); + if (!update_path_hierarchy_cache(jcr, mdb, ppathid_cache, JobId)) { + ret = 0; + } } + return ret; } /* @@ -544,7 +565,9 @@ bool Bvfs::ch_dir(const char *path) { pm_strcpy(db->path, path); db->pnl = strlen(db->path); + db_lock(db); ch_dir(db_get_path_record(jcr, db)); + db_unlock(db); return pwd_id != 0; } @@ -591,8 +614,12 @@ void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client) DBId_t Bvfs::get_root() { + int p; *db->path = 0; - return db_get_path_record(jcr, db); + db_lock(db); + p = db_get_path_record(jcr, db); + db_unlock(db); + return p; } static int path_handler(void *ctx, int fields, char **row) diff --git a/bacula/src/cats/bvfs.h b/bacula/src/cats/bvfs.h index 5e5f39f..5be7d90 100644 --- a/bacula/src/cats/bvfs.h +++ b/bacula/src/cats/bvfs.h @@ -197,7 +197,7 @@ private: #define bvfs_is_version(row) ((row)[BVFS_Type][0] == BVFS_FILE_VERSION) -void bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids); +int bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids); void bvfs_update_cache(JCR *jcr, B_DB *mdb); char *bvfs_parent_dir(char *path); diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index dc4f75e..c90052b 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -186,7 +186,10 @@ static bool dot_bvfs_update(UAContext *ua, const char *cmd) int pos = find_arg_with_value(ua, "jobid"); if (pos != -1 && is_a_number_list(ua->argv[pos])) { - bvfs_update_path_hierarchy_cache(ua->jcr, ua->db, ua->argv[pos]); + if (!bvfs_update_path_hierarchy_cache(ua->jcr, ua->db, ua->argv[pos])) { + ua->error_msg("ERROR: BVFS reported a problem for %s\n", + ua->argv[pos]); + } } else { /* update cache for all jobids */ bvfs_update_cache(ua->jcr, ua->db); diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index 7e25f04..89895b6 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -1338,13 +1338,13 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value) case bVarRegexWhere: *(char **)value = jcr->RegexWhere; break; - case bVarFDName: /* get warning with g++ if we missed one */ case bVarWorkingDir: case bVarExePath: case bVarVersion: case bVarDistName: case bVarBEEF: + case bVarPrefixLinks: break; } return bRC_OK; hooks/post-receive -- Bacula Community source |