From 869b11178c518bf4b8c81e1cb5daca8cfc8a17c6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 7 Feb 1996 14:06:37 +0000 Subject: [PATCH] Better progress report during register merge. New command: clean - removes temporary shadow files. --- index/kinput.c | 31 ++++++++++++++++++------------- index/main.c | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/index/kinput.c b/index/kinput.c index 23687bb..65237eb 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kinput.c,v $ - * Revision 1.13 1996-02-05 12:30:00 adam + * Revision 1.14 1996-02-07 14:06:37 adam + * Better progress report during register merge. + * New command: clean - removes temporary shadow files. + * + * Revision 1.13 1996/02/05 12:30:00 adam * Logging reduced a bit. * The remaining running time is estimated during register merge. * @@ -424,20 +428,21 @@ void progressFunc (struct key_file *keyp, void *info) if (keyp->buf_size <= 0 || p->totalBytes <= 0) return ; - p->totalOffset += keyp->buf_size; time (&now); - if (now < p->lastTime+10) - return ; - p->lastTime = now; - remaining = (now - p->startTime)* - ((double) p->totalBytes/p->totalOffset - 1.0); - if (remaining <= 130) - logf (LOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining", - (100.0*p->totalOffset) / p->totalBytes, (long) remaining); - else - logf (LOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining", - (100.0*p->totalOffset) / p->totalBytes, (long) remaining/60); + if (now >= p->lastTime+10) + { + p->lastTime = now; + remaining = (now - p->startTime)* + ((double) p->totalBytes/p->totalOffset - 1.0); + if (remaining <= 130) + logf (LOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining", + (100.0*p->totalOffset) / p->totalBytes, (long) remaining); + else + logf (LOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining", + (100.0*p->totalOffset) / p->totalBytes, (long) remaining/60); + } + p->totalOffset += keyp->buf_size; } void key_input (const char *dict_fname, const char *isam_fname, diff --git a/index/main.c b/index/main.c index 704dc92..51b475e 100644 --- a/index/main.c +++ b/index/main.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: main.c,v $ - * Revision 1.33 1996-02-06 17:11:18 adam + * Revision 1.34 1996-02-07 14:06:39 adam + * Better progress report during register merge. + * New command: clean - removes temporary shadow files. + * + * Revision 1.33 1996/02/06 17:11:18 adam * Minor changes. * * Revision 1.32 1996/02/01 20:50:04 adam @@ -170,6 +174,7 @@ int main (int argc, char **argv) " If is empty filenames are read from stdin.\n" " delete Delete index with files below .\n" " commit Commit changes\n" + " clean Clean shadow files\n" "Options:\n" " -t Index files as (grs or text).\n" " -c Read configuration file .\n" @@ -232,6 +237,19 @@ int main (int argc, char **argv) else logf (LOG_LOG, "Nothing to commit"); } + else if (!strcmp (arg, "clean")) + { + zebraIndexLock (0); + if (bf_commitExists ()) + { + zebraIndexLockMsg ("d"); + zebraIndexWait (0); + logf (LOG_LOG, "Commit clean"); + bf_commitClean (); + } + else + logf (LOG_LOG, "Nothing to clean"); + } else if (!strcmp (arg, "stat") || !strcmp (arg, "status")) { zebraIndexLock (0); -- 1.7.10.4