Amanda-Users

Re: amanda-2.6.0p2: a few remarks and questions

2008-11-13 11:10:26
Subject: Re: amanda-2.6.0p2: a few remarks and questions
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Jean-Louis Martineau <martineau AT zmanda DOT com>, AMANDA users <amanda-users AT amanda DOT org>
Date: Thu, 13 Nov 2008 11:03:22 -0500
Try this newest patch.

Some fix will works only if the dump is done with the patched version.

Jean-Louis

Jean-Francois Malouin wrote:
* Jean-Louis Martineau <martineau AT zmanda DOT com> [20081111 20:12]:
Hi Jean-François,

Can you try the attached patch?

Tried it but something is still missing. Mind you, I just applied
the patch and recompiled: this is from a previous run.

-amreport: patch works: it reports tape rate above 100MBs

Avg Tp Write Rate (k/s) 109575 109575 --
-amstatus: I still don't get the lines 'tape X', like:

taped           :  25    422328m    423178m ( 99.80%) ( 99.80%)
  tape 1        :  25    422328m    423178m (109.40%) av24_U00061L3 (79 chunks)

-amtoc: I was doing my own edit of the amtoc perl script when you sent
me the patch. If I run the patched amtoc on a previous log file I get
something like:

  #  Server:/partition                       date      lev  size[Kb]
  0  av48-1_top_R00012L4:                    200811101   -         -
  1  gustav:/raid/prefrontal                 200811101   0 *16777216
  2  gustav:/raid/prefrontal                 200811101   0 *16777216
...
 21  gustav:/raid/prefrontal                 200811101   0 *16777216
 22  gustav:/raid/prefrontal                 200811101   0 367489930

Notice the '*'. There is something wrong around line 228 of amtoc:

            if(!/^CHUNK/){
# this case should never happend: $strange=1;
              $note = "*";
            }

It inserts the '*' on the chunk size. Also the total:on_tape is missing.
This is simple perl stuff, I should be able to do something about it!

Thanks a lot.
jf

Jean-Louis

Jean-Francois Malouin wrote:
Hello,

I've finally got to install amanda-2.6.0p2 on a system going soon into
production and while getting used to the new features and I noticed a
few things that have changed since 2.5.x :

- I use amtoc after a dump ends to get stats on what was written on
tape and noticed that it doesn't parse correctly the log files and the
toc files end up not showing what was written on tape. Looking at the
source I believe that this is due to the fact that amtoc doesn't parse
lines that start with 'PART' as the new log format seems to use
compared to 'CHUNK' in pre-2.6.x.

- amstatus doesn't show which tape(s) is being used and how much data
been written to it so far, a useful feature when I want to check that
a flush is being done correctly when using a changer with 'runtapes>1'

- As I posted a few days ago, amreport doesn't report correctly the
aggragated transfer rate to tape beyond 99.99MiBs...

- The new version features 'device_output_buffer_size' that replaces
'tapebufs'. Any hint on a ballpark figure for this? Right now I have
set it to 8192k (I use a blocksize=2048k) but I really don't know if I
overshooting with this...the server has 32GB of memory btw.

Thank you for the amazing work you guys are doing!
jf




Index: server-src/amstatus.pl
===================================================================
--- server-src/amstatus.pl      (revision 14198)
+++ server-src/amstatus.pl      (working copy)
@@ -722,6 +722,16 @@
                        $ntsize{$nb_tape} = 0;
                        $ntesize{$nb_tape} = 0;
                }
