Article View: news.software.nntp
Article #25590Enhanced Joe Greco control.cancel patch for inn 1.7.1
From: Gary Mills
Date: Mon, 26 Jan 1998 00:00
Date: Mon, 26 Jan 1998 00:00
186 lines
6512 bytes
6512 bytes
This is Joe Greco's control.cancel hack, modified for inn 1.7.1.
I changed the snprintf's back to sprintf's to suit 1.7.1. It divides
up the control.cancel directory into 10,000 subdirectories in two
levels, creating 10,000 phantom newsgroups. It's not necessary to
add these to the active file. However, three other small patches
are required so expire does not complain about these newsgroups and
so it uses the expiry time for control.cancel for them, so expireover
does not complain about them, and so overchan does not create overview
records for them.
This patch gives a tremendous performance boost to inn. It is a
hack, though, and should be replaced by a better way of storing
news articles.
*** innd/art.Oc Fri Dec 5 16:42:12 1997
--- innd/art.c Sun Dec 28 22:24:13 1997
***************
*** 2,7 ****
--- 2,13 ----
**
** Article-processing.
*/
+
+ /*
+ * 930721JG Modify control newsgroup handling to not write such big
+ * directories.
+ */
+
#include <stdio.h>
#include <sys/types.h>
#include "configdata.h"
***************
*** 1724,1729 ****
--- 1730,1736 ----
{
static BUFFER Files;
static BUFFER Header;
+ static char ngpDir[SPOOLNAMEBUFF];
static char buff[SPOOLNAMEBUFF];
register char *p;
register int i;
***************
*** 2173,2183 ****
continue;
ngp->PostCount = 0;
if (Data.Name[0] == '\0') {
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngp->Dir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
--- 2180,2199 ----
continue;
ngp->PostCount = 0;
+ if (! strcmp(ngp->Dir, "control/cancel")) {
+ /* Use modified directory format - breaks nnrpd, etc.,
+ but we don't give a rip */
+ sprintf(ngpDir, "%s/%02d/%02d", ngp->Dir, (ngp->Filenum / 10000) % 100, (ngp->Filenum / 100) % 100);
+ } else {
+ /* Use standard directory format */
+ sprintf(ngpDir, "%s", ngp->Dir);
+ }
+
if (Data.Name[0] == '\0') {
/* Write the article the first time. */
! (void)sprintf(Data.Name, "%s/%lu", ngpDir, ngp->Filenum);
if (ARTwrite(Data.Name, article, &Data) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| ARTwrite(Data.Name, article, &Data) < 0)) {
i = errno;
syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
***************
*** 2199,2207 ****
}
else {
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngp->Dir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
--- 2215,2223 ----
}
else {
/* Link to the main article. */
! (void)sprintf(linkname, "%s/%lu", ngpDir, ngp->Filenum);
if (DoLinks && link(Data.Name, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| link(Data.Name, linkname) < 0)) {
#if defined(DONT_HAVE_SYMLINK)
oerrno = errno;
***************
*** 2213,2219 ****
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngp->Dir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
--- 2229,2235 ----
/* Try to make a symbolic link to the full pathname. */
FileGlue(buff, SPOOL, '/', Data.Name);
if (symlink(buff, linkname) < 0
! && (!MakeSpoolDirectory(ngpDir)
|| symlink(buff, linkname) < 0)) {
oerrno = errno;
syslog(L_ERROR, "%s cant symlink %s and %s %m",
*** expire/expire.Oc Fri Dec 5 16:42:12 1997
--- expire/expire.c Wed Dec 31 11:26:19 1997
***************
*** 540,546 ****
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
--- 540,549 ----
}
*p = '\0';
if ((ngp = NGfind(Entry)) == NULL)
! if (EQn(Entry, "control.cancel", STRLEN("control.cancel")))
! ngp = NGfind("control.cancel");
! if (ngp == NULL)
! ngp = EXPnotfound(Entry);
*p = '/';
/* Bad posting date? */
*** expire/expireover.Oc Fri Dec 5 16:42:12 1997
--- expire/expireover.c Thu Jan 1 18:57:47 1998
***************
*** 813,818 ****
--- 813,820 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
if (List.Used == 0) {
(void)strcpy(group, line);
List.Used = 0;
***************
*** 847,852 ****
--- 849,856 ----
if ((p = strrchr(line, '/')) == NULL)
continue;
*p++ = '\0';
+ if (EQn(line, "control/cancel", 14))
+ continue;
List.Articles[0] = atol(p);
RemoveLines(line, &List);
}
*** backends/overchan.Oc Fri Dec 5 16:42:12 1997
--- backends/overchan.c Thu Jan 1 15:20:19 1998
***************
*** 220,226 ****
*Art++ = '\0';
/* Write data. */
! if (!WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--- 220,227 ----
*Art++ = '\0';
/* Write data. */
! if (!EQ(Dir,"control/cancel") &&
! !WriteData(Dir, Art, Rest, FALSE)
&& (!MakeOverDir(Dir) || !WriteData(Dir, Art, Rest, TRUE)))
(void)fprintf(stderr, "overchan cant update %s %s\n",
Dir, strerror(errno));
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
Technical Details
Message-ID:
<6ah8dg$hik$1@canopus.cc.umanitoba.ca>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <6ah8dg$hik$1@canopus.cc.umanitoba.ca> Subject: Enhanced Joe Greco control.cancel patch for inn 1.7.1 Date: Mon, 26 Jan 1998 00:00:00 +0000 From: mills@cc.umanitoba.ca (Gary Mills) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 319377410 Organization: The University of Manitoba Newsgroups: news.software.nntp