Do not use sync(2) after commit. The fsync on individual files suffices.
[idzebra-moved-to-github.git] / index / zebraapi.c
index 84c8e7a..f54589b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.226 2006-08-29 08:27:59 adam Exp $
+/* $Id: zebraapi.c,v 1.229 2006-09-29 07:05:44 adam Exp $
    Copyright (C) 1995-2006
    Index Data ApS
 
@@ -1177,10 +1177,10 @@ ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
            return ZEBRA_FAIL;
        }
     }
-    res = rpn_scan (zh, stream, zapt, attributeset,
-                   zh->num_basenames, zh->basenames, position,
-                   num_entries, entries, is_partial, limit_rset, 0);
-    zebra_end_read (zh);
+    res = rpn_scan(zh, stream, zapt, attributeset,
+                   zh->num_basenames, zh->basenames, position,
+                   num_entries, entries, is_partial, limit_rset);
+    zebra_end_read(zh);
     return res;
 }
 
@@ -1485,12 +1485,20 @@ ZEBRA_RES zebra_drop_database(ZebraHandle zh, const char *db)
     if (zh->reg->isamb)
     {
        int db_ord;
-       zebraExplain_curDatabase (zh->reg->zei, db);
-       db_ord = zebraExplain_get_database_ord(zh->reg->zei);
-       dict_delete_subtree_ord(zh->reg->matchDict, db_ord,
-                               0 /* handle */, 0 /* func */);
-       zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
-       zebraExplain_removeDatabase(zh->reg->zei, zh);
+       if (zebraExplain_curDatabase (zh->reg->zei, db))
+        {
+            zebra_setError(zh, YAZ_BIB1_DATABASE_DOES_NOT_EXIST, db);
+            ret = ZEBRA_FAIL;
+        }
+        else
+        {
+            db_ord = zebraExplain_get_database_ord(zh->reg->zei);
+            dict_delete_subtree_ord(zh->reg->matchDict, db_ord,
+                                    0 /* handle */, 0 /* func */);
+            zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
+            zebraExplain_removeDatabase(zh->reg->zei, zh);
+            zebra_remove_file_match(zh);
+        }
     }
     else
     {
@@ -2019,9 +2027,6 @@ static ZEBRA_RES zebra_commit_ex(ZebraHandle zh, int clean_only)
             
             yaz_log (YLOG_DEBUG, "commit start");
             bf_commitExec (bfs);
-#ifndef WIN32
-            sync ();
-#endif
         }
         seqno++;
         zebra_set_state (zh, 'o', seqno);