+               elsif($line[1] eq "using") {
+                       #1:"using" #2:"label" #3:`label' #4:date #5 `timestamp'
+                       $nb_tape++;
+                       $lineX =~ /using label `(\S*)'/;
+                       $label = $1;
+                       $ntlabel{$nb_tape} = $label;
+                       $ntpartition{$nb_tape} = 0;
+                       $ntsize{$nb_tape} = 0;
+                       $ntesize{$nb_tape} = 0;
+               }
        }
    elsif($line[0] eq "splitting" &&
                         $line[1] eq "chunk" &&
Index: server-src/driver.c
===================================================================
--- server-src/driver.c (revision 14198)
+++ server-src/driver.c (working copy)
@@ -303,6 +303,7 @@
     conf_runtapes = getconf_int(CNF_RUNTAPES);
     tape = lookup_tapetype(conf_tapetype);
     tape_length = tapetype_get_length(tape);
+    g_printf("driver: tape size %lld\n", (long long)tape_length);
     conf_flush_threshold_dumped = getconf_int(CNF_FLUSH_THRESHOLD_DUMPED);
     conf_flush_threshold_scheduled = 
getconf_int(CNF_FLUSH_THRESHOLD_SCHEDULED);
     conf_taperflush = getconf_int(CNF_TAPERFLUSH);
Index: server-src/amtoc.pl
===================================================================
--- server-src/amtoc.pl (revision 14198)
+++ server-src/amtoc.pl (working copy)
@@ -162,11 +162,26 @@
   }
   if ( ! /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/) { next;}
   # $_ = $1;
-  $host = $2;
-  $disk = $3;
-  $date = $4;
-  $chunk = $5;
-  $level = $6;
+  if (/PART taper/) {
+    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/;
+    $filenum = $3;
+    $host = $4;
+    $disk = $5;
+    $date = $6;
+    $chunk = $7;
+    $level = $8;
+    if ($filenum != $filenumber) {
+      # This should not be possible */
+      $filenumber = $filenum;
+    }
+  } else {
+    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/;
+    $host = $2;
+    $disk = $3;
+    $date = $4;
+    $chunk = $5;
+    $level = $6;
+  }
   switch: {
     /START taper/ && do {
       $tocfilename=&tfn($chunk) if ($#subs >= 0);
@@ -191,31 +206,37 @@
       &pr("#","Server","/partition","date", "level","size[Kb]","part");
       &pr("$filenumber","$chunk","","$disk","-","-","-");
       last switch; };
-    /^(?:SUCCESS|CHUNK) taper/ && do {
+    /^(?:SUCCESS|CHUNK|PART|DONE) taper/ && do {
       if(/SUCCESS/){
        $level = $chunk;
        $chunk = "-";
       }
+      $filenum = $filenumber;
+      if (/DONE/) {
+       $chunk = "-";
+       $filenumber--;
+       $filenum = " ";
+      }
       $mysize = 0;
       if(/ kb (\d+) /){
        $mysize = $1;
       }
       if ( $fail{$host}{$disk} ) {
-        
&pr("$filenumber","${host}","${disk}","${date}","${level}","FAIL","${chunk}");
+        
&pr("$filenum","${host}","${disk}","${date}","${level}","FAIL","${chunk}");
       } else {
        if (defined($flash_mode)) {
-          
&pr("$filenumber","${host}","${disk}","${date}","${level}","$mysize","${chunk}");
+          
&pr("$filenum","${host}","${disk}","${date}","${level}","$mysize","${chunk}");
        } else {
-         if (defined($osize{$host}{$disk}) && !/^CHUNK/) {
-            
&pr("$filenumber","${host}","${disk}","${date}","${level}","$osize{$host}{$disk}","${chunk}");
+         if (defined($osize{$host}{$disk}) && !/^CHUNK/ && !/^PART/) {
+            
&pr("$filenum","${host}","${disk}","${date}","${level}","$osize{$host}{$disk}","${chunk}");
          } else {
            $note = "";
-           if(!/^CHUNK/){
+           if(!/^CHUNK/ && !/^PART/){
                # this case should never happend: 
-           $strange=1;
+           } else {
              $note = "*";
            }
-            
&pr("$filenumber","${host}","${disk}","${date}","${level}","$note$mysize","${chunk}");
+            
&pr("$filenum","${host}","${disk}","${date}","${level}","$note$mysize","${chunk}");
          }
        }
       }
@@ -229,29 +250,26 @@
       $line =~ / fm (\d+) /;
       print "\n\n" if ($vwspace);
       &pr("$1","total","on_tape","-","-","$size","-");
-      if (defined($flash_mode)) {
-       &pr("$1","total","origin","-","not","available","-");
-      } else {
-       &pr("$1","total","origin","-","-","$tot_or_size","-");
-      }
-      if (defined($strange)) {
-       &pr("*","size","on_tape","-","-","-","-");
-      }
       last switch; };
     /FAIL taper/ && do { next; };
   }
   $filenumber += 1;
 }
+if (defined($flash_mode)) {
+  &pr("-","total","origin","-","not","available","-");
+} else {
+  &pr("-","total","origin","-","-","$tot_or_size","-");
+}
 close $IF;
 close OF;
 
 
 format OF =
-@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @>> @>>>>>>>>
+@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @>> @>>>>>>>>
 $fnbr,$hstprt,$dt,$lvl,$sz
 .
 
 format STDOUT =
-@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @>> @>>>>>>>> @>>>
+@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @>> @>>>>>>>> @>>>
 $fnbr,$hstprt,$dt,$lvl,$sz,$ch
 .
Index: server-src/reporter.c
===================================================================
--- server-src/reporter.c       (revision 14198)
+++ server-src/reporter.c       (working copy)
@@ -826,20 +826,24 @@
        double q = (b);                     \
        if (!isnormal(q))                   \
            g_fprintf((fp),"  -- ");        \
-       else if ((q = (a)/q) >= 999.95)     \
-           g_fprintf((fp), "###.#");       \
+       else if ((q = (a)/q) >= 99999.95)   \
+           g_fprintf((fp), "#####");       \
+       else if (q >= 999.95)               \
+           g_fprintf((fp), "%5.0lf",q);    \
        else                                \
-           g_fprintf((fp), "%5.1lf",q);            \
+           g_fprintf((fp), "%5.1lf",q);    \
     } while(0)
 #define divzero_wide(fp,a,b)               \
     do {                                           \
        double q = (b);                     \
        if (!isnormal(q))                   \
            g_fprintf((fp),"    -- ");      \
-       else if ((q = (a)/q) >= 99999.95)   \
-           g_fprintf((fp), "#####.#");     \
+       else if ((q = (a)/q) >= 9999999.95) \
+           g_fprintf((fp), "#######");     \
+       else if (q >= 99999.95)             \
+           g_fprintf((fp), "%7.0lf",q);    \
        else                                \
-           g_fprintf((fp), "%7.1lf",q);            \
+           g_fprintf((fp), "%7.1lf",q);    \
     } while(0)
 
 static void
Index: server-src/taper.c
===================================================================
--- server-src/taper.c  (revision 14198)
+++ server-src/taper.c  (working copy)
@@ -61,6 +61,7 @@
     char * next_tape_device;
     taper_scan_tracker_t * taper_scan_tracker;
     char * last_errmsg;
+    off_t  total_bytes;
 } taper_state_t;
 
 typedef struct {
@@ -83,6 +84,7 @@
     state->driver_start_time = NULL;
     state->taper_scan_tracker = taper_scan_tracker_new();
     state->last_errmsg = NULL;
+    state->total_bytes = 0;
 }
 
 static void cleanup(taper_state_t * state) {
@@ -461,7 +463,8 @@
     if (state->device != NULL) {
         return TRUE;
     }
-    
+    state->total_bytes = 0;
+ 
     if (!find_new_tape(state, dump_info)) {
         return FALSE;
     }
@@ -678,6 +681,7 @@
                   dump_info->handle, taper_state->device->volume_label,
                   taper_state->device->file, (uintmax_t)part_kbytes, part_time,
                  (uintmax_t)part_kbytes, part_kbps);
+       taper_state->total_bytes += run_bytes;
         
         if (taper_source_get_end_of_data(dump_info->source)) {
             cmd_t result_cmd;
@@ -722,6 +726,18 @@
        char *consumer_errstr = quote_string(
                                   device_error(taper_state->device));
 
+        log_add(L_PARTPARTIAL,
+                "%s %d %s %s %s %d/%d %d [sec %f kb %ju kps %f] %s",
+                volume_label, file_number, dump_info->hostname, qdiskname,
+                dump_info->timestamp, dump_info->current_part,
+                taper_source_predict_parts(dump_info->source),
+                dump_info->level, part_time, (uintmax_t)part_kbytes, part_kbps,
+               consumer_errstr);
+       log_add(L_INFO, "tape %s kb %ld fm %d [OK]\n",
+               volume_label,
+               ((taper_state->total_bytes+(off_t)1023) / (off_t)1024),
+               taper_state->device->file);
+
         /* A problem occured. */
         if (queue_result & QUEUE_CONSUMER_ERROR) {
            /* Make a note if this was EOM (we treat EOM the same as any other 
error,
@@ -735,13 +751,6 @@
             taper_state->device = NULL;
         }
         
-        log_add(L_PARTPARTIAL,
-                "%s %d %s %s %s %d/%d %d [sec %f kb %ju kps %f] %s",
-                volume_label, file_number, dump_info->hostname, qdiskname,
-                dump_info->timestamp, dump_info->current_part,
-                taper_source_predict_parts(dump_info->source),
-                dump_info->level, part_time, (uintmax_t)part_kbytes, part_kbps,
-               consumer_errstr);
         amfree(volume_label);
         
         if ((queue_result & QUEUE_CONSUMER_ERROR) &&
@@ -1201,6 +1210,12 @@
         
     case QUIT:
        free_cmdargs(cmdargs);
+       if (state->device && state->device->volume_label) {
+           log_add(L_INFO, "tape %s kb %ld fm %d [OK]\n",
+                   state->device->volume_label,
+                   ((state->total_bytes+(off_t)1023) / (off_t)1024),
+                   state->device->file);
+       }
         return send_quitting(state);
     default:
         if (cmdargs->argc >= 1) {
<Prev in Thread] Current Thread [Next in Thread>