records.
Changed some log messages also.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.67 1996-11-15 15:02:14 adam
+ * Revision 1.68 1997-02-12 20:39:45 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.67 1996/11/15 15:02:14 adam
* Minor changes regarding logging.
*
* Revision 1.66 1996/11/14 09:52:21 adam
struct recordLogInfo {
const char *fname;
- char *op;
+ int recordOffset;
struct recordGroup *rGroup;
};
if (level & LOG_LOG)
return ;
- if (p->op)
- fprintf (outf, "%s of ", p->op);
- fprintf (outf, "%s type %s\n", p->rGroup->recordType, p->fname);
+ fprintf (outf, "File %s, offset %d, type %s\n",
+ p->rGroup->recordType, p->recordOffset, p->fname);
log_event_start (NULL, NULL);
}
Record rec;
struct recordLogInfo logInfo;
- logInfo.fname = fname;
- logInfo.op = NULL;
- logInfo.rGroup = rGroup;
- log_event_start (recordLogPreamble, &logInfo);
-
if (fi->fd != -1)
{
/* we are going to read from a file, so prepare the extraction */
extractCtrl.flagShowRecords = rGroup->flagShowRecords;
if (rGroup->flagShowRecords)
printf ("File: %s %ld\n", fname, (long) recordOffset);
+
+ logInfo.fname = fname;
+ logInfo.recordOffset = recordOffset;
+ logInfo.rGroup = rGroup;
+ log_event_start (recordLogPreamble, &logInfo);
+
r = (*recType->extract)(&extractCtrl);
+ log_event_start (NULL, NULL);
+
if (r)
{
/* error occured during extraction ... */
- if (!rGroup->flagShowRecords)
- logf (LOG_WARN, "Couldn't extract file %s, code %d", fname, r);
+ if (!rGroup->flagShowRecords &&
+ records_processed < rGroup->fileVerboseLimit)
+ {
+ logf (LOG_WARN, "fail %s %s %ld code = %d", rGroup->recordType,
+ fname, (long) recordOffset, r);
+ }
return 0;
}
if (reckeys.buf_used == 0)
{
/* the extraction process returned no information - the record
- is probably empty */
- if (!rGroup->flagShowRecords)
- {
- logf (LOG_WARN, "No keys generated for file %s", fname);
- logf (LOG_WARN, " The file is probably empty");
- }
+ is probably empty - unless flagShowRecords is in use */
+ if (rGroup->flagShowRecords)
+ return 1;
+ logf (LOG_WARN, "No keys generated for file %s", fname);
+ logf (LOG_WARN, " The file is probably empty");
return 0;
}
}
logf (LOG_LOG, "Cannot delete new record");
return 1;
}
- logInfo.op = "add";
- if (rGroup->fileVerboseFlag)
+ if (records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "add %s %s %ld", rGroup->recordType,
fname, (long) recordOffset);
rec = rec_new (records);
if (deleteFlag)
{
/* record going to be deleted */
- logInfo.op = "delete";
if (!delkeys.buf_used)
{
- logf (LOG_WARN, "cannot delete; storeKeys false");
+ logf (LOG_LOG, "delete %s %s %ld", rGroup->recordType,
+ fname, (long) recordOffset);
+ logf (LOG_WARN, "cannot delete file above, storeKeys false");
}
else
{
- if (rGroup->fileVerboseFlag)
+ if (records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "delete %s %s %ld", rGroup->recordType,
fname, (long) recordOffset);
records_deleted++;
else
{
/* record going to be updated */
- logInfo.op = "update";
if (!delkeys.buf_used)
{
- logf (LOG_WARN, "cannot update; storeKeys false");
+ logf (LOG_LOG, "update %s %s %ld", rGroup->recordType,
+ fname, (long) recordOffset);
+ logf (LOG_WARN, "cannot update file above, storeKeys false");
}
else
{
- if (rGroup->fileVerboseFlag)
+ if (records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "update %s %s %ld", rGroup->recordType,
fname, (long) recordOffset);
flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
sprintf (ext_res, "%srecordType", gprefix);
if (!(rGroup->recordType = res_get (common_resource, ext_res)))
{
- if (rGroup->fileVerboseFlag)
+ if (records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "? %s", fname);
return 0;
}
}
if (!rGroup->recordType)
{
- if (rGroup->fileVerboseFlag)
+ if (records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "? record %s", fname);
return 0;
}
r = recordExtract (sysno, fname, rGroup, deleteFlag, fi,
recType, subType);
} while (r && !sysno && fi->file_more);
- log_event_start (NULL, NULL);
file_read_stop (fi);
if (fd != -1)
close (fd);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.47 1996-12-23 15:30:44 adam
+ * Revision 1.48 1997-02-12 20:39:45 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.47 1996/12/23 15:30:44 adam
* Work on truncation.
* Bug fix: result sets weren't deleted after server shut down.
*
int flagStoreData;
int flagStoreKeys;
int flagShowRecords;
- int fileVerboseFlag;
+ int fileVerboseLimit;
};
void getFnameTmp (char *fname, int no);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kinput.c,v $
- * Revision 1.21 1996-11-08 11:10:23 adam
+ * Revision 1.22 1997-02-12 20:39:45 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.21 1996/11/08 11:10:23 adam
* Buffers used during file match got bigger.
* Compressed ISAM support everywhere.
* Bug fixes regarding masking characters in queries.
is_close (isam);
if (isamc)
isc_close (isamc);
-
+
for (i = 1; i<=nkeys; i++)
{
getFnameTmp (rbuf, i);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockidx.c,v $
- * Revision 1.7 1996-10-29 14:08:13 adam
+ * Revision 1.8 1997-02-12 20:39:46 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.7 1996/10/29 14:08:13 adam
* Uses resource lockDir instead of lockPath.
*
* Revision 1.6 1996/03/26 16:01:13 adam
logf (LOG_FATAL|LOG_ERRNO, "open %s", path);
exit (1);
}
- logf (LOG_LOG, "zebraLockNB");
if (zebraLockNB (lock_fd, 1) == -1)
{
if (errno == EWOULDBLOCK)
{
- logf (LOG_LOG, "Waiting for other index process");
+ logf (LOG_LOG, "waiting for other index process");
zebraLock (lock_fd, 1);
zebraUnlock (lock_fd);
close (lock_fd);
}
else
{
- logf (LOG_WARN, "Unlocked %s", path);
+ logf (LOG_WARN, "unlocked %s", path);
r = read (lock_fd, buf, 256);
if (r == 0)
{
- logf (LOG_WARN, "Zero length %s", path);
+ logf (LOG_WARN, "zero length %s", path);
close (lock_fd);
unlink (path);
continue;
}
if (*buf == 'r')
{
- logf (LOG_WARN, "Previous transaction didn't"
+ logf (LOG_WARN, "previous transaction didn't"
" reach commit");
close (lock_fd);
bf_commitClean ();
}
else if (*buf == 'd')
{
- logf (LOG_WARN, "Commit file wan't deleted after commit");
+ logf (LOG_WARN, "commit file wan't deleted after commit");
close (lock_fd);
bf_commitClean ();
unlink (path);
}
else if (*buf == 'w')
{
- logf (LOG_WARN, "Your index may be inconsistent");
+ logf (LOG_WARN, "your index may be inconsistent");
exit (1);
}
else if (*buf == 'c')
close (lock_fd);
continue;
}
- logf (LOG_FATAL, "Previous transaction didn't"
+ logf (LOG_FATAL, "previous transaction didn't"
" finish commit. Commit now!");
exit (1);
}
else
{
- logf (LOG_FATAL, "Unknown id 0x%02x in %s", *buf,
+ logf (LOG_FATAL, "unknown id 0x%02x in %s", *buf,
path);
exit (1);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.46 1997-02-10 10:20:13 adam
+ * Revision 1.47 1997-02-12 20:39:46 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.46 1997/02/10 10:20:13 adam
* Flag fileVerboseFlag set to 0 (default).
*
* Revision 1.45 1996/11/08 11:10:26 adam
rGroupDef.flagStoreData = -1;
rGroupDef.flagStoreKeys = -1;
rGroupDef.flagShowRecords = 0;
- rGroupDef.fileVerboseFlag = 0;
+ rGroupDef.fileVerboseLimit = 100000;
prog = *argv;
if (argc < 2)
" -g <group> Index files according to group settings.\n"
" -d <database> Records belong to Z39.50 database <database>.\n"
" -m <mbytes> Use <mbytes> before flushing keys to disk.\n"
- " -n Don't use shadow system\n"
- " -s Show analysis on stdout, but do no work\n"
- " -v <level> Set logging to <level>\n"
- " -V Show version\n"
+ " -n Don't use shadow system.\n"
+ " -s Show analysis on stdout, but do no work.\n"
+ " -v <level> Set logging to <level>.\n"
+ " -f <n> Display information for the first <n> records.\n"
+ " -V Show version.\n"
);
exit (1);
}
- log_event_end (abort_func, NULL);
- while ((ret = options ("sVt:c:g:d:m:v:n", argv, argc, &arg)) != -2)
+ while ((ret = options ("sVt:c:g:d:m:v:nf:", argv, argc, &arg)) != -2)
{
if (ret == 0)
{
{
if (!common_resource)
{
+ logf (LOG_LOG, "zebra version %s %s",
+ ZEBRAVER, ZEBRADATE);
common_resource = res_open (configName ?
configName : FNAME_CONFIG);
if (!common_resource)
{
- logf (LOG_FATAL, "Cannot open resource `%s'",
+ logf (LOG_FATAL, "cannot open resource `%s'",
configName);
exit (1);
}
}
if (bf_commitExists ())
{
- logf (LOG_LOG, "Commit start");
+ logf (LOG_LOG, "commit start");
zebraIndexLockMsg ("c");
zebraIndexWait (1);
- logf (LOG_LOG, "Commit execute");
+ logf (LOG_LOG, "commit execute");
bf_commitExec ();
sync ();
zebraIndexLockMsg ("d");
zebraIndexWait (0);
- logf (LOG_LOG, "Commit clean");
+ logf (LOG_LOG, "commit clean");
bf_commitClean ();
}
else
- logf (LOG_LOG, "Nothing to commit");
+ logf (LOG_LOG, "cothing to commit");
}
else if (!strcmp (arg, "clean"))
{
{
zebraIndexLockMsg ("d");
zebraIndexWait (0);
- logf (LOG_LOG, "Commit clean");
+ logf (LOG_LOG, "commit clean");
bf_commitClean ();
}
else
- logf (LOG_LOG, "Nothing to clean");
+ logf (LOG_LOG, "nothing to clean");
}
else if (!strcmp (arg, "stat") || !strcmp (arg, "status"))
{
}
else
{
- logf (LOG_FATAL, "Unknown command: %s", arg);
+ logf (LOG_FATAL, "unknown command: %s", arg);
exit (1);
}
}
{
struct recordGroup rGroup;
+ log_event_end (abort_func, NULL);
zebraIndexLock (0);
rval = res_get (common_resource, "shadow");
if (rval && *rval && !disableCommit)
{
case 'u':
key_open (mem_max);
- logf (LOG_LOG, "Updating %s", rGroup.path);
+ logf (LOG_LOG, "updating %s", rGroup.path);
repositoryUpdate (&rGroup);
nsections = key_close ();
break;
case 'U':
key_open (mem_max);
- logf (LOG_LOG, "Updating (pass 1) %s", rGroup.path);
+ logf (LOG_LOG, "updating (pass 1) %s", rGroup.path);
repositoryUpdate (&rGroup);
key_close ();
nsections = 0;
break;
case 'd':
key_open (mem_max);
- logf (LOG_LOG, "Deleting %s", rGroup.path);
+ logf (LOG_LOG, "deleting %s", rGroup.path);
repositoryDelete (&rGroup);
nsections = key_close ();
break;
case 's':
- logf (LOG_LOG, "Dumping %s", rGroup.path);
+ logf (LOG_LOG, "dumping %s", rGroup.path);
repositoryShow (&rGroup);
nsections = 0;
break;
cmd = 0;
if (nsections)
{
- logf (LOG_LOG, "Merging with index");
+ logf (LOG_LOG, "merging with index");
key_input (nsections, 60);
sync ();
}
+ log_event_end (NULL, NULL);
}
}
else if (ret == 'V')
{
- fprintf (stderr, "Zebra %s %s\n",
- ZEBRAVER, ZEBRADATE);
+ fprintf (stderr, "Zebra %s %s\n", ZEBRAVER, ZEBRADATE);
}
else if (ret == 'v')
- {
log_init (log_mask_str(arg), prog, NULL);
- }
else if (ret == 'm')
- {
mem_max = 1024*1024*atoi(arg);
- }
else if (ret == 'd')
- {
rGroupDef.databaseName = arg;
- }
else if (ret == 's')
- {
rGroupDef.flagShowRecords = 1;
- rGroupDef.fileVerboseFlag = 1;
- }
else if (ret == 'g')
- {
rGroupDef.groupName = arg;
- }
+ else if (ret == 'f')
+ rGroupDef.fileVerboseLimit = atoi(arg);
else if (ret == 'c')
configName = arg;
else if (ret == 't')
disableCommit = 1;
else
{
- logf (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "unknown option '-%s'", arg);
exit (1);
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindex.c,v $
- * Revision 1.16 1996-06-04 10:19:00 adam
+ * Revision 1.17 1997-02-12 20:39:46 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.16 1996/06/04 10:19:00 adam
* Minor changes - removed include of ctype.h.
*
* Revision 1.15 1996/05/13 14:23:06 adam
assert (p);
rec = xmalloc (sizeof(*rec));
- if (p->head.index_free == 0)
+ if (1 || p->head.index_free == 0)
sysno = (p->head.index_last)++;
else
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: trav.c,v $
- * Revision 1.28 1996-11-01 08:58:44 adam
+ * Revision 1.29 1997-02-12 20:39:47 adam
+ * Implemented options -f <n> that limits the log to the first <n>
+ * records.
+ * Changed some log messages also.
+ *
+ * Revision 1.28 1996/11/01 08:58:44 adam
* Interface to isamc system now includes update and delete.
*
* Revision 1.27 1996/10/29 14:06:56 adam
e = dir_open (rep);
if (!e)
return;
- logf (LOG_LOG, "Dir: %s", rep);
+ logf (LOG_LOG, "dir %s", rep);
if (rep[rep_len-1] != '/')
rep[rep_len] = '/';
else
sprintf (tmppath, "%s%s", base, src);
e_src = dir_open (tmppath);
- logf (LOG_LOG, "Dir: %s", tmppath);
+ logf (LOG_LOG, "dir %s", tmppath);
#if 0
if (!dst || repComp (dst->path, src, src_len))