innfeed and order of articles

Sven Paulus sven at tin.org
Thu Sep 30 17:59:06 UTC 1999


Does anyone have experience with innfeed's internals? I have a little
question :)

This was digged up in a discussion in the German news-admins mailing list:

The main question is: Is there a way to guarantee, that infeed feeds the
articles in exact the same order to a peer (in this special case an
Xref-slave) like it receives them from innd? (One stream only, of course)

At the moment I think there is a problem, when the peer was down and
articles were writte to tape object (i.e. the .input and .output files),
that new articles are sent beforce the backlogged ones.
The tape-code in tape.c seems to be clean and keep the right order of
articles.

But in innfeed/host.c:hostGimmeArticle() the following code (blank
lines stripped) can be found:

      if ((article = remHead (&host->queued,&host->queuedTail)) != NULL)
        {
          host->backlog-- ;
          tookIt = cxnQueueArticle (cxn,artTakeRef (article)) ;
          ASSERT (tookIt == true) ;
          queueArticle (article,&host->processed,&host->processedTail) ;
          amtToGive-- ;
          gaveSomething = true ;
        }
      else if ((article = getArticle (host->myTape)) != NULL) 
        {                       /* go to the tapes */
          tookIt = cxnQueueArticle (cxn,artTakeRef (article)) ;
          ASSERT (tookIt == true) ;
          host->artsFromTape++ ;
          host->gArtsFromTape++ ;
          queueArticle (article,&host->processed,&host->processedTail) ;
          amtToGive-- ;
          gaveSomething = true ;
        }
      else
        {
          /* we had nothing left to give... */
          if (host->processed == NULL) /* and if nothing outstanding... */
            listenerHostIsIdle (host->listener,host) ; /* tell our owner */
          amtToGive = 0 ;
        }

This looks to me as if in case that there are backlogged articles, a new
article arriving from innd is sent out first before the backlog from the
tape is sent to the peer, am I right?

Now, is there an easy way to change this behaviour? Just switching the first
to blocks would cause innfeed to grow in case of a backlog, because no
articles are taken from innd anymore. What I'd like to see is something like
(pseudo code):

    if ((article = GetArticleFromTape())) {
         if ((tmparticle = GetArticleFromINND())) {
             StoreAtEndOfTape(tmparticle); 
         }
         SendArticleToPeer(article);
    } else if ((article = GetArticleFromINND())) {
         SendArticleToPeer(article);
    } else {
         Idle();
    }

Is there a way to achieve this behaviour?  I think, that way the order of
the articles would be preserved.

If I'm completely misunderstanding everything, please tell me :)

Sven


More information about the inn-workers mailing list