[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amanda-hackers
Subject:    Re: span/split 5.1 - LARGESTFIT and tapes left
From:       Orion Poplawski <orion () cora ! nwra ! com>
Date:       2004-03-17 16:51:27
Message-ID: 4058820F.3080108 () cora ! nwra ! com
[Download RAW message or body]

Orion Poplawski wrote:
> 
> I think driver needs to know how many tapes are left.  I guess it could 
> start with conf_runtapes and decrement each time it sees TRYAGAIN from 
> the taper.  Concerns:
> 
> - This tends to lead to another global in driver.c (needed in both 
> handle_taper_result() and startaflush(), .
> 
> - It *seems* like TRYAGAIN is synonymous with "end-of-tape", but I'm not 
> sure that's the only reason that result is returned.  Also, if it is, 
> why does amanda "try again" if there is only one tape?  So taper doesn't 
> need to know how many tapes there are?
> 

I've attached the start of a patch to driver.c to take the extra tapes 
into account for the "FIT" taper algorithms.  However, this is bogus 
until the END_TAPE and START_TAPE code is implemented in order to 
properly account for split dumps and to make sure that the dump is 
continued to the next tape.  But I though it might be useful to get the 
code out so others can review.


-- 
Orion Poplawski
System Administrator                   303-415-9701 x222
Colorado Research Associates/NWRA      FAX: 303-415-9702
3380 Mitchell Lane, Boulder CO 80301   http://www.co-ra.com

["amanda-2.4.5b1-span-driver.patch" (text/plain)]

--- amanda-2.4.5b1/server-src/driver.c.span	2004-03-16 11:36:40.000000000 -0700
+++ amanda-2.4.5b1/server-src/driver.c	2004-03-17 09:44:05.000000000 -0700
@@ -56,6 +56,7 @@
 int  inparallel;
 int nodump = 0;
 long tape_length, tape_left = 0;
+int tapes_used = 1;
 int conf_taperalgo, conf_taperwait;
 host_t *flushhost = NULL;
 
@@ -495,6 +496,7 @@
     disk_t *dp = NULL;
     disk_t *fit = NULL;
     char *datestamp;
+    int conf_runtapes = 0;
 
     if(!degraded_mode && !taper_busy && !empty(tapeq) && !(conf_taperwait && \
some_dumps_in_progress())) {  datestamp = sched(tapeq.head)->datestamp;
@@ -505,7 +507,10 @@
 	case ALGO_FIRSTFIT: 
 		fit = tapeq.head;
 		while (fit != NULL) {
-		    if(sched(fit)->act_size <= tape_left &&
+		    conf_runtapes = getconf_int(CNF_RUNTAPES);
+		    int extra_tapes = (fit->tape_splitsize > 0) ? 
+						conf_runtapes - tapes_used : 0;
+		    if(sched(fit)->act_size <= (tape_left + tape_length*extra_tapes) &&
 		       strcmp(sched(fit)->datestamp, datestamp) <= 0) {
 			dp = fit;
 			fit = NULL;
@@ -535,7 +540,10 @@
 	case ALGO_LARGESTFIT: 
 		fit = tapeq.head;
 		while (fit != NULL) {
-		    if(sched(fit)->act_size <= tape_left &&
+		    conf_runtapes = getconf_int(CNF_RUNTAPES);
+		    int extra_tapes = (fit->tape_splitsize > 0) ? 
+						conf_runtapes - tapes_used : 0;
+		    if(sched(fit)->act_size <= (tape_left + tape_length*extra_tapes) &&
 		       (!dp || sched(fit)->act_size > sched(dp)->act_size) &&
 		       strcmp(sched(fit)->datestamp, datestamp) <= 0) {
 			dp = fit;
@@ -966,16 +974,17 @@
 	       walltime_str(curclock()), dp->host->hostname, dp->name);
 	fflush(stdout);
 
-	/* re-insert into taper queue */
-
-	if(dp->tape_splitsize > 0) avail_tapes = conf_runtapes;
-	else avail_tapes = 1;
+	/* See how many tapes we have left, but we alwyays retry once (why?)*/
+	tapes_used++;
+	if(dp->tape_splitsize > 0) avail_tapes = conf_runtapes - tapes_used;
+	else avail_tapes = 0;
 	if(sched(dp)->attempted > avail_tapes) {
 	    log_add(L_FAIL, "%s %s %d %s [too many taper retries]",
 		    dp->host->hostname, dp->name, sched(dp)->level,
 		    sched(dp)->datestamp);
 	}
 	else {
+	    /* re-insert into taper queue */
 	    sched(dp)->attempted++;
 	    headqueue_disk(&tapeq, dp);
 	}
@@ -2258,12 +2267,13 @@
 	break;
 
     case TRYAGAIN: /* TRY-AGAIN <handle> <err mess> */
+	tape_left = tape_length;
+	tapes_used++;
     tryagain:
 	headqueue_disk(&runq, dp);
     failed_dumper:
 	update_failed_dump_to_tape(dp);
 	free_serial(result_argv[2]);
-	tape_left = tape_length;
 	break;
 
 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic