What version of bacula?

I had the same problems with 1.38.5.  I attach my "dirty" patch.


El Wednesday 07 February 2007 12:15:50 James Cort escribió:
> Dear All,
>
> My database has grown in size to the point where it's now 18GB.
>
> I'd like to see if that can be pruned at all, but unfortunately my box
> only has 1GB of RAM and dbcheck fails rather horribly with an out of
> memory error when doing check for orphaned file records:
>
> Checking for orphaned File entries. This may take some time!
> Query failed: SELECT File.FileId,Job.JobId FROM File LEFT OUTER JOIN Job
> ON (File.JobId=Job.JobId) WHERE Job.JobId IS NULL: ERR=out of memory for
> query result
>
> Even with 20GB of swap this doesn't help in the slightest.  I notice
> that it doesn't use anywhere near that amount of swap before running out
> of memory, though - perhaps the per-process memory limit is the problem?
>
> Has anyone encountered (and more importantly solved) a similar problem
> in the past?
>
>
> James Cort
--- bacula-1.38.5-patched/src/tools/dbcheck.c	2006-04-20 16:10:01.000000000 +0200
+++ bacula-1.38.5/src/tools/dbcheck.c	2005-08-10 18:35:37.000000000 +0200
@@ -712,7 +712,7 @@
    printf(_("Checking for orphaned File entries. This may take some time!\n"));
    query = "SELECT File.FileId,Job.JobId FROM File "
            "LEFT OUTER JOIN Job ON (File.JobId=Job.JobId) "
-           "WHERE Job.JobId IS NULL limit 300000";
+           "WHERE Job.JobId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -720,32 +720,20 @@
       exit(1);
    }
    printf(_("Found %d orphaned File records.\n"), id_list.num_ids);
-   while ( id_list.num_ids != 0 ) {
-     if (name_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) {
-        for (int i=0; i < id_list.num_ids; i++) {
-           bsnprintf(buf, sizeof(buf),
-           "SELECT File.FileId,File.JobId,Filename.Name FROM File,Filename "
-           "WHERE File.FileId=%u AND File.FilenameId=Filename.FilenameId", id_list.Id[i]);
-           if (!db_sql_query(db, buf, print_file_handler, NULL)) {
+   if (name_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) {
+      for (int i=0; i < id_list.num_ids; i++) {
+         bsnprintf(buf, sizeof(buf),
+"SELECT File.FileId,File.JobId,Filename.Name FROM File,Filename "
+"WHERE File.FileId=%u AND File.FilenameId=Filename.FilenameId", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_file_handler, NULL)) {
             printf("%s\n", db_strerror(db));
-           }
-        }
-     }
-     
-     if (fix && id_list.num_ids > 0) {
-        printf(_("Deleting %d orphaned File records.\n"), id_list.num_ids);
-        delete_id_list("DELETE FROM File WHERE FileId=%u", &id_list);
-     }
-        query = "SELECT File.FileId,Job.JobId FROM File "
-             "LEFT OUTER JOIN Job ON (File.JobId=Job.JobId) "
-             "WHERE Job.JobId IS NULL limit 300000";
-     if (verbose > 1) {
-        printf("%s\n", query);
-     }
-     if (!make_id_list(query, &id_list)) {
-        exit(1);
-     }
-     printf(_("Found %d orphaned File records.\n"), id_list.num_ids);
+         }
+      }
+   }
+
+   if (fix && id_list.num_ids > 0) {
+      printf(_("Deleting %d orphaned File records.\n"), id_list.num_ids);
+      delete_id_list("DELETE FROM File WHERE FileId=%u", &id_list);
    }
 }
 
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to