🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by R.D. Thrush Mon, 22 Apr 1996 00:00
Using expdir in news.daily (unoff4)
#6759
Author: R.D. Thrush
Date: Mon, 22 Apr 1996 00:00
101 lines
3475 bytes
  Invoking news.daily with expdir=/partition_with_space works
correctly; however, the net result is that innd is paused from the end
of the expire until all 130,000 or so articles have been removed.
Without the expdir parameter, expire only pauses innd for a few seconds.

  I'm considering the attached patch to news.daily (unoff4).  It just
reorders news.daily operations to first move the new history files
into place and restart innd immediately after expire finishes.

  Or, maybe someone has a better solution to this problem?

--- news.daily.old	Wed Mar 13 10:23:27 1996
+++ news.daily	Sun Apr 21 20:52:07 1996
@@ -194,76 +194,75 @@
 	;;
     esac
 
     ##  Throttle server if we need to.
     if [ -n "${MESSAGE}" ] ; then
 	ctlinnd -s -t120 throttle "${MESSAGE}" 2>&1 || {
 	    ( echo "$0: Cannot throttle news"; ${INNSTAT} ) | eval ${MAIL}
 	    exit 1
 	}
     fi
 
     ##  Actual expire the articles (finally!).
     if ${DOEXPLOG}; then
 	echo "expire begin `date`: (${EXPIREFLAGS})"		>>${EXPLOG}
 	( exec 2>&1 ; eval expire "${EXPIREFLAGS}" ) \
 	    | ${SED} -e 's/^/    /' >>${EXPLOG}
 	echo "    expire end `date`"				>>${EXPLOG}
     else
 	eval expire "${EXPIREFLAGS}"
     fi
-    test -n "${RMFILE}" -a -f "${RMFILE}" && {
-	sort -u -o ${RMFILE} ${RMFILE}
-	${DOEXPIREOVER} && {
-	    eval expireover "${EXPIREOVERFLAGS}"
-	    DOEXPIREOVER=false
-	}
-	expirerm ${RMFILE}
-    }
-    ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"
-
     ##  If built on another filesystem, move history files.
     if [ -n "${EXPDIR}" ] ; then
 	if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
 	    ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
 	    exit 1
 	fi
 	mv -f ${EXPDIR}/history.n ${HISTORY}
 	mv -f ${EXPDIR}/history.n.dir ${HISTORY}.dir
 	mv -f ${EXPDIR}/history.n.pag ${HISTORY}.pag
 	rm -f ${EXPDIR}/history.n.done
 	case "${EXPIREFLAGS}" in
 	*-n*)
 	    ;;
 	*)
 	    MESSAGE="${REASON}"
 	    ;;
 	esac
     fi
 
     ##  Restart the server if we need to.
     if ${THROTTLED} || test -n "${MESSAGE}" ; then
 	ctlinnd -s go "${MESSAGE}" 2>&1 || {
 	    ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
 	    exit 1
 	}
     fi
+    test -n "${RMFILE}" -a -f "${RMFILE}" && {
+	sort -u -o ${RMFILE} ${RMFILE}
+	${DOEXPIREOVER} && {
+	    eval expireover "${EXPIREOVERFLAGS}"
+	    DOEXPIREOVER=false
+	}
+	expirerm ${RMFILE}
+    }
+    ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"
 fi
 
 ##  Renumber the active file.
 if ${DORENUMBER} ; then
     echo ''
     echo 'Renumbering active file.'
     if [ -z "${RENUMBER}" ] ;then
 	ctlinnd -s -t`wc -l <${ACTIVE}` renumber '' 2>&1
     else
 	while read GROUP hi lo flag ; do
 	    ctlinnd -s renumber ${GROUP} 2>&1
 	    sleep ${RENUMBER}
 	done <${ACTIVE}
     fi
 fi
 
 ${DOLOGS} && {
     echo ''
     scanlogs ${SCANARG}
 }

Re: Using expdir in news.daily (unoff4)
#6866
Author: Anne Bennett
Date: Wed, 24 Apr 1996 00:00
261 lines
11673 bytes
rd@mail.thrush.com (R.D. Thrush) writes:
>   Invoking news.daily with expdir=/partition_with_space works
> correctly; however, the net result is that innd is paused from the end
> of the expire until all 130,000 or so articles have been removed.
> Without the expdir parameter, expire only pauses innd for a few seconds.

I had the same problem (with inn-1.4sec).

>   I'm considering the attached patch to news.daily (unoff4).  It just
> reorders news.daily operations to first move the new history files
> into place and restart innd immediately after expire finishes.
> 
>   Or, maybe someone has a better solution to this problem?

Well, I played with it for a while,  and made a few more changes than 
you did.  I append the bits of context diff that are relevant; the line 
numbers will be off, because I have other changes in news.daily.

