The test option (-s) only uses read-lock (and not write lock).
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Jan 1998 15:04:07 +0000 (15:04 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 12 Jan 1998 15:04:07 +0000 (15:04 +0000)
index/dirs.c
index/extract.c
index/index.h
index/lockidx.c
index/main.c
index/recindex.c
index/recindex.h
index/recstat.c
index/trav.c
index/trunc.c
index/zserver.c

index 4497e6a..70b9f4d 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1996, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dirs.c,v $
- * Revision 1.13  1997-09-09 13:38:06  adam
+ * Revision 1.14  1998-01-12 15:04:07  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.13  1997/09/09 13:38:06  adam
  * Partial port to WIN95/NT.
  *
  * Revision 1.12  1996/11/08 11:10:13  adam
@@ -61,6 +64,7 @@
 
 struct dirs_info {
     Dict dict;
+    int rw;
     int no_read;
     int no_cur;
     int no_max;
@@ -108,7 +112,7 @@ static int dirs_client_proc (char *name, const char *info, int pos,
     return 0;
 }
 
-struct dirs_info *dirs_open (Dict dict, const char *rep)
+struct dirs_info *dirs_open (Dict dict, const char *rep, int rw)
 {
     struct dirs_info *p;
     int before = 0, after;
@@ -116,6 +120,7 @@ struct dirs_info *dirs_open (Dict dict, const char *rep)
     logf (LOG_DEBUG, "dirs_open %s", rep);
     p = xmalloc (sizeof (*p));
     p->dict = dict;
+    p->rw = rw;
     strcpy (p->prefix, rep);
     p->prelen = strlen(p->prefix);
     strcpy (p->nextpath, rep);
@@ -187,7 +192,8 @@ void dirs_mkdir (struct dirs_info *p, const char *src, time_t mtime)
 
     sprintf (path, "%s%s", p->prefix, src);
     logf (LOG_DEBUG, "dirs_mkdir %s", path);
-    dict_insert (p->dict, path, sizeof(mtime), &mtime);
+    if (p->rw)
+       dict_insert (p->dict, path, sizeof(mtime), &mtime);
 }
 
 void dirs_rmdir (struct dirs_info *p, const char *src)
@@ -196,7 +202,8 @@ void dirs_rmdir (struct dirs_info *p, const char *src)
 
     sprintf (path, "%s%s", p->prefix, src);
     logf (LOG_DEBUG, "dirs_rmdir %s", path);
-    dict_delete (p->dict, path);
+    if (p->rw)
+       dict_delete (p->dict, path);
 }
 
 void dirs_add (struct dirs_info *p, const char *src, int sysno, time_t mtime)
@@ -208,7 +215,8 @@ void dirs_add (struct dirs_info *p, const char *src, int sysno, time_t mtime)
     logf (LOG_DEBUG, "dirs_add %s", path);
     memcpy (info, &sysno, sizeof(sysno));
     memcpy (info+sizeof(sysno), &mtime, sizeof(mtime));
-    dict_insert (p->dict, path, sizeof(sysno)+sizeof(mtime), info);
+    if (p->rw)
+       dict_insert (p->dict, path, sizeof(sysno)+sizeof(mtime), info);
 }
 
 void dirs_del (struct dirs_info *p, const char *src)
@@ -217,7 +225,8 @@ void dirs_del (struct dirs_info *p, const char *src)
 
     sprintf (path, "%s%s", p->prefix, src);
     logf (LOG_DEBUG, "dirs_del %s", path);
-    dict_delete (p->dict, path);
+    if (p->rw)
+       dict_delete (p->dict, path);
 }
 
 void dirs_free (struct dirs_info **pp)
index 7374470..db1c9c7 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.76  1997-10-27 14:33:04  adam
+ * Revision 1.77  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.76  1997/10/27 14:33:04  adam
  * Moved towards generic character mapping depending on "structure"
  * field in abstract syntax file. Fixed a few memory leaks. Fixed
  * bug with negative integers when doing searches with relational
@@ -320,7 +323,7 @@ static void logRecord (int showFlag)
     }
 }
 
