another ovdb patch for 2.3
Heath Kehoe
heath.kehoe at intermec.com
Tue Apr 11 23:37:18 UTC 2000
Here is another patch for 2.3 ovdb. It is mostly documentation updates, plus some
small tweaks and bug fixes. There are two new files as a part of this patch.
-heath
*** ../inn-CURRENT-20000411/doc/man/Makefile Tue Apr 11 05:00:12 2000
--- ./doc/man/Makefile Tue Apr 11 18:20:28 2000
***************
*** 31,37 ****
makedbz.8 makehistory.8 mod-active.8 news.daily.8 news2mail.8 \
newsrequeue.8 nnrpd.8 nntpsend.8 ovdb_recover.8 ovdb_upgrade.8 \
overchan.8 pgpverify.8 prunehistory.8 pullnews.8 scanlogs.8 \
! send-uucp.8 sm.8 tally.control.8 writelog.8
INSTALLED_SEC1 = $D$(MAN1)/convdate.1 $D$(MAN1)/getlist.1 \
$D$(MAN1)/grephistory.1 $D$(MAN1)/inews.1 \
--- 31,37 ----
makedbz.8 makehistory.8 mod-active.8 news.daily.8 news2mail.8 \
newsrequeue.8 nnrpd.8 nntpsend.8 ovdb_recover.8 ovdb_upgrade.8 \
overchan.8 pgpverify.8 prunehistory.8 pullnews.8 scanlogs.8 \
! send-uucp.8 sm.8 tally.control.8 writelog.8 dbprocs.8
INSTALLED_SEC1 = $D$(MAN1)/convdate.1 $D$(MAN1)/getlist.1 \
$D$(MAN1)/grephistory.1 $D$(MAN1)/inews.1 \
***************
*** 84,90 ****
$D$(MAN8)/pgpverify.8 $D$(MAN8)/prunehistory.8 \
$D$(MAN8)/pullnews.8 $D$(MAN8)/scanlogs.8 \
$D$(MAN8)/send-uucp.8 $D$(MAN8)/sm.8 \
! $D$(MAN8)/tally.control.8 $D$(MAN8)/writelog.8
ALL = $(SEC1) $(SEC3) $(SEC5) $(SEC8)
--- 84,91 ----
$D$(MAN8)/pgpverify.8 $D$(MAN8)/prunehistory.8 \
$D$(MAN8)/pullnews.8 $D$(MAN8)/scanlogs.8 \
$D$(MAN8)/send-uucp.8 $D$(MAN8)/sm.8 \
! $D$(MAN8)/tally.control.8 $D$(MAN8)/writelog.8 \
! $D$(MAN8)/dbprocs.8
ALL = $(SEC1) $(SEC3) $(SEC5) $(SEC8)
***************
*** 213,215 ****
--- 214,217 ----
$D$(MAN8)/sm.8: sm.8 ; $(COPY) $? $@
$D$(MAN8)/tally.control.8: tally.control.8 ; $(COPY) $? $@
$D$(MAN8)/writelog.8: writelog.8 ; $(COPY) $? $@
+ $D$(MAN8)/dbprocs.8: dbprocs.8 ; $(COPY) $? $@
*** ../inn-CURRENT-20000411/doc/man/ovdb.5 Tue Apr 11 05:00:18 2000
--- ./doc/man/ovdb.5 Tue Apr 11 17:15:14 2000
***************
*** 1,5 ****
! .\" Automatically generated by Pod::Man version 0.08
! .\" Tue Jan 11 15:51:22 2000
.\"
.\" Standard preamble:
.\" ======================================================================
--- 1,5 ----
! .\" Automatically generated by Pod::Man version 1.02
! .\" Tue Apr 11 17:15:14 2000
.\"
.\" Standard preamble:
.\" ======================================================================
***************
*** 138,144 ****
.\" ======================================================================
.\"
.IX Title "ovdb 5"
! .TH ovdb 5 "INN 2.3" "2000-1-11" "InterNetNews Documentation"
.UC
.SH "NAME"
ovdb \- Overview storage method for \s-1INN\s0
--- 138,144 ----
.\" ======================================================================
.\"
.IX Title "ovdb 5"
! .TH ovdb 5 "INN 2.3" "2000-04-11" "InterNetNews Documentation"
.UC
.SH "NAME"
ovdb \- Overview storage method for \s-1INN\s0
***************
*** 151,166 ****
BerkeleyDB may be downloaded from http://www.sleepycat.com .
.PP
The BerkeleyDB distribution is (by default) installed into
! \fI/usr/local/BerkeleyDB\fR, with subdirectories \fIlib/\fR, \fIinclude/\fR, and
! \fIbin/\fR for the library, headers, and support tools, respectively.
Version 3.x uses \fI/usr/local/BerkeleyDB.3.0\fR instead.
Ovdb uses some of the support tools in the \fIbin/\fR subdirectory; namely
! \fIdb_archive\fR, \fIdb_checkpoint\fR, and \fIdb_deadlock\fR.
.SH "INSTALLATION"
.IX Header "INSTALLATION"
To build ovdb support into \s-1INN\s0, specify the option \f(CW\*(C`\-\-with\-berkeleydb\*(C'\fR
when running the configure script. By default, configure will use
! \fI/usr/local/BerkeleyDB\fR.
If you installed it in a different location, you'll need to specify
that location like this (for example): \f(CW\*(C`\-\-with\-berkeleydb=/opt/BerkeleyDB\*(C'\fR.
.PP
--- 151,166 ----
BerkeleyDB may be downloaded from http://www.sleepycat.com .
.PP
The BerkeleyDB distribution is (by default) installed into
! \&\fI/usr/local/BerkeleyDB\fR, with subdirectories \fIlib/\fR, \fIinclude/\fR, and
! \&\fIbin/\fR for the library, headers, and support tools, respectively.
Version 3.x uses \fI/usr/local/BerkeleyDB.3.0\fR instead.
Ovdb uses some of the support tools in the \fIbin/\fR subdirectory; namely
! \&\fIdb_archive\fR, \fIdb_checkpoint\fR, and \fIdb_deadlock\fR.
.SH "INSTALLATION"
.IX Header "INSTALLATION"
To build ovdb support into \s-1INN\s0, specify the option \f(CW\*(C`\-\-with\-berkeleydb\*(C'\fR
when running the configure script. By default, configure will use
! \&\fI/usr/local/BerkeleyDB\fR.
If you installed it in a different location, you'll need to specify
that location like this (for example): \f(CW\*(C`\-\-with\-berkeleydb=/opt/BerkeleyDB\*(C'\fR.
.PP
***************
*** 170,176 ****
million articles, you'll need at least 5.5 \s-1GB\s0 of disk space for ovdb.
Plus, you'll need additional space for transaction logs: at least 40 \s-1MB\s0,
preferably 100 \s-1MB\s0 or more. (The logs may be on a different filesystem
! \-\- see the \s-1DB_CONFIG\s0 section.) If space is running tight, you can shrink
the ovXXXX database files by dumping and reloading them (to remove unused
space within the database file).
.SH "CONFIGURATION"
--- 170,176 ----
million articles, you'll need at least 5.5 \s-1GB\s0 of disk space for ovdb.
Plus, you'll need additional space for transaction logs: at least 40 \s-1MB\s0,
preferably 100 \s-1MB\s0 or more. (The logs may be on a different filesystem
! \&\-\- see the \s-1DB_CONFIG\s0 section.) If space is running tight, you can shrink
the ovXXXX database files by dumping and reloading them (to remove unused
space within the database file).
.SH "CONFIGURATION"
***************
*** 207,226 ****
cache hit percentages. If they're less than 80%, try increasing the
cache size. To make a change of this parameter take effect with an
existing database, remove the \fI_\|_db*\fR files while there are no
! database processes running. Default is 4096 K, which may be
adequate for small to medium-sized servers. Full-feed servers will
! probably need at least 10000.
.Ip "pagesize" 4
.IX Item "pagesize"
Sets the page size for the \s-1DB\s0 files (in bytes). Must be a power of 2.
! Best range will probably be between 2048 and 16384. The default is
! whatever BerkeleyDB selects as its default (based on the I/O block
! size of the underlying filesystem).
.Ip "minkey" 4
.IX Item "minkey"
Sets the minimum number of keys per page. See the BerkeleyDB
! documentation for more info. Default is 2; a setting of 3 may work
! better with larger page sizes.
.Sh "\s-1DB_CONFIG\s0"
.IX Subsection "DB_CONFIG"
A file called \fI\s-1DB_CONFIG\s0\fR may be placed in the database directory to
--- 207,229 ----
cache hit percentages. If they're less than 80%, try increasing the
cache size. To make a change of this parameter take effect with an
existing database, remove the \fI_\|_db*\fR files while there are no
! database processes running. Default is 8000 K, which may be
adequate for small to medium-sized servers. Full-feed servers will
! probably need at least 14000.
.Ip "pagesize" 4
.IX Item "pagesize"
Sets the page size for the \s-1DB\s0 files (in bytes). Must be a power of 2.
! Best choices are 4096, 8192, or 16384. The default is 8192.
! You can not change the pagesize of an existing \s-1DB\s0, it must be recreated.
.Ip "minkey" 4
.IX Item "minkey"
Sets the minimum number of keys per page. See the BerkeleyDB
! documentation for more info. Default is based on page size:
! .Sp
! .Vb 1
! \& default_minkey = pagesize / 2048
! .Ve
! You can not change the minkey of an existing \s-1DB\s0, it must be recreated.
.Sh "\s-1DB_CONFIG\s0"
.IX Subsection "DB_CONFIG"
A file called \fI\s-1DB_CONFIG\s0\fR may be placed in the database directory to
***************
*** 229,239 ****
directory. One way to improve performance is to put the transaction
logs on a different disk. To do this, put:
.PP
! \s-1DB_LOG_DIR\s0 /path/to/logs
.PP
in the \fI\s-1DB_CONFIG\s0\fR file. If the pathname you give starts with a /,
it is treated as an absolute path; otherwise, it is relative to the
! \*(L"\s-1DB_HOME\s0\*(R" directory. Make sure that any directories you specify
exist and have proper ownership/mode before starting \s-1INN\s0, because
they won't be created automatically. Also, don't change the \s-1DB_CONFIG\s0
file while anything that uses ovdb is running.
--- 232,242 ----
directory. One way to improve performance is to put the transaction
logs on a different disk. To do this, put:
.PP
! \&\s-1DB_LOG_DIR\s0 /path/to/logs
.PP
in the \fI\s-1DB_CONFIG\s0\fR file. If the pathname you give starts with a /,
it is treated as an absolute path; otherwise, it is relative to the
! \&\*(L"\s-1DB_HOME\s0\*(R" directory. Make sure that any directories you specify
exist and have proper ownership/mode before starting \s-1INN\s0, because
they won't be created automatically. Also, don't change the \s-1DB_CONFIG\s0
file while anything that uses ovdb is running.
***************
*** 243,249 ****
.IX Header "RUNNING"
You don't need to do anything special when starting or stopping \s-1INN\s0
when using ovdb, as long as you use \fIrc.news\fR. When starting,
! \fIrc.news\fR:
.Ip "\(bu" 4
Runs \f(CW\*(C`ovdb_recover\*(C'\fR. This will perform any needed recovery on the
database; e.g., if there was a crash that may have left the database
--- 246,252 ----
.IX Header "RUNNING"
You don't need to do anything special when starting or stopping \s-1INN\s0
when using ovdb, as long as you use \fIrc.news\fR. When starting,
! \&\fIrc.news\fR:
.Ip "\(bu" 4
Runs \f(CW\*(C`ovdb_recover\*(C'\fR. This will perform any needed recovery on the
database; e.g., if there was a crash that may have left the database
***************
*** 257,262 ****
--- 260,274 ----
.IX Header "DIAGNOSTICS"
Problems relating to ovdb are logged to news.err with \*(L"\s-1OVDB\s0\*(R" in the
error message.
+ .PP
+ If a program accessing the database crashes, or otherwise exits
+ uncleanly, it might leave a stale lock in the database. This lock
+ could cause other processes to deadlock on that stale lock. To
+ fix this, shut down all processes that access overview (using
+ \&\f(CW\*(C`kill \-9\*(C'\fR if necessary) then run \f(CW\*(C`ovdb_recover \-f\*(C'\fR as the
+ news user, e.g.: \f(CW\*(C`su news \-c "/PATHBIN/ovdb_recover \-f"\*(C'\fR
+ This will remove all locks plus repair any damage caused by
+ killing deadlocked processes.
.SH "FILES"
.IX Header "FILES"
.Ip "inn.conf" 4
***************
*** 287,293 ****
Written by Heath Kehoe <hakehoe at avalon.net> for InterNetNews
.SH "SEE ALSO"
.IX Header "SEE ALSO"
! \fIrc.news\fR\|(8), \fIinn.conf\fR\|(5), \fIdbprocs\fR\|(8), \fIovdb_recover\fR\|(8), \fIovdb_upgrade\fR\|(8)
.PP
BerkeleyDB documentation, in the \fIdocs\fR directory of the BerkeleyDB
source distribution, or on the Sleepycat web page: http://www.sleepycat.com/
--- 299,305 ----
Written by Heath Kehoe <hakehoe at avalon.net> for InterNetNews
.SH "SEE ALSO"
.IX Header "SEE ALSO"
! \&\fIrc.news\fR\|(8), \fIinn.conf\fR\|(5), \fIdbprocs\fR\|(8), \fIovdb_recover\fR\|(8), \fIovdb_upgrade\fR\|(8)
.PP
BerkeleyDB documentation, in the \fIdocs\fR directory of the BerkeleyDB
source distribution, or on the Sleepycat web page: http://www.sleepycat.com/
*** ../inn-CURRENT-20000411/doc/man/ovdb_recover.8 Tue Apr 11 05:00:18 2000
--- ./doc/man/ovdb_recover.8 Tue Apr 11 17:15:44 2000
***************
*** 1,5 ****
! .\" Automatically generated by Pod::Man version 0.08
! .\" Wed Dec 29 14:27:42 1999
.\"
.\" Standard preamble:
.\" ======================================================================
--- 1,5 ----
! .\" Automatically generated by Pod::Man version 1.02
! .\" Tue Apr 11 17:15:44 2000
.\"
.\" Standard preamble:
.\" ======================================================================
***************
*** 138,158 ****
.\" ======================================================================
.\"
.IX Title "ovdb_recover 8"
! .TH ovdb_recover 8 "INN 2.3" "1999-12-29" "InterNetNews Documentation"
.UC
.SH "NAME"
ovdb_recover \- Perform recovery on the ovdb database, if needed
.SH "SYNOPSYS"
.IX Header "SYNOPSYS"
! ovdb_recover
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Attempts to open the ovdb database, and if the database needs recovery,
it attempts to perform the recovery. Similar in function to the BerkeleyDB
! \fIdb_recover\fR command.
.PP
Returns exit status of 0 if the database did not need recovery or if
! recover succeeded, and returns exit status 1 if recovery failed. In
the latter case, the database may be damaged beyond repair, requiring
a rebuild with \fImakehistory\fR\|(8).
.PP
--- 138,163 ----
.\" ======================================================================
.\"
.IX Title "ovdb_recover 8"
! .TH ovdb_recover 8 "INN 2.3" "2000-04-11" "InterNetNews Documentation"
.UC
.SH "NAME"
ovdb_recover \- Perform recovery on the ovdb database, if needed
.SH "SYNOPSYS"
.IX Header "SYNOPSYS"
! ovdb_recover [\-f]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Attempts to open the ovdb database, and if the database needs recovery,
it attempts to perform the recovery. Similar in function to the BerkeleyDB
! \&\fIdb_recover\fR command.
.PP
+ Specify the \f(CW\*(C`\-f\*(C'\fR option to force a recovery, even if the database
+ appears to not need it. It is not an error to perform a recovery operation
+ on a clean database. However, do not run \f(CW\*(C`ovdb_recover \-f\*(C'\fR while the
+ database is in use by any other processes.
+ .PP
Returns exit status of 0 if the database did not need recovery or if
! recovery succeeded, and returns exit status 1 if recovery failed. In
the latter case, the database may be damaged beyond repair, requiring
a rebuild with \fImakehistory\fR\|(8).
.PP
***************
*** 162,165 ****
Written by Heath Kehoe <hakehoe at avalon.net> for InterNetNews.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
! \fIovdb\fR\|(5)
--- 167,170 ----
Written by Heath Kehoe <hakehoe at avalon.net> for InterNetNews.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
! \&\fIovdb\fR\|(5), \fImakehistory\fR\|(8)
Only in ./doc/pod: dbprocs.pod
*** ../inn-CURRENT-20000411/doc/pod/ovdb.pod Tue Apr 11 05:00:21 2000
--- ./doc/pod/ovdb.pod Tue Apr 11 17:13:04 2000
***************
*** 74,96 ****
cache hit percentages. If they're less than 80%, try increasing the
cache size. To make a change of this parameter take effect with an
existing database, remove the F<__db*> files while there are no
! database processes running. Default is 4096 K, which may be
adequate for small to medium-sized servers. Full-feed servers will
! probably need at least 10000.
=item pagesize
Sets the page size for the DB files (in bytes). Must be a power of 2.
! Best range will probably be between 2048 and 16384. The default is
! whatever BerkeleyDB selects as its default (based on the I/O block
! size of the underlying filesystem).
=item minkey
Sets the minimum number of keys per page. See the BerkeleyDB
! documentation for more info. Default is 2; a setting of 3 may work
! better with larger page sizes.
=back
=head2 DB_CONFIG
--- 74,98 ----
cache hit percentages. If they're less than 80%, try increasing the
cache size. To make a change of this parameter take effect with an
existing database, remove the F<__db*> files while there are no
! database processes running. Default is 8000 K, which may be
adequate for small to medium-sized servers. Full-feed servers will
! probably need at least 14000.
=item pagesize
Sets the page size for the DB files (in bytes). Must be a power of 2.
! Best choices are 4096, 8192, or 16384. The default is 8192.
! You can not change the pagesize of an existing DB, it must be recreated.
=item minkey
Sets the minimum number of keys per page. See the BerkeleyDB
! documentation for more info. Default is based on page size:
+ default_minkey = pagesize / 2048
+
+ You can not change the minkey of an existing DB, it must be recreated.
+
=back
=head2 DB_CONFIG
***************
*** 139,144 ****
--- 141,155 ----
Problems relating to ovdb are logged to news.err with "OVDB" in the
error message.
+
+ If a program accessing the database crashes, or otherwise exits
+ uncleanly, it might leave a stale lock in the database. This lock
+ could cause other processes to deadlock on that stale lock. To
+ fix this, shut down all processes that access overview (using
+ C<kill -9> if necessary) then run C<ovdb_recover -f> as the
+ news user, e.g.: C<su news -c "/PATHBIN/ovdb_recover -f">
+ This will remove all locks plus repair any damage caused by
+ killing deadlocked processes.
=head1 FILES
*** ../inn-CURRENT-20000411/doc/pod/ovdb_recover.pod Tue Apr 11 05:00:21 2000
--- ./doc/pod/ovdb_recover.pod Tue Apr 11 17:13:04 2000
***************
*** 4,10 ****
=head1 SYNOPSYS
! ovdb_recover
=head1 DESCRIPTION
--- 4,10 ----
=head1 SYNOPSYS
! ovdb_recover [-f]
=head1 DESCRIPTION
***************
*** 11,16 ****
--- 11,21 ----
Attempts to open the ovdb database, and if the database needs recovery,
it attempts to perform the recovery. Similar in function to the BerkeleyDB
F<db_recover> command.
+
+ Specify the C<-f> option to force a recovery, even if the database
+ appears to not need it. It is not an error to perform a recovery operation
+ on a clean database. However, do not run C<ovdb_recover -f> while the
+ database is in use by any other processes.
Returns exit status of 0 if the database did not need recovery or if
recovery succeeded, and returns exit status 1 if recovery failed. In
*** ../inn-CURRENT-20000411/frontends/ovdb_recover.c Tue Apr 11 05:00:25 2000
--- ./frontends/ovdb_recover.c Tue Apr 11 17:26:44 2000
***************
*** 49,55 ****
if(ret)
exit(1);
} else {
! ret = ovdb_open_berkeleydb(OV_WRITE, 0);
if(ret != 0) {
if(ret == DB_RUNRECOVERY) {
--- 49,58 ----
if(ret)
exit(1);
} else {
! if(!strcmp(argv[1], "-f"))
! ret = DB_RUNRECOVERY;
! else
! ret = ovdb_open_berkeleydb(OV_WRITE, 0);
if(ret != 0) {
if(ret == DB_RUNRECOVERY) {
*** ../inn-CURRENT-20000411/samples/ovdb.conf Tue Apr 11 05:00:50 2000
--- ./samples/ovdb.conf Tue Apr 11 17:13:04 2000
***************
*** 25,43 ****
# cache hit percentages. If they're less than 80%, try increasing the
# cache size. To make a change of this parameter take effect with an
# existing database, remove the __db_mpool.share file while there are no
! # database processes running. Default is 4096 K, which should be
# adequate for small to medium-sized servers. Full-feed servers will
! # probably need at least 10000.
! #cachesize 4096
# Sets the page size for the DB files (in bytes). Must be a power of 2.
! # Best range will probably be between 2048 and 16384. The default is
! # whatever BerkeleyDB selects as its default (based on the I/O block
! # size of the underlying filesystem).
#pagesize 8192
# Sets the minimum number of keys per page. See the BerkeleyDB
! # documentation for more info. Default is 2; a setting of 3 may work
! # better with larger page sizes.
! #minkey 2
--- 25,45 ----
# cache hit percentages. If they're less than 80%, try increasing the
# cache size. To make a change of this parameter take effect with an
# existing database, remove the __db_mpool.share file while there are no
! # database processes running. Default is 8000 K, which should be
# adequate for small to medium-sized servers. Full-feed servers will
! # probably need at least 14000.
! #cachesize 8000
# Sets the page size for the DB files (in bytes). Must be a power of 2.
! # Best choices are 4096, 8192, or 16384. The default is 8192.
! # You can not change the pagesize of an existing DB, it must be recreated.
#pagesize 8192
# Sets the minimum number of keys per page. See the BerkeleyDB
! # documentation for more info. Default is based on page size:
! #
! # default_minkey = pagesize / 2048
! #
! # You can not change the minkey of an existing DB, it must be recreated.
! #minkey 4
*** ../inn-CURRENT-20000411/storage/ovdb/Makefile Tue Apr 11 05:00:58 2000
--- ./storage/ovdb/Makefile Tue Apr 11 17:13:04 2000
***************
*** 16,25 ****
.c.o:
$(UPLIBCC) $(CFLAGS) -c $*.c -o $@
! ovdb:
rm -f ovdb.o ../objs/*.o
$(CC) $(CFLAGS) -DTEST_BDB -c ovdb.c
! $(CC) $(LDFLAGS) -o $@ ../*/*.o ../interface.o ../methods.o ../../lib/libinn.$(EXTLIB) $(EXTSTORAGELIBS) $(LIBS)
moveobjs: $(OBJECTS)
$(CP) -p $(ROBJECTS) ../objs
--- 16,26 ----
.c.o:
$(UPLIBCC) $(CFLAGS) -c $*.c -o $@
! ovdb: ovdb.c
rm -f ovdb.o ../objs/*.o
$(CC) $(CFLAGS) -DTEST_BDB -c ovdb.c
! $(CC) $(LDFLAGS) -o $@ ../*/*.o ../interface.o ../ov.o ../methods.o ../ovmethods.o ../../lib/libinn.$(EXTLIB) $(EXTSTORAGELIBS) $(LIBS)
! rm -f ovdb.o
moveobjs: $(OBJECTS)
$(CP) -p $(ROBJECTS) ../objs
*** ../inn-CURRENT-20000411/storage/ovdb/ovdb.c Tue Apr 11 05:00:58 2000
--- ./storage/ovdb/ovdb.c Tue Apr 11 17:17:20 2000
***************
*** 2,7 ****
--- 2,8 ----
* ovdb.c
* Overview storage using BerkeleyDB 2.x/3.x
*
+ * 2000-04-09 : Tweak some default parameters; store aliased group info
* 2000-03-29 : Add DB_RMW flag to the 'get' of get-modify-put sequences
* 2000-02-17 : Update expire behavior to be consistent with current
* ov3 and buffindexed
***************
*** 172,177 ****
--- 173,179 ----
static DB *groupstats = NULL;
static DB *groupsbyname = NULL;
+ static DB *groupaliases = NULL;
#define OVDBtxn_nosync 1
#define OVDBnumdbfiles 2
***************
*** 267,341 ****
ovdb_conf.home = innconf->pathoverview;
ovdb_conf.txn_nosync = 1;
ovdb_conf.numdbfiles = 32;
! ovdb_conf.pagesize = 0;
! ovdb_conf.cachesize = 4 * 1024 * 1024;
ovdb_conf.minkey = 0;
f = CONFfopen(cpcatpath(innconf->pathetc, _PATH_OVDBCONF));
- if(!f)
- return;
! while(!done && (tok = CONFgettoken(toks, f))) {
! switch(tok->type) {
! case OVDBtxn_nosync:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
}
- if(conf_bool_val(tok->name, &b)) {
- ovdb_conf.txn_nosync = b;
- }
- break;
- case OVDBnumdbfiles:
- tok = CONFgettoken(0, f);
- if(!tok) {
- done = 1;
- continue;
- }
- if(conf_long_val(tok->name, &l) && l > 0) {
- ovdb_conf.numdbfiles = l;
- }
- break;
- case OVDBpagesize:
- tok = CONFgettoken(0, f);
- if(!tok) {
- done = 1;
- continue;
- }
- if(conf_long_val(tok->name, &l) && l > 0) {
- ovdb_conf.pagesize = l;
- }
- break;
- case OVDBcachesize:
- tok = CONFgettoken(0, f);
- if(!tok) {
- done = 1;
- continue;
- }
- if(conf_long_val(tok->name, &l) && l > 0) {
- ovdb_conf.cachesize = l * 1024;
- }
- break;
- case OVDBminkey:
- tok = CONFgettoken(0, f);
- if(!tok) {
- done = 1;
- continue;
- }
- if(conf_long_val(tok->name, &l) && l > 0) {
- ovdb_conf.minkey = l;
- }
- break;
}
}
! CONFfclose(f);
}
/* Function that db will use to report errors */
static void OVDBerror(char *db_errpfx, char *buffer)
{
syslog(L_ERROR, "OVDB: %s", buffer);
}
static u_int32_t _db_flags = 0;
--- 269,354 ----
ovdb_conf.home = innconf->pathoverview;
ovdb_conf.txn_nosync = 1;
ovdb_conf.numdbfiles = 32;
! ovdb_conf.pagesize = 8192;
! ovdb_conf.cachesize = 8000 * 1024;
ovdb_conf.minkey = 0;
f = CONFfopen(cpcatpath(innconf->pathetc, _PATH_OVDBCONF));
! if(f) {
! while(!done && (tok = CONFgettoken(toks, f))) {
! switch(tok->type) {
! case OVDBtxn_nosync:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
! }
! if(conf_bool_val(tok->name, &b)) {
! ovdb_conf.txn_nosync = b;
! }
! break;
! case OVDBnumdbfiles:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
! }
! if(conf_long_val(tok->name, &l) && l > 0) {
! ovdb_conf.numdbfiles = l;
! }
! break;
! case OVDBpagesize:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
! }
! if(conf_long_val(tok->name, &l) && l > 0) {
! ovdb_conf.pagesize = l;
! }
! break;
! case OVDBcachesize:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
! }
! if(conf_long_val(tok->name, &l) && l > 0) {
! ovdb_conf.cachesize = l * 1024;
! }
! break;
! case OVDBminkey:
! tok = CONFgettoken(0, f);
! if(!tok) {
! done = 1;
! continue;
! }
! if(conf_long_val(tok->name, &l) && l > 1) {
! ovdb_conf.minkey = l;
! }
! break;
}
}
+ CONFfclose(f);
}
!
! /* If user did not specify minkey, choose one based on pagesize */
! if(ovdb_conf.minkey == 0) {
! ovdb_conf.minkey = ovdb_conf.pagesize / 2048;
! if(ovdb_conf.minkey < 2)
! ovdb_conf.minkey = 2;
! }
}
/* Function that db will use to report errors */
static void OVDBerror(char *db_errpfx, char *buffer)
{
+ #ifdef TEST_BDB
+ fprintf(stderr, "OVDB: %s\n", buffer);
+ #else
syslog(L_ERROR, "OVDB: %s", buffer);
+ #endif
}
static u_int32_t _db_flags = 0;
***************
*** 574,579 ****
--- 587,594 ----
return ret;
if(ret = upgrade_database("groupstats"))
return ret;
+ if(ret = upgrade_database("groupaliases"))
+ return ret;
if(ret = upgrade_database("version"))
return ret;
for(i = 0; i < ovdb_conf.numdbfiles; i++) {
***************
*** 671,677 ****
if(ret = vdb->open(vdb, "version", NULL, DB_BTREE,
_db_flags, 0666)) {
vdb->close(vdb, 0);
! syslog(L_FATAL, "OVDB: open: groupstats->open: %s", db_strerror(ret));
return ret;
}
#endif /* DB_VERSION_MAJOR == 2 */
--- 686,692 ----
if(ret = vdb->open(vdb, "version", NULL, DB_BTREE,
_db_flags, 0666)) {
vdb->close(vdb, 0);
! syslog(L_FATAL, "OVDB: open: version->open: %s", db_strerror(ret));
return ret;
}
#endif /* DB_VERSION_MAJOR == 2 */
***************
*** 772,777 ****
--- 787,798 ----
syslog(L_FATAL, "OVDB: db_open failed: %s", db_strerror(ret));
return FALSE;
}
+
+ if(ret = db_open("groupaliases", DB_HASH, _db_flags, 0666, OVDBenv,
+ &dbinfo, &groupaliases)) {
+ syslog(L_FATAL, "OVDB: db_open failed: %s", db_strerror(ret));
+ return FALSE;
+ }
#else
if(ret = db_create(&groupstats, OVDBenv, 0)) {
syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
***************
*** 793,798 ****
--- 814,829 ----
syslog(L_FATAL, "OVDB: open: groupsbyname->open: %s", db_strerror(ret));
return FALSE;
}
+ if(ret = db_create(&groupaliases, OVDBenv, 0)) {
+ syslog(L_FATAL, "OVDB: open: db_create: %s", db_strerror(ret));
+ return FALSE;
+ }
+ if(ret = groupaliases->open(groupaliases, "groupaliases", NULL, DB_HASH,
+ _db_flags, 0666)) {
+ groupaliases->close(groupaliases, 0);
+ syslog(L_FATAL, "OVDB: open: groupaliases->open: %s", db_strerror(ret));
+ return FALSE;
+ }
#endif
Cutofflow = FALSE;
***************
*** 949,955 ****
gs.high = hi;
gs.count = 0;
gs.flag = *flag;
! gs.expired = 0;
} else {
gs.flag = *flag;
}
--- 980,986 ----
gs.high = hi;
gs.count = 0;
gs.flag = *flag;
! gs.expired = time(NULL);
} else {
gs.flag = *flag;
}
***************
*** 972,977 ****
--- 1003,1027 ----
return FALSE;
}
+ if(*flag == '=') {
+ key.data = group;
+ key.size = strlen(group);
+ val.data = flag + 1;
+ val.size = strlen(flag + 1);
+
+ switch(ret = groupaliases->put(groupaliases, tid, &key, &val, 0)) {
+ case 0:
+ break;
+ case TRYAGAIN:
+ txn_abort(tid);
+ goto retry;
+ default:
+ txn_abort(tid);
+ syslog(L_ERROR, "OVDB: groupadd: groupaliases->put: %s", db_strerror(ret));
+ return FALSE;
+ }
+ }
+
my_txn_commit(tid);
return TRUE;
}
***************
*** 1001,1006 ****
--- 1051,1065 ----
return FALSE;
}
+ switch(ret = groupaliases->del(groupaliases, NULL, &key, 0)) {
+ case 0:
+ case DB_NOTFOUND:
+ break;
+ default:
+ syslog(L_ERROR, "OVDB: groupdel: groupaliases->del: %s", db_strerror(ret));
+ return FALSE;
+ }
+
return TRUE;
}
***************
*** 1360,1368 ****
return delete_old_stuff();
db = get_db(group);
gno = groupnum(group);
! if(!db || !gno)
return FALSE;
memset(&key, 0, sizeof key);
memset(&val, 0, sizeof val);
--- 1419,1433 ----
return delete_old_stuff();
db = get_db(group);
+ if(!db) {
+ syslog(L_ERROR, "OVDB: get_db(%s) failed (errno=%m)", group);
+ return FALSE;
+ }
gno = groupnum(group);
! if(!gno) {
! syslog(L_ERROR, "OVDB: groupnum(%s) failed (errno=%m)", group);
return FALSE;
+ }
memset(&key, 0, sizeof key);
memset(&val, 0, sizeof val);
***************
*** 1597,1607 ****
--- 1662,1716 ----
groupsbyname->close(groupsbyname, 0);
groupsbyname = NULL;
}
+ if(groupaliases) {
+ groupaliases->close(groupaliases, 0);
+ groupaliases = NULL;
+ }
ovdb_close_berkeleydb();
}
#ifdef TEST_BDB
+
+ /* gather sizes of overview records, to get a distribution of
+ record sizes */
+ static void ovdb_statistics()
+ {
+ int ret;
+ DB *db = get_db_bynum(0);
+ DBC *cursor;
+ DBT key, val;
+ unsigned long count = 0;
+ unsigned long size = 0;
+ char *datafile = "/tmp/data";
+ FILE *fp;
+
+ memset(&key, 0, sizeof key);
+ memset(&val, 0, sizeof val);
+
+ if(ret = db->cursor(db, NULL, &cursor, 0)) {
+ fprintf(stderr, "OVDB: ovdb_statistics: db->cursor: %s\n", db_strerror(ret));
+ return;
+ }
+
+ fp = fopen(datafile, "w");
+ if(!fp) {
+ fprintf(stderr, "can't open %s: %s\n", datafile, strerror(errno));
+ return;
+ }
+
+ while((ret = cursor->c_get(cursor, &key, &val, DB_NEXT)) == 0) {
+ fprintf(fp, "%d\n", val.size);
+ count++;
+ size+=val.size;
+ }
+ printf("ret = %s\n", db_strerror(ret));
+ cursor->c_close(cursor);
+ fclose(fp);
+
+ printf("Count: %d\nTotal Size: %d\nMean: %.2f\n", count, size, (double)size / count);
+ }
+
int main(int argc, char *argv[])
{
void *s;
***************
*** 1609,1619 ****
--- 1718,1731 ----
char *data;
int len;
+ /*
if(argc != 2)
exit(1);
+ */
ReadInnConf();
if(!ovdb_open(OV_READ))
exit(1);
+ /*
s = ovdb_opensearch(argv[1], 1, 0x7fffffff);
if(!s)
exit(1);
***************
*** 1621,1626 ****
--- 1733,1740 ----
fwrite(data, len, 1, stdout);
}
ovdb_closesearch(s);
+ */
+ ovdb_statistics();
ovdb_close();
exit(0);
}
*** /dev/null Tue Apr 11 18:01:51 2000
--- ./doc/pod/dbprocs.pod Tue Apr 11 18:21:31 2000
***************
*** 0 ****
--- 1,28 ----
+ =head1 NAME
+
+ dbprocs - Start or stop ovdb housekeeping processes
+
+ =head1 SYNOPSYS
+
+ dbprocs start
+
+ dbprocs stop
+
+ =head1 DESCRIPTION
+
+ B<dbprocs> is a script that starts or stops housekeeping processes needed by ovdb.
+ These are: B<db_checkpoint> and B<db_deadlock>, which are assumed to be in
+ $BERKELEY_DB_BINDIR. The B<dbprocs> script also periodically removes old log
+ files.
+
+ This command is normally called automatically by rc.news(8).
+
+ =head1 HISTORY
+
+ Written by Heath Kehoe E<lt>hakehoe at avalon.netE<gt> for InterNetNews.
+
+ =head1 SEE ALSO
+
+ ovdb(5), rc.news(8)
+
+ =cut
*** /dev/null Tue Apr 11 18:01:51 2000
--- ./doc/man/dbprocs.8 Tue Apr 11 18:21:41 2000
***************
*** 0 ****
--- 1,163 ----
+ .\" Automatically generated by Pod::Man version 1.02
+ .\" Tue Apr 11 18:21:41 2000
+ .\"
+ .\" Standard preamble:
+ .\" ======================================================================
+ .de Sh \" Subsection heading
+ .br
+ .if t .Sp
+ .ne 5
+ .PP
+ \fB\\$1\fR
+ .PP
+ ..
+ .de Sp \" Vertical space (when we can't use .PP)
+ .if t .sp .5v
+ .if n .sp
+ ..
+ .de Ip \" List item
+ .br
+ .ie \\n(.$>=3 .ne \\$3
+ .el .ne 3
+ .IP "\\$1" \\$2
+ ..
+ .de Vb \" Begin verbatim text
+ .ft CW
+ .nf
+ .ne \\$1
+ ..
+ .de Ve \" End verbatim text
+ .ft R
+
+ .fi
+ ..
+ .\" Set up some character translations and predefined strings. \*(-- will
+ .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+ .\" double quote, and \*(R" will give a right double quote. | will give a
+ .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+ .\" to do unbreakable dashes and therefore won't be available. \*(C` and
+ .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+ .tr \(*W-|\(bv\*(Tr
+ .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+ .ie n \{\
+ . ds -- \(*W-
+ . ds PI pi
+ . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+ . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+ . ds L" ""
+ . ds R" ""
+ . ds C` `
+ . ds C' '
+ 'br\}
+ .el\{\
+ . ds -- \|\(em\|
+ . ds PI \(*p
+ . ds L" ``
+ . ds R" ''
+ 'br\}
+ .\"
+ .\" If the F register is turned on, we'll generate index entries on stderr
+ .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+ .\" index entries marked with X<> in POD. Of course, you'll have to process
+ .\" the output yourself in some meaningful fashion.
+ .if \nF \{\
+ . de IX
+ . tm Index:\\$1\t\\n%\t"\\$2"
+ . .
+ . nr % 0
+ . rr F
+ .\}
+ .\"
+ .\" For nroff, turn off justification. Always turn off hyphenation; it
+ .\" makes way too many mistakes in technical documents.
+ .hy 0
+ .if n .na
+ .\"
+ .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+ .\" Fear. Run. Save yourself. No user-serviceable parts.
+ .bd B 3
+ . \" fudge factors for nroff and troff
+ .if n \{\
+ . ds #H 0
+ . ds #V .8m
+ . ds #F .3m
+ . ds #[ \f1
+ . ds #] \fP
+ .\}
+ .if t \{\
+ . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+ . ds #V .6m
+ . ds #F 0
+ . ds #[ \&
+ . ds #] \&
+ .\}
+ . \" simple accents for nroff and troff
+ .if n \{\
+ . ds ' \&
+ . ds ` \&
+ . ds ^ \&
+ . ds , \&
+ . ds ~ ~
+ . ds /
+ .\}
+ .if t \{\
+ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+ . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+ . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+ . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+ . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+ . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+ .\}
+ . \" troff and (daisy-wheel) nroff accents
+ .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+ .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+ .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+ .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+ .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+ .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+ .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+ .ds ae a\h'-(\w'a'u*4/10)'e
+ .ds Ae A\h'-(\w'A'u*4/10)'E
+ . \" corrections for vroff
+ .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+ .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+ . \" for low resolution devices (crt and lpr)
+ .if \n(.H>23 .if \n(.V>19 \
+ \{\
+ . ds : e
+ . ds 8 ss
+ . ds o a
+ . ds d- d\h'-1'\(ga
+ . ds D- D\h'-1'\(hy
+ . ds th \o'bp'
+ . ds Th \o'LP'
+ . ds ae ae
+ . ds Ae AE
+ .\}
+ .rm #[ #] #H #V #F C
+ .\" ======================================================================
+ .\"
+ .IX Title "dbprocs 8"
+ .TH dbprocs 8 "INN 2.3" "2000-04-11" "InterNetNews Documentation"
+ .UC
+ .SH "NAME"
+ dbprocs \- Start or stop ovdb housekeeping processes
+ .SH "SYNOPSYS"
+ .IX Header "SYNOPSYS"
+ dbprocs start
+ .PP
+ dbprocs stop
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ \&\fBdbprocs\fR is a script that starts or stops housekeeping processes needed by ovdb.
+ These are: \fBdb_checkpoint\fR and \fBdb_deadlock\fR, which are assumed to be in
+ \&\f(CW$BERKELEY_DB_BINDIR\fR. The \fBdbprocs\fR script also periodically removes old log
+ files.
+ .PP
+ This command is normally called automatically by \fIrc.news\fR\|(8).
+ .SH "HISTORY"
+ .IX Header "HISTORY"
+ Written by Heath Kehoe <hakehoe at avalon.net> for InterNetNews.
+ .SH "SEE ALSO"
+ .IX Header "SEE ALSO"
+ \&\fIovdb\fR\|(5), \fIrc.news\fR\|(8)
More information about the inn-patches
mailing list