* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.43 1995-12-11 09:12:46 adam
+ * Revision 1.44 1995-12-12 16:00:54 adam
+ * System call sync(2) used after update/commit.
+ * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
+ * and F_RDLCK.
+ *
+ * Revision 1.43 1995/12/11 09:12:46 adam
* The rec_get function returns NULL if record doesn't exist - will
* happen in the server if the result set records have been deleted since
* the creation of the set (i.e. the search).
{
if (mem < 50000)
mem = 50000;
- logf (LOG_LOG, "key_open %d", mem);
key_buf = xmalloc (mem);
ptr_top = mem/sizeof(char*);
ptr_i = 0;
int key_close (void)
{
key_flush ();
- logf (LOG_LOG, "buf free");
xfree (key_buf);
rec_close (&records);
dict_close (matchDict);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockidx.c,v $
- * Revision 1.3 1995-12-11 11:43:29 adam
+ * Revision 1.4 1995-12-12 16:00:57 adam
+ * System call sync(2) used after update/commit.
+ * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
+ * and F_RDLCK.
+ *
+ * Revision 1.3 1995/12/11 11:43:29 adam
* Locking based on fcntl instead of flock.
* Setting commitEnable removed. Command line option -n can be used to
* prevent commit if commit setting is defined in the configuration file.
sprintf (path, "%s%s", pathPrefix, FNAME_MAIN_LOCK);
while (1)
{
- lock_fd = open (path, O_CREAT|O_RDWR|O_EXCL|O_SYNC, 0666);
+ lock_fd = open (path, O_CREAT|O_RDWR|O_EXCL, 0666);
if (lock_fd == -1)
{
lock_fd = open (path, O_RDONLY);
- assert (lock_fd != -1);
+ if (lock_fd == -1)
+ {
+ if (errno == ENOENT)
+ continue;
+ logf (LOG_FATAL|LOG_ERRNO, "open %s", path);
+ exit (1);
+ }
if (zebraLockNB (lock_fd, 1) == -1)
{
if (errno == EWOULDBLOCK)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockutil.c,v $
- * Revision 1.2 1995-12-11 11:43:29 adam
+ * Revision 1.3 1995-12-12 16:00:57 adam
+ * System call sync(2) used after update/commit.
+ * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
+ * and F_RDLCK.
+ *
+ * Revision 1.2 1995/12/11 11:43:29 adam
* Locking based on fcntl instead of flock.
* Setting commitEnable removed. Command line option -n can be used to
* prevent commit if commit setting is defined in the configuration file.
int zebraLock (int fd, int wr)
{
+#if 1
+ return intLock (fd, wr ? F_EXLCK : F_SHLCK, F_SETLKW);
+#else
return intLock (fd, wr ? F_WRLCK : F_RDLCK, F_SETLKW);
+#endif
}
int zebraLockNB (int fd, int wr)
{
- return intLock (fd, wr ? F_WRLCK : F_RDLCK, F_SETLK);
+#if 1
+ return intLock (fd, wr ? F_EXLCK : F_SHLCK, F_SETLKW);
+#else
+ return intLock (fd, wr ? F_WRLCK : F_RDLCK, F_SETLKW);
+#endif
}
int zebraUnlock (int fd)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.29 1995-12-11 11:43:30 adam
+ * Revision 1.30 1995-12-12 16:00:59 adam
+ * System call sync(2) used after update/commit.
+ * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
+ * and F_RDLCK.
+ *
+ * Revision 1.29 1995/12/11 11:43:30 adam
* Locking based on fcntl instead of flock.
* Setting commitEnable removed. Command line option -n can be used to
* prevent commit if commit setting is defined in the configuration file.
" update <dir> Update index with files below <dir>.\n"
" If <dir> is empty filenames are read from stdin.\n"
" delete <dir> Delete index with files below <dir>.\n"
+ " commit Commit changes\n"
"Options:\n"
" -t <type> Index files as <type> (grs or text).\n"
" -c <config> Read configuration file <config>.\n"
zebraIndexWait (1);
logf (LOG_LOG, "Commit execute");
bf_commitExec ();
+ sync ();
zebraIndexLockMsg ("d");
zebraIndexWait (0);
logf (LOG_LOG, "Commit clean");
else if (!strcmp (arg, "stat") || !strcmp (arg, "status"))
{
zebraIndexLock (0);
- bf_cache (0);
- rec_prstat ();
- }
- else if (!strcmp (arg, "cstat") || !strcmp (arg, "cstatus"))
- {
- zebraIndexLock (1);
rval = res_get (common_resource, "commit");
if (rval && *rval)
{
logf (LOG_LOG, "Merging with index");
key_input (FNAME_WORD_DICT, FNAME_WORD_ISAM, nsections,
60);
+ sync ();
}
}
}