I see that you have just moved expireover and expirerm to after the
history files are put in and innd is unpaused.  The problem is that,
*if* you were throttled for space reasons when you started news.daily,
then you really *don't* want to "go" innd before the articles are 
removed, especially since innwatch is locked out from doing anything
until LOCK.news.daily is removed.  Thus, while I agree with moving the 
new history files into place as soon as possible, I think that innd
should be sent a "go" at that time only if there was no space problem.

The first change I made was to improve detection of the "throttled 
for space" condition, and I renamed the variable THROTTLED to 
SPACETHROTTLED, since that seemed to be what it was used for anyway.
Then I did what you did, i.e. moved the new history file installation
up.  However, I changed the way that was done, because the fact that
nnrpd might be holding the old history file open was causing the move
to bomb due to too little space on the /usr/lib/news partition anyway!
Then, I check whether we were space throttled; if not, I restart innd.
I made a couple of changes to the calls to expirem and expireover to 
send their output to the expire log file if that facility was requested.
After those two programs have run, then I still have a possible "ctlinnd 
go", in case innd was not restarted earlier.

It took me quite a while to figure all this out, and I commented as I
went, so you should be able to understand what I did and why, and take
just those parts you agree with. :-)


BTW, I'm now back to *not* using expdir, having laboriously repartitioned
my disk to make sure that /usr/lib/news never gets more than 50% full, 
except of course during expiry.

The problem is that the "expdir" option was designed for use when the
appropriare partition is too small to hold two sets of history files, but
it simply does not work:  if nnrpd is holding open the old copy, unlinking
it will *not* free up the space on the partition, and it will be impossible
to move the new copy into place.  My hack of catting /dev/null to the old
copy of the history files first, to make room, "works", but is very ugly,
and some poor nnrpd is going to get bitten. :-)


BTW, folks who are working on inn, there remain some problems in the 
interaction between innwatch and news.daily and expire.  I think that 
LOCK.news.daily is too coarsely grained, as it now stands;  it should 
be possible for innwatch to kick in again as soon as possible, and not
wait around for unrelated (I think!) operation such as expireover, expirerm,
and scanlogs.

I have been working with insufficient diskspace for the past few weeks,
and it has happened more than once that there was enough diskspace when
news.daily started, then, while expire was running, we ran out of space
in an "ungraceful" manner because innwatch was no longer able to act
because of LOCK.news.daily.  In those cases, it has happened that the new
history files were not installed, probably because expire could not pause
innd (which was already throttled anyway!).


Anne.
--
Ms. Anne Bennett          anne@alcor.concordia.ca            (514) 848-7606
Computing Services,   Concordia University,   Montreal QC,   Canada H3G 1M8
(Administrator for Concordia University mail relay and news transfer) 
----------------------------------------------------------------------------
***************
*** 168,187 ****
        ctlinnd -s throttle "`expr \"${SERVERMODE}\" : 'Server paused \(.*\)'`"
      esac
      case "${SERVERMODE}" in
!     *space*" -- throttling")
        echo "${SERVERMODE} -- trying to recover"
!       THROTTLED=true
        EXPIREFLAGS="${EXPIREFLAGS} -n"
        MESSAGE=
        ;;
      *"[innwatch:"*)
        echo "${SERVERMODE} -- pressing on"
!       THROTTLED=false
        EXPIREFLAGS="${EXPIREFLAGS} -n"
        MESSAGE=
        ;;
      *)
!       THROTTLED=false
        ;;
      esac
  
--- 191,216 ----
        ctlinnd -s throttle "`expr \"${SERVERMODE}\" : 'Server paused \(.*\)'`"
      esac
      case "${SERVERMODE}" in
!     *space*)
!         # Anne Bennett 1996/03/19  Changed to detect throttled for space;
!       #  Previous test was not detecting the condition.
        echo "${SERVERMODE} -- trying to recover"
!       SPACETHROTTLED=true
        EXPIREFLAGS="${EXPIREFLAGS} -n"
        MESSAGE=
        ;;
      *"[innwatch:"*)
        echo "${SERVERMODE} -- pressing on"
!       SPACETHROTTLED=false
        EXPIREFLAGS="${EXPIREFLAGS} -n"
        MESSAGE=
        ;;
+     *running*)
+       SPACETHROTTLED=false
+         ;;
      *)
!       echo "${SERVERMODE} -- I am confused, but pressing on"
!       SPACETHROTTLED=false
        ;;
      esac
  
***************
*** 198,217 ****
        echo "expire begin `date`: (${EXPIREFLAGS})"            >>${EXPLOG}
        ( exec 2>&1 ; eval expire "${EXPIREFLAGS}" ) \
            | ${SED} -e 's/^/    /' >>${EXPLOG}
        echo "    expire end `date`"                            >>${EXPLOG}
      else
        eval expire "${EXPIREFLAGS}"
      fi
-     test -n "${RMFILE}" -a -f "${RMFILE}" && {
-       sort -o ${RMFILE} ${RMFILE}
-       ${DOEXPIREOVER} && {
-           eval expireover "${EXPIREOVERFLAGS}"
-           DOEXPIREOVER=false
-       }
-       expirerm ${RMFILE}
-     }
-     ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"
  
      ##  If built on another filesystem, move history files.
      if [ -n "${EXPDIR}" ] ; then
        if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
