* Wrap housekeeper and timer events in transaction open/close functions
authorArt Cancro <ajc@citadel.org>
Thu, 7 Dec 2000 04:50:33 +0000 (04:50 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 7 Dec 2000 04:50:33 +0000 (04:50 +0000)
* Checkpoint the DB as an EVT_TIMER event instead of after each session
  (runs each minute, but actually limited by the parameters of the function)

citadel/ChangeLog
citadel/database_sleepycat.c
citadel/housekeeping.c
citadel/network/mail.sysinfo
citadel/sysdep.c

index b7271b7f2a8369bf29979812eef183f7fdd8a3d9..02609d1de09fa594d498ab0fe475e9bfea8669ec 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 573.40  2000/12/07 04:50:33  ajc
+ * Wrap housekeeper and timer events in transaction open/close functions
+ * Checkpoint the DB as an EVT_TIMER event instead of after each session
+   (runs each minute, but actually limited by the parameters of the function)
+
  Revision 573.39  2000/12/06 04:44:36  ajc
  * Changed netproc to keep the use table in a flat file instead of a database
 
@@ -2183,4 +2188,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 491c0d2d51dea6b34815b72df9f07b54d2b443d9..4c3a225dea42a91df73203fbe062c476d36cc24e 100644 (file)
@@ -154,9 +154,9 @@ void open_databases(void)
         * it.  Besides, it locks up when we do it that way.
          */
 #ifdef TRANSACTION_BASED
-        flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN;
+        flags = DB_CREATE|DB_RECOVER|DB_INIT_MPOOL|DB_PRIVATE|DB_INIT_TXN;
 #else
-        flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE;
+        flags = DB_CREATE|DB_RECOVER|DB_INIT_MPOOL|DB_PRIVATE;
 #endif
         ret = dbenv->open(dbenv, "./data", flags, 0);
        if (ret) {
@@ -197,7 +197,7 @@ void open_databases(void)
        cdb_allocate_ssd();
        CtdlRegisterSessionHook(cdb_allocate_ssd, EVT_START);
 #ifdef TRANSACTION_BASED
-       CtdlRegisterSessionHook(cdb_checkpoint, EVT_STOP);
+       CtdlRegisterSessionHook(cdb_checkpoint, EVT_TIMER);
 #endif
 }
 
index c9ffcfb9ee62d41cd5b25369e5b4dbb57a4204b1..aa380f12b8074ed61148a1b779b5e4900344db01 100644 (file)
@@ -29,6 +29,7 @@
 #include "housekeeping.h"
 #include "sysdep_decls.h"
 #include "room_ops.h"
+#include "database.h"
 
 
 int housepipe[2];      /* This is the queue for housekeeping tasks */
@@ -112,6 +113,7 @@ void housekeeping_loop(void) {
                        }
 
                        extract(cmd, house_cmd, 0);
+                       cdb_begin_transaction();
 
                        /* Do whatever this cmd requires */
 
@@ -130,6 +132,8 @@ void housekeeping_loop(void) {
                                lprintf(7, "Unknown housekeeping command\n");
                        }
 
+                       cdb_end_transaction();
+
                } while (did_something);
        }
 }
index 72b4ab71ddedbf079e962ef83555e01098b78243..1bce5d13af62d79910d1fa1795c99b0d169b667d 100644 (file)
@@ -22,7 +22,7 @@ lastcontact 975826743 Sun Dec  3 01:59:03 2000
 internet
 uum %s
 humannode Internet Gateway
-lastcontact 976081140 Wed Dec  6 00:39:00 2000
+lastcontact 976085942 Wed Dec  6 01:59:02 2000
 
 uncnsrd
 bin Mail
@@ -37,7 +37,7 @@ tesseract
 bin Mail
 phonenum US 800 555 1212
 humannode Tesseract Project
-lastcontact 976081158 Wed Dec  6 00:39:18 2000
+lastcontact 976085943 Wed Dec  6 01:59:03 2000
 
 pixel
 use uncnsrd
@@ -123,3 +123,8 @@ gdom bor system <catchat> to map
 humannode ISCA BBS
 lastcontact 975653967 Fri Dec  1 01:59:27 2000
 
+bin Mail
+bin Mail
+humannode Ô\91\ 4\bhðÿ¿lðÿ¿
+lastcontact 976082265 Wed Dec  6 00:57:45 2000
+
index 8a37d59339bd8021a41526565f5dd7083ecec0f4..23ef843700911978d09b5d13f5b04f844fed16ad 100644 (file)
@@ -1195,7 +1195,9 @@ SETUP_FD: memcpy(&readfds, &masterfds, sizeof masterfds);
                dead_session_purge();
                if ((time(NULL) - last_timer) > 60L) {
                        last_timer = time(NULL);
+                       cdb_begin_transaction();
                        PerformSessionHooks(EVT_TIMER);
+                       cdb_end_transaction();
                }
        }