changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > ventivac / changeset: add option -I indexoffset to ventisrv. this allows it to start verifying the index file at the given offset. can be used to make it find and diagnose errors in the index/data file.

changeset 129: 636d77883598
parent 128: 42396bd501da
child 130: 4e6af9818142
author: Mechiel Lukkien <mechiel@ueber.net>
date: Mon, 20 Aug 2007 14:24:44 +0200
files: appl/cmd/ventisrv.b man/8/ventisrv
description: add option -I indexoffset to ventisrv. this allows it to start verifying the index file at the given offset. can be used to make it find and diagnose errors in the index/data file.
     1.1--- a/appl/cmd/ventisrv.b	Mon Aug 20 13:54:40 2007 +0200
     1.2+++ b/appl/cmd/ventisrv.b	Mon Aug 20 14:24:44 2007 +0200
     1.3@@ -203,6 +203,7 @@
     1.4 statsdir := "/chan/";
     1.5 statsfile := "ventisrvstats";
     1.6 debug, Cflag, cflag, qflag, verbose: int;
     1.7+verifyoffset := big -1;
     1.8 raddrs, waddrs: list of string;
     1.9 
    1.10 indexfd, datafd: ref Sys->FD;
    1.11@@ -248,10 +249,11 @@
    1.12 	venti->init();
    1.13 
    1.14 	arg->init(args);
    1.15-	arg->setusage(arg->progname()+ " [-DcCqv] [-i index] [-d data] [-s statsfile] [-r addr] [-w addr] maxdatasize meanblocksize");
    1.16+	arg->setusage(arg->progname()+ " [-DcCqv] [-I indexoffset] [-i index] [-d data] [-s statsfile] [-r addr] [-w addr] maxdatasize meanblocksize");
    1.17 	while((c := arg->opt()) != 0)
    1.18 		case c {
    1.19 		'D' =>	debug++;
    1.20+		'I' =>	verifyoffset = big arg->earg();
    1.21 		'c' =>	cflag++;
    1.22 			Cflag++;
    1.23 		'C' =>	Cflag++;
    1.24@@ -409,9 +411,16 @@
    1.25 		fail(sprint("index file not multiple of iheadersize (indexsize=%bd iheadersize=%d)", indexsize, Ihdrsize));
    1.26 
    1.27 	doffset := big 0;
    1.28-	io := indexsize-big (Iverify*Ihdrsize);
    1.29-	if(io < big 0)
    1.30-		io = big 0;
    1.31+	io := verifyoffset;
    1.32+	if(io < big 0) {
    1.33+		io = indexsize-big (Iverify*Ihdrsize);
    1.34+		if(io < big 0)
    1.35+			io = big 0;
    1.36+	} else if(io > indexsize)
    1.37+		fail(sprint("index file offset to verify at lies outsize index file"));
    1.38+	else
    1.39+		if(verbose) say(sprint("starting index file verification at offset=%bd", io));
    1.40+		
    1.41 	if(indexsize > big 0) {
    1.42 		if(debug) say(sprint("config: verifying last entries in index file at offset=%bd", io));
    1.43 		ih := getihdr(io);
     2.1--- a/man/8/ventisrv	Mon Aug 20 13:54:40 2007 +0200
     2.2+++ b/man/8/ventisrv	Mon Aug 20 14:24:44 2007 +0200
     2.3@@ -6,6 +6,9 @@
     2.4 [
     2.5 .B -DcCqv
     2.6 ] [
     2.7+.B -I
     2.8+.I indexoffset
     2.9+] [
    2.10 .B -i
    2.11 .I index
    2.12 ] [
    2.13@@ -42,7 +45,10 @@
    2.14 .BR -d .
    2.15 The blocks are prepended with a header that holds the size, score and type of the block, and the starting time of the connection that wrote the block.  The index file is also a normal, append-only file, specified with
    2.16 .BR -i ,
    2.17-that only has headers:  a part of the score, type and offset of the block header in the data file.  At startup, the blocks for the last 128 headers in the index file are verified (the (partial) scores in the headers and actual scores are checked).  Missing headers are added from the data file to the index file if necessary.  Thus, starting ventisrv after truncating the index file will regerenate it from the data file.  Then the index file is read into memory (using only the minimum required bits).
    2.18+that only has headers:  a part of the score, type and offset of the block header in the data file.  At startup, the blocks for the last 128 headers in the index file are verified (the (partial) scores in the headers and actual scores are checked).  With
    2.19+.B -I
    2.20+the byte offset in the index file to start verifying at can be set, it should be a multiple of 15, the index header size.
    2.21+Missing headers are added from the data file to the index file if necessary.  Thus, starting ventisrv after truncating the index file will regerenate it from the data file.  Then the index file is read into memory (using only the minimum required bits).
    2.22 .PP
    2.23 .TP
    2.24 .B -c
    2.25@@ -58,6 +64,9 @@
    2.26 .B -q
    2.27 Quit just before reading the index and data files at startup.  This is useful for learning how much memory is needed for the specified data file size and mean block size configuration.
    2.28 .TP
    2.29+.BI -I " indexoffset"
    2.30+Offset in the index file to start verifying headers with the data file.  Must be a multiple of 15, the index header size.  With this option ventisrv can be used as a diagnostics tool for the index and data file.
    2.31+.TP
    2.32 .BI -i " index"
    2.33 File to use as index file.  Default is
    2.34 .IR index .