--- 227,240 ----
        echo "expire begin `date`: (${EXPIREFLAGS})"            >>${EXPLOG}
        ( exec 2>&1 ; eval expire "${EXPIREFLAGS}" ) \
            | ${SED} -e 's/^/    /' >>${EXPLOG}
        echo "    expire end `date`"                            >>${EXPLOG}
      else
        eval expire "${EXPIREFLAGS}"
      fi
  
+     ## Anne Bennett  1996/03/19  Do this ASAP, to avoid having innd
+     ##    throttled while delayrm is running.
+     ##
      ##  If built on another filesystem, move history files.
      if [ -n "${EXPDIR}" ] ; then
        if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
***************
*** 218,238 ****
            ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
            exit 1
        fi
        mv -f ${EXPDIR}/history.n ${HISTORY}
        mv -f ${EXPDIR}/history.n.dir ${HISTORY}.dir
        mv -f ${EXPDIR}/history.n.pag ${HISTORY}.pag
        rm -f ${EXPDIR}/history.n.done
        case "${EXPIREFLAGS}" in
!       *-n*)
            ;;
!       *)
!           MESSAGE="${REASON}"
            ;;
        esac
      fi
  
!     ##  Restart the server if we need to.
!     if ${THROTTLED} || test -n "${MESSAGE}" ; then
        ctlinnd -s go "${MESSAGE}" 2>&1 || {
            ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
            exit 1
--- 241,308 ----
            ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
            exit 1
        fi
+       # Anne Bennett 1996/03/26; this move sometimes bombs for lack 
+       # of space; it seems that nnrpd can hold the history file open.
+       # Null out the files before moving the new ones into place.
+       cat /dev/null > ${HISTORY}
+       cat /dev/null > ${HISTORY}.dir
+       cat /dev/null > ${HISTORY}.pag
        mv -f ${EXPDIR}/history.n ${HISTORY}
        mv -f ${EXPDIR}/history.n.dir ${HISTORY}.dir
        mv -f ${EXPDIR}/history.n.pag ${HISTORY}.pag
        rm -f ${EXPDIR}/history.n.done
        case "${EXPIREFLAGS}" in
!       *-n*)  # We were in trouble (throttled) *or* we were told -n in args
!           # Don't mess with innd until the articles have been removed
            ;;
!       *)     # We might as well restart innd now
!           ctlinnd -s go "${REASON}" 2>&1 || {
!               echo "$0: Cannot unthrottle news after moving history files"
!           }
            ;;
        esac
      fi
  
!     test -n "${RMFILE}" -a -f "${RMFILE}" && {
!       sort -o ${RMFILE} ${RMFILE}
!       ${DOEXPIREOVER} && {
!             # Anne Bennett  1994/09/15  Send output to logfile.
!             if ${DOEXPLOG}; then
!                 echo "expireover begin `date`: (${EXPIREOVERFLAGS})"   >>${EXPLOG}
!               ( exec 2>&1 ; eval expireover "${EXPIREOVERFLAGS}" ) \
!                     | ${SED} -e 's/^/    /' >>${EXPLOG}
!                 echo "expireover end `date`"                       >>${EXPLOG}
!             else
!               eval expireover "${EXPIREOVERFLAGS}"
!             fi
!           DOEXPIREOVER=false
!       }
!         # Anne Bennett  1994/09/15  Send output to logfile. 
!             if ${DOEXPLOG}; then 
!                 echo "expirerm begin `date`: (${RMFILE})"       >>${EXPLOG}
!                 ( exec 2>&1 ; expirerm ${RMFILE} ) \
!                     | ${SED} -e 's/^/    /' >>${EXPLOG}
!                 echo "expirerm end `date`"                      >>${EXPLOG}
!             else
!                 expirerm ${RMFILE}
!             fi
!     }
!     ${DOEXPIREOVER} && {
!         # Anne Bennett  1994/09/15  Send output to logfile.  
!             if ${DOEXPLOG}; then  
!                 echo "expireover begin `date`: (${EXPIREOVERFLAGS})"   >>${EXPLOG}
!                 ( exec 2>&1 ; eval expireover "${EXPIREOVERFLAGS}" ) \
!                     | ${SED} -e 's/^/    /' >>${EXPLOG}
!                 echo "expireover end `date`"                       >>${EXPLOG}
!             else
!                 eval expireover "${EXPIREOVERFLAGS}"
!             fi
!     }
! 
!     ##  Restart the server if we need to, i.e. if
!     ##    a) We were throttled for space
!     ##    b) We were told with MESSAGE to signal explicitly
!     if ${SPACETHROTTLED} || test -n "${MESSAGE}" ; then
        ctlinnd -s go "${MESSAGE}" 2>&1 || {
            ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
            exit 1


Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads