2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.52 1996-04-25 13:27:57 adam
8 * Function recordExtract modified so that files with no keys (possibly empty)
11 * Revision 1.51 1996/03/19 11:08:42 adam
12 * Bug fix: Log preamble wasn't always turned off after recordExtract.
14 * Revision 1.50 1996/02/12 18:45:36 adam
15 * New fileVerboseFlag in record group control.
17 * Revision 1.49 1996/02/05 12:29:57 adam
18 * Logging reduced a bit.
19 * The remaining running time is estimated during register merge.
21 * Revision 1.48 1996/02/01 20:53:26 adam
22 * The temporary per-record keys are compacted a little, and duplication
23 * of the per-records keys are avoided when they are saved in the record
26 * Revision 1.47 1996/01/17 14:57:48 adam
27 * Prototype changed for reader functions in extract/retrieve. File
28 * is identified by 'void *' instead of 'int.
30 * Revision 1.46 1995/12/15 14:57:16 adam
33 * Revision 1.45 1995/12/15 12:37:41 adam
34 * In addRecordKeyAny: Writes key only when attrSet != -1.
36 * Revision 1.44 1995/12/12 16:00:54 adam
37 * System call sync(2) used after update/commit.
38 * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
41 * Revision 1.43 1995/12/11 09:12:46 adam
42 * The rec_get function returns NULL if record doesn't exist - will
43 * happen in the server if the result set records have been deleted since
44 * the creation of the set (i.e. the search).
45 * The server saves a result temporarily if it is 'volatile', i.e. the
46 * set is register dependent.
48 * Revision 1.42 1995/12/07 17:38:46 adam
49 * Work locking mechanisms for concurrent updates/commit.
51 * Revision 1.41 1995/12/06 16:06:42 adam
52 * Better diagnostics. Work on 'real' dictionary deletion.
54 * Revision 1.40 1995/12/05 16:57:40 adam
55 * More work on regular patterns.
57 * Revision 1.39 1995/12/05 13:20:18 adam
58 * Bug fix: file_read sometimes returned early EOF.
60 * Revision 1.38 1995/12/04 17:59:21 adam
61 * More work on regular expression conversion.
63 * Revision 1.37 1995/12/04 14:22:27 adam
64 * Extra arg to recType_byName.
65 * Started work on new regular expression parsed input to
68 * Revision 1.36 1995/11/30 08:34:29 adam
69 * Started work on commit facility.
70 * Changed a few malloc/free to xmalloc/xfree.
72 * Revision 1.35 1995/11/28 14:26:21 adam
73 * Bug fix: recordId with constant wasn't right.
74 * Bug fix: recordId dictionary entry wasn't deleted when needed.
76 * Revision 1.34 1995/11/28 09:09:38 adam
77 * Zebra config renamed.
78 * Use setting 'recordId' to identify record now.
79 * Bug fix in recindex.c: rec_release_blocks was invokeded even
80 * though the blocks were already released.
81 * File traversal properly deletes records when needed.
83 * Revision 1.33 1995/11/27 09:56:20 adam
84 * Record info elements better enumerated. Internal store of records.
86 * Revision 1.32 1995/11/25 10:24:05 adam
87 * More record fields - they are enumerated now.
88 * New options: flagStoreData flagStoreKey.
90 * Revision 1.31 1995/11/24 11:31:35 adam
91 * Commands add & del read filenames from stdin if source directory is
93 * Match criteria supports 'constant' strings.
95 * Revision 1.30 1995/11/22 17:19:16 adam
96 * Record management uses the bfile system.
98 * Revision 1.29 1995/11/21 15:01:14 adam
99 * New general match criteria implemented.
100 * New feature: document groups.
102 * Revision 1.28 1995/11/21 09:20:30 adam
103 * Yet more work on record match.
105 * Revision 1.27 1995/11/20 16:59:45 adam
106 * New update method: the 'old' keys are saved for each records.
108 * Revision 1.26 1995/11/20 11:56:24 adam
109 * Work on new traversal.
111 * Revision 1.25 1995/11/16 15:34:54 adam
112 * Uses new record management system in both indexer and server.
114 * Revision 1.24 1995/11/15 19:13:08 adam
115 * Work on record management.
117 * Revision 1.23 1995/10/27 14:00:10 adam
118 * Implemented detection of database availability.
120 * Revision 1.22 1995/10/17 18:02:07 adam
121 * New feature: databases. Implemented as prefix to words in dictionary.
123 * Revision 1.21 1995/10/10 12:24:38 adam
124 * Temporary sort files are compressed.
126 * Revision 1.20 1995/10/06 13:52:05 adam
127 * Bug fixes. Handler may abort further scanning.
129 * Revision 1.19 1995/10/04 12:55:16 adam
130 * Bug fix in ranked search. Use=Any keys inserted.
132 * Revision 1.18 1995/10/04 09:37:08 quinn
135 * Revision 1.17 1995/10/03 14:28:57 adam
136 * Buffered read in extract works.
138 * Revision 1.16 1995/10/03 14:28:45 adam
139 * Work on more effecient read handler in extract.
141 * Revision 1.15 1995/10/02 15:42:53 adam
142 * Extract uses file descriptors instead of FILE pointers.
144 * Revision 1.14 1995/10/02 15:29:13 adam
145 * More logging in file_extract.
147 * Revision 1.13 1995/09/29 14:01:39 adam
150 * Revision 1.12 1995/09/28 14:22:56 adam
151 * Sort uses smaller temporary files.
153 * Revision 1.11 1995/09/28 12:10:31 adam
154 * Bug fixes. Field prefix used in queries.
156 * Revision 1.10 1995/09/28 09:19:41 adam
157 * xfree/xmalloc used everywhere.
158 * Extract/retrieve method seems to work for text records.
160 * Revision 1.9 1995/09/27 12:22:28 adam
161 * More work on extract in record control.
162 * Field name is not in isam keys but in prefix in dictionary words.
164 * Revision 1.8 1995/09/14 07:48:22 adam
165 * Record control management.
167 * Revision 1.7 1995/09/11 13:09:32 adam
168 * More work on relevance feedback.
170 * Revision 1.6 1995/09/08 14:52:27 adam
171 * Minor changes. Dictionary is lower case now.
173 * Revision 1.5 1995/09/06 16:11:16 adam
174 * Option: only one word key per file.
176 * Revision 1.4 1995/09/05 15:28:39 adam
177 * More work on search engine.
179 * Revision 1.3 1995/09/04 12:33:41 adam
180 * Various cleanup. YAZ util used instead.
182 * Revision 1.2 1995/09/04 09:10:34 adam
183 * More work on index add/del/update.
184 * Merge sort implemented.
185 * Initial work on z39 server.
187 * Revision 1.1 1995/09/01 14:06:35 adam
188 * Split of work into more files.
197 #include <alexutil.h>
201 #include "recindex.h"
203 static Dict matchDict;
205 static Records records = NULL;
207 static char **key_buf;
208 static size_t ptr_top;
210 static size_t key_buf_used;
211 static int key_file_no;
213 static int records_inserted = 0;
214 static int records_updated = 0;
215 static int records_deleted = 0;
217 void key_open (int mem)
221 key_buf = xmalloc (mem);
222 ptr_top = mem/sizeof(char*);
228 if (!(matchDict = dict_open (GMATCH_DICT, 50, 1)))
230 logf (LOG_FATAL, "dict_open fail of %s", GMATCH_DICT);
234 records = rec_open (1);
243 void encode_key_init (struct encode_info *i)
249 char *encode_key_int (int d, char *bp)
258 else if (d <= 4194303)
260 *bp++ = 128 + (d>>16);
261 *bp++ = (d>>8) & 255;
266 *bp++ = 192 + (d>>24);
267 *bp++ = (d>>16) & 255;
268 *bp++ = (d>>8) & 255;
274 void encode_key_write (char *k, struct encode_info *i, FILE *outf)
279 while ((*bp++ = *k++))
281 memcpy (&key, k+1, sizeof(struct it_key));
282 bp = encode_key_int ( (key.sysno - i->sysno) * 2 + *k, bp);
283 if (i->sysno != key.sysno)
285 i->sysno = key.sysno;
288 bp = encode_key_int (key.seqno - i->seqno, bp);
289 i->seqno = key.seqno;
290 if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
292 logf (LOG_FATAL|LOG_ERRNO, "fwrite");
297 void key_flush (void)
302 struct encode_info encode_info;
308 logf (LOG_LOG, "sorting section %d", key_file_no);
309 qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
310 sprintf (out_fname, TEMP_FNAME, key_file_no);
312 if (!(outf = fopen (out_fname, "w")))
314 logf (LOG_FATAL|LOG_ERRNO, "fopen (4) %s", out_fname);
317 logf (LOG_LOG, "writing section %d", key_file_no);
318 prevcp = cp = key_buf[ptr_top-ptr_i];
320 encode_key_init (&encode_info);
321 encode_key_write (cp, &encode_info, outf);
324 cp = key_buf[ptr_top-ptr_i];
325 if (strcmp (cp, prevcp))
327 encode_key_init (&encode_info);
328 encode_key_write (cp, &encode_info, outf);
332 encode_key_write (cp + strlen(cp), &encode_info, outf);
336 logf (LOG_FATAL|LOG_ERRNO, "fclose %s", out_fname);
339 logf (LOG_LOG, "finished section %d", key_file_no);
348 rec_close (&records);
349 dict_close (matchDict);
351 logf (LOG_LOG, "Records inserted %6d", records_inserted);
352 logf (LOG_LOG, "Records updated %6d", records_updated);
353 logf (LOG_LOG, "Records deleted %6d", records_deleted);
357 static void wordInit (RecWord *p)
361 p->which = Word_String;
372 static void addRecordKey (const RecWord *p)
380 if (reckeys.buf_used+1024 > reckeys.buf_max)
384 b = xmalloc (reckeys.buf_max += 128000);
385 if (reckeys.buf_used > 0)
386 memcpy (b, reckeys.buf, reckeys.buf_used);
390 dst = reckeys.buf + reckeys.buf_used;
392 attrSet = p->attrSet;
393 if (reckeys.buf_used > 0 && reckeys.prevAttrSet == attrSet)
396 reckeys.prevAttrSet = attrSet;
397 attrUse = p->attrUse;
398 if (reckeys.buf_used > 0 && reckeys.prevAttrUse == attrUse)
401 reckeys.prevAttrUse = attrUse;
410 memcpy (dst, &attrSet, sizeof(attrSet));
411 dst += sizeof(attrSet);
415 memcpy (dst, &attrUse, sizeof(attrUse));
416 dst += sizeof(attrUse);
418 for (i = 0; p->u.string[i]; i++)
419 *dst++ = p->u.string[i];
422 memcpy (dst, &p->seqno, sizeof(p->seqno));
423 dst += sizeof(p->seqno);
429 reckeys.buf_used = dst - reckeys.buf;
432 static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys,
433 const char *databaseName)
438 while (off < reckeys->buf_used)
440 const char *src = reckeys->buf + off;
448 memcpy (&attrSet, src, sizeof(attrSet));
449 src += sizeof(attrSet);
453 memcpy (&attrUse, src, sizeof(attrUse));
454 src += sizeof(attrUse);
456 if (key_buf_used + 1024 > (ptr_top-ptr_i)*sizeof(char*))
459 key_buf[ptr_top-ptr_i] = (char*)key_buf + key_buf_used;
460 key_buf_used += index_word_prefix ((char*)key_buf + key_buf_used,
461 attrSet, attrUse, databaseName);
463 ((char*)key_buf) [key_buf_used++] = index_char_cvt (*src++);
465 ((char*)key_buf) [key_buf_used++] = '\0';
467 ((char*) key_buf)[key_buf_used++] = cmd;
469 memcpy (&key.seqno, src, sizeof(key.seqno));
470 src += sizeof(key.seqno);
472 memcpy ((char*)key_buf + key_buf_used, &key, sizeof(key));
473 key_buf_used += sizeof(key);
474 off = src - reckeys->buf;
476 assert (off == reckeys->buf_used);
479 static const char **searchRecordKey (struct recKeys *reckeys,
480 int attrSetS, int attrUseS)
482 static const char *ws[32];
487 for (i = 0; i<32; i++)
490 while (off < reckeys->buf_used)
492 const char *src = reckeys->buf + off;
498 memcpy (&attrSet, src, sizeof(attrSet));
499 src += sizeof(attrSet);
501 memcpy (&attrUse, src, sizeof(attrUse));
502 src += sizeof(attrUse);
508 memcpy (&seqno, src, sizeof(seqno));
509 src += sizeof(seqno);
512 logf (LOG_LOG, "(%d,%d) %d %s", attrSet, attrUse, seqno, wstart);
514 if (attrUseS == attrUse && attrSetS == attrSet)
521 woff = seqno - startSeq;
522 if (woff >= 0 && woff < 31)
526 off = src - reckeys->buf;
528 assert (off == reckeys->buf_used);
532 static void addRecordKeyAny (const RecWord *p)
534 if (p->attrSet != 1 || p->attrUse != 1016)
538 memcpy (&w, p, sizeof(w));
543 if (p->attrSet != -1)
547 #define FILE_READ_BUFSIZE 4096
548 struct file_read_info {
551 #if FILE_READ_BUFSIZE
558 static struct file_read_info *file_read_start (int fd)
560 struct file_read_info *fi = xmalloc (sizeof(*fi));
564 #if FILE_READ_BUFSIZE
566 fi->file_buf = xmalloc (FILE_READ_BUFSIZE);
567 fi->file_bufsize = read (fd, fi->file_buf, FILE_READ_BUFSIZE);
572 static void file_read_stop (struct file_read_info *fi)
575 #if FILE_READ_BUFSIZE
576 xfree (fi->file_buf);
582 static int file_read (void *handle, char *buf, size_t count)
584 struct file_read_info *p = handle;
586 #if FILE_READ_BUFSIZE
587 int l = p->file_bufsize - p->file_offset;
593 memcpy (buf, p->file_buf + p->file_offset, l);
595 if (count > FILE_READ_BUFSIZE)
597 if ((r = read (fd, buf + l, count)) == -1)
599 logf (LOG_FATAL|LOG_ERRNO, "read");
604 p->file_noread += l+r;
607 p->file_bufsize = r = read (fd, p->file_buf, FILE_READ_BUFSIZE);
610 logf (LOG_FATAL|LOG_ERRNO, "read");
616 memcpy (buf + l, p->file_buf, r);
617 p->file_noread += l+r;
622 p->file_offset = count;
623 memcpy (buf + l, p->file_buf, count - l);
624 p->file_noread += count;
628 memcpy (buf, p->file_buf + p->file_offset, count);
629 p->file_offset += count;
630 p->file_noread += count;
634 r = read (fd, buf, count);
641 static int atois (const char **s)
644 while ( (c=**s) >= '0' && c <= '9')
646 val = val*10 + c - '0';
652 static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
656 static char dstBuf[2048];
658 const char *s = spec;
659 static const char **w;
664 while (*s == ' ' || *s == '\t')
671 int attrSet, attrUse;
675 attrSet = atois (&s);
678 logf (LOG_WARN, "Missing , in match criteria %s in group %s",
679 spec, rGroup->groupName ? rGroup->groupName : "none");
683 attrUse = atois (&s);
684 w = searchRecordKey (reckeys, attrSet, attrUse);
689 for (i = 0; i<32; i++)
694 logf (LOG_WARN, "Missing ) in match criteria %s in group %s",
695 spec, rGroup->groupName ? rGroup->groupName : "none");
700 for (i = 0; i<32; i++)
701 if (matchFlag[i] && w[i])
713 logf (LOG_WARN, "Record didn't contain match"
714 " fields in (%d,%d)", attrSet, attrUse);
722 const char *spec_src = NULL;
723 const char *s1 = ++s;
724 while (*s1 && *s1 != ' ' && *s1 != '\t')
730 memcpy (special, s, spec_len);
731 special[spec_len] = '\0';
734 if (!strcmp (special, "group"))
735 spec_src = rGroup->groupName;
736 else if (!strcmp (special, "database"))
737 spec_src = rGroup->databaseName;
738 else if (!strcmp (special, "filename"))
740 else if (!strcmp (special, "type"))
741 spec_src = rGroup->recordType;
746 strcpy (dst, spec_src);
747 dst += strlen (spec_src);
750 else if (*s == '\"' || *s == '\'')
752 int stopMarker = *s++;
756 while (*s && *s != stopMarker)
759 tmpString[i++] = *s++;
764 strcpy (dst, tmpString);
765 dst += strlen (tmpString);
769 logf (LOG_WARN, "Syntax error in match criteria %s in group %s",
770 spec, rGroup->groupName ? rGroup->groupName : "none");
777 logf (LOG_WARN, "No match criteria for record %s in group %s",
778 fname, rGroup->groupName ? rGroup->groupName : "none");
784 struct recordLogInfo {
787 struct recordGroup *rGroup;
790 static void recordLogPreamble (int level, const char *msg, void *info)
792 struct recordLogInfo *p = info;
793 FILE *outf = log_file ();
798 fprintf (outf, "%s of ", p->op);
799 fprintf (outf, "%s type %s\n", p->rGroup->recordType, p->fname);
800 log_event_start (NULL, NULL);
803 static int recordExtract (SYSNO *sysno, const char *fname,
804 struct recordGroup *rGroup, int deleteFlag,
805 struct file_read_info *fi, RecType recType,
808 struct recExtractCtrl extractCtrl;
813 struct recordLogInfo logInfo;
815 logInfo.fname = fname;
817 logInfo.rGroup = rGroup;
818 log_event_start (recordLogPreamble, &logInfo);
824 extractCtrl.subType = subType;
825 extractCtrl.init = wordInit;
826 extractCtrl.add = addRecordKeyAny;
828 reckeys.buf_used = 0;
829 reckeys.prevAttrUse = -1;
830 reckeys.prevAttrSet = -1;
831 extractCtrl.readf = file_read;
832 r = (*recType->extract)(&extractCtrl);
836 logf (LOG_WARN, "Couldn't extract file %s, code %d", fname, r);
839 if (reckeys.buf_used == 0)
841 logf (LOG_WARN, "Empty file %s", fname);
846 /* perform match if sysno not known and if match criteria is specified */
853 if (rGroup->recordId && *rGroup->recordId)
857 matchStr = fileMatchStr (&reckeys, rGroup, fname,
861 rinfo = dict_lookup (matchDict, matchStr);
863 memcpy (sysno, rinfo+1, sizeof(*sysno));
867 logf (LOG_WARN, "Bad match criteria");
878 logf (LOG_LOG, "Cannot delete new record");
882 if (rGroup->fileVerboseFlag)
883 logf (LOG_LOG, "add %s %s", rGroup->recordType, fname);
884 rec = rec_new (records);
889 dict_insert (matchDict, matchStr, sizeof(*sysno), sysno);
891 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
897 struct recKeys delkeys;
899 rec = rec_get (records, *sysno);
901 delkeys.buf_used = rec->size[recInfo_delKeys];
902 delkeys.buf = rec->info[recInfo_delKeys];
903 flushRecordKeys (*sysno, 0, &delkeys, rec->info[recInfo_databaseName]);
906 logInfo.op = "delete";
907 if (!delkeys.buf_used)
909 logf (LOG_WARN, "cannot delete; storeKeys false");
913 if (rGroup->fileVerboseFlag)
914 logf (LOG_LOG, "delete %s %s", rGroup->recordType, fname);
917 dict_delete (matchDict, matchStr);
918 rec_del (records, &rec);
924 logInfo.op = "update";
925 if (!delkeys.buf_used)
927 logf (LOG_WARN, "cannot update; storeKeys false");
931 if (rGroup->fileVerboseFlag)
932 logf (LOG_LOG, "update %s %s", rGroup->recordType, fname);
933 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
938 xfree (rec->info[recInfo_fileType]);
939 rec->info[recInfo_fileType] =
940 rec_strdup (rGroup->recordType, &rec->size[recInfo_fileType]);
942 xfree (rec->info[recInfo_filename]);
943 rec->info[recInfo_filename] =
944 rec_strdup (fname, &rec->size[recInfo_filename]);
946 xfree (rec->info[recInfo_delKeys]);
947 if (reckeys.buf_used > 0 && rGroup->flagStoreKeys == 1)
950 rec->size[recInfo_delKeys] = reckeys.buf_used;
951 rec->info[recInfo_delKeys] = reckeys.buf;
955 rec->info[recInfo_delKeys] = xmalloc (reckeys.buf_used);
956 rec->size[recInfo_delKeys] = reckeys.buf_used;
957 memcpy (rec->info[recInfo_delKeys], reckeys.buf,
958 rec->size[recInfo_delKeys]);
963 rec->info[recInfo_delKeys] = NULL;
964 rec->size[recInfo_delKeys] = 0;
967 xfree (rec->info[recInfo_storeData]);
968 if (rGroup->flagStoreData == 1)
970 rec->size[recInfo_storeData] = fi->file_noread;
971 rec->info[recInfo_storeData] = xmalloc (fi->file_noread);
972 #if FILE_READ_BUFSIZE
973 if (fi->file_noread < FILE_READ_BUFSIZE)
974 memcpy (rec->info[recInfo_storeData], fi->file_buf,
979 if (lseek (fi->fd, 0L, SEEK_SET) < 0)
981 logf (LOG_ERRNO|LOG_FATAL, "seek to 0 in %s", fname);
984 if (read (fi->fd, rec->info[recInfo_storeData], fi->file_noread)
987 logf (LOG_ERRNO|LOG_FATAL, "read %d bytes of %s",
988 fi->file_noread, fname);
995 rec->info[recInfo_storeData] = NULL;
996 rec->size[recInfo_storeData] = 0;
998 xfree (rec->info[recInfo_databaseName]);
999 rec->info[recInfo_databaseName] =
1000 rec_strdup (rGroup->databaseName, &rec->size[recInfo_databaseName]);
1002 rec_put (records, &rec);
1006 int fileExtract (SYSNO *sysno, const char *fname,
1007 const struct recordGroup *rGroupP, int deleteFlag)
1015 struct recordGroup rGroupM;
1016 struct recordGroup *rGroup = &rGroupM;
1017 struct file_read_info *fi;
1019 memcpy (rGroup, rGroupP, sizeof(*rGroupP));
1021 if (!rGroup->groupName || !*rGroup->groupName)
1024 sprintf (gprefix, "%s.", rGroup->groupName);
1026 logf (LOG_DEBUG, "fileExtract %s", fname);
1028 /* determine file extension */
1029 for (i = strlen(fname); --i >= 0; )
1030 if (fname[i] == '/')
1035 else if (fname[i] == '.')
1037 strcpy (ext, fname+i+1);
1040 /* determine file type - depending on extension */
1041 if (!rGroup->recordType)
1043 sprintf (ext_res, "%srecordType.%s", gprefix, ext);
1044 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1046 sprintf (ext_res, "%srecordType", gprefix);
1047 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1049 if (rGroup->fileVerboseFlag)
1050 logf (LOG_LOG, "? %s", fname);
1055 if (!rGroup->recordType)
1057 if (rGroup->fileVerboseFlag)
1058 logf (LOG_LOG, "? record %s", fname);
1061 if (!(recType = recType_byName (rGroup->recordType, subType)))
1063 logf (LOG_WARN, "No such record type: %s", rGroup->recordType);
1067 /* determine match criteria */
1068 if (!rGroup->recordId)
1070 sprintf (ext_res, "%srecordId.%s", gprefix, ext);
1071 rGroup->recordId = res_get (common_resource, ext_res);
1074 /* determine database name */
1075 if (!rGroup->databaseName)
1077 sprintf (ext_res, "%sdatabase.%s", gprefix, ext);
1078 if (!(rGroup->databaseName = res_get (common_resource, ext_res)))
1080 sprintf (ext_res, "%sdatabase", gprefix);
1081 rGroup->databaseName = res_get (common_resource, ext_res);
1084 if (!rGroup->databaseName)
1085 rGroup->databaseName = "Default";
1087 if (rGroup->flagStoreData == -1)
1090 sprintf (ext_res, "%sstoreData.%s", gprefix, ext);
1091 if (!(sval = res_get (common_resource, ext_res)))
1093 sprintf (ext_res, "%sstoreData", gprefix);
1094 sval = res_get (common_resource, ext_res);
1097 rGroup->flagStoreData = atoi (sval);
1099 if (rGroup->flagStoreData == -1)
1100 rGroup->flagStoreData = 0;
1102 if (rGroup->flagStoreKeys == -1)
1106 sprintf (ext_res, "%sstoreKeys.%s", gprefix, ext);
1107 if (!(sval = res_get (common_resource, ext_res)))
1109 sprintf (ext_res, "%sstoreKeys", gprefix);
1110 sval = res_get (common_resource, ext_res);
1113 rGroup->flagStoreKeys = atoi (sval);
1115 if (rGroup->flagStoreKeys == -1)
1116 rGroup->flagStoreKeys = 0;
1118 if (sysno && deleteFlag)
1122 if ((fd = open (fname, O_RDONLY)) == -1)
1124 logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
1128 fi = file_read_start (fd);
1129 r = recordExtract (sysno, fname, rGroup, deleteFlag, fi, recType, subType);
1130 log_event_start (NULL, NULL);
1131 file_read_stop (fi);