/*
* 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;
+ int ret=0;
uint32_t num;
char jobid[50];
edit_uint64(JobId, jobid);
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;
}
bail_out:
db_end_transaction(jcr, mdb);
db_unlock(mdb);
+ return ret;
}
/*
/*
* 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;
}
/*
{
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;
}
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)
#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);
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);