-void key_open (BFiles bfs, int mem)
+int key_open (BFiles bfs, int mem, int rw)
 {
     if (!mem)
         mem = atoi(res_get_def (common_resource, "memMax", "4"))*1024*1024;
@@ -333,16 +336,26 @@ void key_open (BFiles bfs, int mem)
     key_buf_used = 0;
     key_file_no = 0;
 
-    if (!(matchDict = dict_open (bfs, GMATCH_DICT, 50, 1)))
+    if (!(matchDict = dict_open (bfs, GMATCH_DICT, 50, rw)))
     {
         logf (LOG_FATAL, "dict_open fail of %s", GMATCH_DICT);
-        exit (1);
+       return -1;
     }
     assert (!records);
-    records = rec_open (bfs, 1);
-#if 1
-    zti = zebTargetInfo_open (records, 1);
-#endif
+    records = rec_open (bfs, rw);
+    if (!records)
+    {
+       dict_close (matchDict);
+       return -1;
+    }
+    zti = zebTargetInfo_open (records, rw);
+    if (!zti)
+    {
+       rec_close (&records);
+       dict_close (matchDict);
+       return -1;      
+    }
+    return 0;
 }
 
 struct encode_info {
@@ -447,7 +460,7 @@ void key_flush (void)
 
     if (!(outf = fopen (out_fname, "w")))
     {
-        logf (LOG_FATAL|LOG_ERRNO, "fopen (4) %s", out_fname);
+        logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
     }
     logf (LOG_LOG, "writing section %d", key_file_no);
@@ -473,7 +486,7 @@ void key_flush (void)
 
     if (!(outf = fopen (out_fname, "w")))
     {
-        logf (LOG_FATAL|LOG_ERRNO, "fopen (4) %s", out_fname);
+        logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
     }
     logf (LOG_LOG, "writing section %d", key_file_no);
@@ -999,8 +1012,8 @@ static int recordExtract (SYSNO *sysno, const char *fname,
         extractCtrl.tellf = file_tell;
         extractCtrl.endf = file_end;
        extractCtrl.zebra_maps = rGroup->zebra_maps;
-        extractCtrl.flagShowRecords = rGroup->flagShowRecords;
-        if (rGroup->flagShowRecords)
+        extractCtrl.flagShowRecords = !rGroup->flagRw;
+        if (!rGroup->flagRw)
             printf ("File: %s %ld\n", fname, (long) recordOffset);
 
         logInfo.fname = fname;
@@ -1015,8 +1028,8 @@ static int recordExtract (SYSNO *sysno, const char *fname,
         if (r)      
         {
             /* error occured during extraction ... */
-            if (!rGroup->flagShowRecords &&
-                    records_processed < rGroup->fileVerboseLimit)
+            if (rGroup->flagRw &&
+               records_processed < rGroup->fileVerboseLimit)
             {
                 logf (LOG_WARN, "fail %s %s %ld code = %d", rGroup->recordType,
                       fname, (long) recordOffset, r);
@@ -1027,7 +1040,7 @@ static int recordExtract (SYSNO *sysno, const char *fname,
         {
             /* the extraction process returned no information - the record
                is probably empty - unless flagShowRecords is in use */
-            if (rGroup->flagShowRecords)
+            if (!rGroup->flagRw)
                 return 1;
             logf (LOG_WARN, "No keys generated for file %s", fname);
             logf (LOG_WARN, " The file is probably empty");
@@ -1067,7 +1080,9 @@ static int recordExtract (SYSNO *sysno, const char *fname,
         /* new record */
         if (deleteFlag)
         {
-            logf (LOG_LOG, "Cannot delete new record");
+           logf (LOG_LOG, "delete %s %s %ld", rGroup->recordType,
+                 fname, (long) recordOffset);
+            logf (LOG_WARN, "cannot delete record above (seems new)");
             return 1;
         }
         if (records_processed < rGroup->fileVerboseLimit)
index 684b10e..b43fd42 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1995-1997, Index Data I/S 
+ * Copyright (C) 1995-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: index.h,v $
- * Revision 1.55  1997-10-27 14:33:04  adam
+ * Revision 1.56  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.55  1997/10/27 14:33:04  adam
  * Moved towards generic character mapping depending on "structure"
  * field in abstract syntax file. Fixed a few memory leaks. Fixed
  * bug with negative integers when doing searches with relational
@@ -243,7 +246,7 @@ struct recordGroup {
     char         *recordType;
     int          flagStoreData;
     int          flagStoreKeys;
-    int          flagShowRecords;
+    int          flagRw;
     int          fileVerboseLimit;
     data1_handle dh;
     BFiles       bfs;
@@ -252,7 +255,7 @@ struct recordGroup {
 
 void getFnameTmp (char *fname, int no);
         
-struct dirs_info *dirs_open (Dict dict, const char *rep);
+struct dirs_info *dirs_open (Dict dict, const char *rep, int rw);
 struct dirs_info *dirs_fopen (Dict dict, const char *path);
 struct dirs_entry *dirs_read (struct dirs_info *p);
 struct dirs_entry *dirs_last (struct dirs_info *p);
@@ -271,7 +274,7 @@ void repositoryAdd (struct recordGroup *rGroup);
 void repositoryDelete (struct recordGroup *rGroup);
 void repositoryShow (struct recordGroup *rGroup);
 
-void key_open (BFiles bfs, int mem);
+int key_open (BFiles bfs, int mem, int rw);
 int key_close (void);
 int key_compare (const void *p1, const void *p2);
 int key_get_pos (const void *p);
@@ -303,8 +306,6 @@ int index_word_prefix (char *string, int attset_ordinal,
 int fileExtract (SYSNO *sysno, const char *fname,
                  const struct recordGroup *rGroup, int deleteFlag);
 
-void rec_prstat (void);
-
 void zebraIndexLockMsg (const char *str);
 void zebraIndexUnlock (void);
 void zebraIndexLock (BFiles bfs, int commitNow, const char *rval);
index 30bc6d0..45f7261 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1995, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: lockidx.c,v $
- * Revision 1.13  1997-09-29 09:08:36  adam
+ * Revision 1.14  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.13  1997/09/29 09:08:36  adam
  * Revised locking system to be thread safe for the server.
  *
  * Revision 1.12  1997/09/25 14:54:43  adam
@@ -247,7 +250,12 @@ void zebraIndexLock (BFiles bfs, int commitNow, const char *rval)
                 }                    
                 else if (*buf == 'w')
                 {
-                    logf (LOG_WARN, "your index may be inconsistent");
+                   logf (LOG_WARN,
+                         "The lock file indicates that your index is");
+                   logf (LOG_WARN, "inconsistent. Perhaps the indexer");
+                   logf (LOG_WARN, "terminated abnormally in the previous");
+                   logf (LOG_WARN, "run. You can try to proceed by");
+                   logf (LOG_WARN, "deleting the file %s", path);
                     exit (1);
                 }
                 else if (*buf == 'c')
index 7870d52..6feff1b 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: main.c,v $
- * Revision 1.53  1997-11-18 10:05:08  adam
+ * Revision 1.54  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.53  1997/11/18 10:05:08  adam
  * Changed character map facility so that admin can specify character
  * mapping files for each register type, w, p, etc.
  *
 
 #include <data1.h>
 #include "index.h"
+#include "recindex.h"
 
 char *prog;
-size_t mem_max = 0;
 
 Res common_resource = 0;
 
-static void abort_func (int level, const char *msg, void *info)
-{
-    if (level & LOG_FATAL)
-        abort ();
-}
-
 int main (int argc, char **argv)
 {
     int ret;
@@ -228,6 +225,7 @@ int main (int argc, char **argv)
     char *configName = NULL;
     int nsections;
     int disableCommit = 0;
+    size_t mem_max = 0;
 
     struct recordGroup rGroupDef;
 
@@ -240,7 +238,7 @@ int main (int argc, char **argv)
     rGroupDef.recordType = NULL;
     rGroupDef.flagStoreData = -1;
     rGroupDef.flagStoreKeys = -1;
-    rGroupDef.flagShowRecords = 0;
+    rGroupDef.flagRw = 1;
     rGroupDef.fileVerboseLimit = 100000;
     rGroupDef.zebra_maps = NULL;
     rGroupDef.dh = data1_create ();
@@ -284,7 +282,7 @@ int main (int argc, char **argv)
                                                 configName : FNAME_CONFIG);
                     if (!common_resource)
                     {
-                        logf (LOG_FATAL, "cannot open resource `%s'",
+                        logf (LOG_FATAL, "cannot configuration file `%s'",
                               configName);
                         exit (1);
                     }
@@ -355,6 +353,7 @@ int main (int argc, char **argv)
                 }
                 else if (!strcmp (arg, "stat") || !strcmp (arg, "status"))
                 {
+                   Records records;
                     rval = res_get (common_resource, "shadow");
                     zebraIndexLock (rGroupDef.bfs, 0, rval);
                     if (rval && *rval)
@@ -362,7 +361,9 @@ int main (int argc, char **argv)
                         bf_cache (rGroupDef.bfs, rval);
                         zebraIndexLockMsg ("r");
                     }
-                    rec_prstat ();
+                   records = rec_open (rGroupDef.bfs, 0);
+                    rec_prstat (records);
+                   rec_close (&records);
                     inv_prstat (rGroupDef.bfs);
                 }
                 else
@@ -371,47 +372,55 @@ int main (int argc, char **argv)
                     exit (1);
                 }
             }
-            else
+           else
             {
                 struct recordGroup rGroup;
 
                 log_event_end (abort_func, NULL);
                 rval = res_get (common_resource, "shadow");
                 zebraIndexLock (rGroupDef.bfs, 0, rval);
-                if (rval && *rval && !disableCommit)
-                {
-                    bf_cache (rGroupDef.bfs, rval);
-                    zebraIndexLockMsg ("r");
-                }
-                else
-                {
-                    bf_cache (rGroupDef.bfs, 0);
-                    zebraIndexLockMsg ("w");
-                }
-                zebraIndexWait (0);
-                
+               if (rGroupDef.flagRw)
+               {
+                   if (rval && *rval && !disableCommit)
+                   {
+                       bf_cache (rGroupDef.bfs, rval);
+                       zebraIndexLockMsg ("r");
+                   }
+                   else
+                   {
+                       bf_cache (rGroupDef.bfs, 0);
+                       zebraIndexLockMsg ("w");
+                   }
+                   zebraIndexWait (0);
+               }
                 memcpy (&rGroup, &rGroupDef, sizeof(rGroup));
                 rGroup.path = arg;
                 switch (cmd)
                 {
                 case 'u':
-                    key_open (rGroup.bfs, mem_max);
-                    logf (LOG_LOG, "updating %s", rGroup.path);
-                    repositoryUpdate (&rGroup);
-                    nsections = key_close ();
+                    if (!key_open (rGroup.bfs, mem_max, rGroup.flagRw))
+                   {
+                       logf (LOG_LOG, "updating %s", rGroup.path);
+                       repositoryUpdate (&rGroup);
+                       nsections = key_close ();
+                   }
                     break;
                 case 'U':
-                    key_open (rGroup.bfs,mem_max);
-                    logf (LOG_LOG, "updating (pass 1) %s", rGroup.path);
-                    repositoryUpdate (&rGroup);
-                    key_close ();
+                    if (!key_open (rGroup.bfs,mem_max, rGroup.flagRw))
+                   {
+                       logf (LOG_LOG, "updating (pass 1) %s", rGroup.path);
+                       repositoryUpdate (&rGroup);
+                       key_close ();
+                   }
                     nsections = 0;
                     break;
                 case 'd':
-                    key_open (rGroup.bfs,mem_max);
-                    logf (LOG_LOG, "deleting %s", rGroup.path);
-                    repositoryDelete (&rGroup);
-                    nsections = key_close ();
+                    if (!key_open (rGroup.bfs,mem_max, rGroup.flagRw))
+                   {
+                       logf (LOG_LOG, "deleting %s", rGroup.path);
+                       repositoryDelete (&rGroup);
+                       nsections = key_close ();
+                   }
                     break;
                 case 's':
                     logf (LOG_LOG, "dumping %s", rGroup.path);
@@ -447,7 +456,7 @@ int main (int argc, char **argv)
         else if (ret == 'd')
             rGroupDef.databaseName = arg;
        else if (ret == 's')
-           rGroupDef.flagShowRecords = 1;
+           rGroupDef.flagRw = 0;
         else if (ret == 'g')
             rGroupDef.groupName = arg;
         else if (ret == 'f')
@@ -459,10 +468,7 @@ int main (int argc, char **argv)
         else if (ret == 'n')
             disableCommit = 1;
         else
-        {
-            logf (LOG_FATAL, "unknown option '-%s'", arg);
-            exit (1);
-        }
+            logf (LOG_WARN, "unknown option '-%s'", arg);
     }
     if (common_resource)
     {
index 25a997f..73ef633 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: recindex.c,v $
- * Revision 1.19  1997-09-17 12:19:16  adam
+ * Revision 1.20  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.19  1997/09/17 12:19:16  adam
  * Zebra version corresponds to YAZ version 1.4.
  * Changed Zebra server so that it doesn't depend on global common_resource.
  *
@@ -127,7 +130,6 @@ static int read_indx (Records p, int sysno, void *buf, int itemsize,
     {
         logf (LOG_FATAL|LOG_ERRNO, "read in %s at pos %ld",
               p->index_fname, (long) pos);
-        abort ();
         exit (1);
     }
     return r;
@@ -231,6 +233,7 @@ static void rec_write_single (Records p, Record rec)
             {
                 logf (LOG_FATAL|LOG_ERRNO, "read in %s at free block %d",
                       p->data_fname[dst_type], block_free);
+               exit (1);
             }
         }
         else
index 40c2c68..9285465 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1995, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: recindex.h,v $
- * Revision 1.11  1997-09-17 12:19:16  adam
+ * Revision 1.12  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.11  1997/09/17 12:19:16  adam
  * Zebra version corresponds to YAZ version 1.4.
  * Changed Zebra server so that it doesn't depend on global common_resource.
  *
@@ -72,6 +75,7 @@ Record rec_get (Records p, int sysno);
 void rec_close (Records *p);
 Records rec_open (BFiles bfs, int rw);
 char *rec_strdup (const char *s, size_t *len);
+void rec_prstat (Records p);
 
 enum { 
     recInfo_fileType, 
index dc904b0..e639592 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1996, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: recstat.c,v $
- * Revision 1.5  1997-09-17 12:19:17  adam
+ * Revision 1.6  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.5  1997/09/17 12:19:17  adam
  * Zebra version corresponds to YAZ version 1.4.
  * Changed Zebra server so that it doesn't depend on global common_resource.
  *
@@ -34,9 +37,8 @@
 #endif
 #include "recindxp.h"
 
-void rec_prstat (BFiles bfs)
+void rec_prstat (Records records)
 {
-    Records records = rec_open (bfs, 0);
     int i;
     int total_bytes = 0;
     
@@ -60,5 +62,4 @@ void rec_prstat (BFiles bfs)
           records->head.total_bytes);
     logf (LOG_LOG,
           "Total size with overhead             %8d", total_bytes);
-    rec_close (&records);
 }
index c4d2f2d..49af41e 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: trav.c,v $
- * Revision 1.32  1997-09-25 14:56:51  adam
+ * Revision 1.33  1998-01-12 15:04:08  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.32  1997/09/25 14:56:51  adam
  * Windows NT interface code to the stat call.
  *
  * Revision 1.31  1997/09/17 12:19:17  adam
@@ -367,10 +370,10 @@ void repositoryShow (struct recordGroup *rGroup)
     Dict dict;
     struct dirs_info *di;
     
-    if (!(dict = dict_open (rGroup->bfs, FMATCH_DICT, 50, 1)))
+    if (!(dict = dict_open (rGroup->bfs, FMATCH_DICT, 50, 0)))
     {
         logf (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
-        exit (1);
+       return;
     }
     
     assert (rGroup->path);    
@@ -383,7 +386,7 @@ void repositoryShow (struct recordGroup *rGroup)
         src[++src_len] = '\0';
     }
     
-    di = dirs_open (dict, src);
+    di = dirs_open (dict, src, rGroup->flagRw);
     
     while ( (dst = dirs_read (di)) )
         logf (LOG_LOG, "%s", dst->path);
@@ -432,14 +435,14 @@ static void fileUpdate (Dict dict, struct recordGroup *rGroup,
             src[src_len] = '/';
             src[++src_len] = '\0';
         }
-        di = dirs_open (dict, src);
+        di = dirs_open (dict, src, rGroup->flagRw);
         *dst = '\0';
         fileUpdateR (di, dirs_read (di), src, dst, rGroup);
         dirs_free (&di);
     }
     else
     {
-        logf (LOG_WARN, "Cannot handle file %s", src);
+        logf (LOG_WARN, "Ignoring path %s", src);
     }
 }
 
@@ -459,7 +462,7 @@ static void repositoryExtract (int deleteFlag, struct recordGroup *rGroup,
     else if (S_ISDIR(sbuf.st_mode))
        repositoryExtractR (deleteFlag, src, rGroup);
     else
-        logf (LOG_WARN, "Cannot handle file %s", src);
+        logf (LOG_WARN, "Ignoring path %s", src);
 }
 
 static void repositoryExtractG (int deleteFlag, struct recordGroup *rGroup)
@@ -482,10 +485,10 @@ void repositoryUpdate (struct recordGroup *rGroup)
     if (rGroup->recordId && !strcmp (rGroup->recordId, "file"))
     {
         Dict dict;
-        if (!(dict = dict_open (rGroup->bfs, FMATCH_DICT, 50, 1)))
+        if (!(dict = dict_open (rGroup->bfs, FMATCH_DICT, 50, rGroup->flagRw)))
         {
             logf (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
-            exit (1);
+           return ;
         }
         if (*rGroup->path == '\0' || !strcmp(rGroup->path, "-"))
         {
index 56ad3fb..7632b1e 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: trunc.c,v $
- * Revision 1.8  1997-10-31 12:34:27  adam
+ * Revision 1.9  1998-01-12 15:04:09  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.8  1997/10/31 12:34:27  adam
  * Bug fix: memory leak.
  *
  * Revision 1.7  1997/09/29 09:07:29  adam
@@ -397,7 +400,10 @@ RSET rset_trunc (ZServerInfo *zi, ISAM_P *isam_p, int no)
         qsort (isam_p, no, sizeof(*isam_p), isamc_trunc_cmp);
     }
     else
-        logf (LOG_FATAL, "Neither isam nor isamc set in rset_trunc");
+    {
+        logf (LOG_WARN, "Neither isam nor isamc set in rset_trunc");
+       return rset_create (rset_kind_null, NULL);
+    }
     return rset_trunc_r (zi, isam_p, 0, no, 100);
 }
 
index af81ffa..94cb90e 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1995-1997, Index Data I/S 
+ * Copyright (C) 1995-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.c,v $
- * Revision 1.52  1997-11-18 10:05:08  adam
+ * Revision 1.53  1998-01-12 15:04:09  adam
+ * The test option (-s) only uses read-lock (and not write lock).
+ *
+ * Revision 1.52  1997/11/18 10:05:08  adam
  * Changed character map facility so that admin can specify character
  * mapping files for each register type, w, p, etc.
  *
@@ -316,8 +319,9 @@ bend_initresult *bend_init (bend_initrequest *q)
     logf (LOG_LOG, "Reading resources from %s", sob->configname);
     if (!(zi->res = res_open (sob->configname)))
     {
-       logf (LOG_FATAL, "Cannot open resource `%s'", sob->configname);
-       exit (1);
+       logf (LOG_FATAL, "Failed to read resources `%s'", sob->configname);
+       r->errcode = 1;
+       return r;
     }
     zebra_server_lock_init (zi);
     zi->dh = data1_create ();
@@ -442,9 +446,8 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream,
 
     if (!(rt = recType_byName (file_type, subType)))
     {
-        logf (LOG_FATAL|LOG_ERRNO, "Retrieve: Cannot handle type %s", 
-              file_type);
-        exit (1);
+        logf (LOG_WARN, "Retrieve: Cannot handle type %s",  file_type);
+       return 14;
     }
     logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score);
     retrieveCtrl.fh = &fc;