* Made the transaction open/close a global thing, in a frantic attempt to get
authorArt Cancro <ajc@citadel.org>
Tue, 12 Dec 2000 04:20:03 +0000 (04:20 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 12 Dec 2000 04:20:03 +0000 (04:20 +0000)
  Uncensored to stop crashing.  More fixes on the way...

citadel/ChangeLog
citadel/citserver.c
citadel/database_sleepycat.c
citadel/serv_vandelay.c
citadel/sysdep.c

index 43342a3e98640afd2e6a4ea07f3c6a9de277ae93..52d3d74128478fda023b2316c20250d83b4385de 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 573.48  2000/12/12 04:20:03  ajc
+ * Made the transaction open/close a global thing, in a frantic attempt to get
+   Uncensored to stop crashing.  More fixes on the way...
+
  Revision 573.47  2000/12/11 06:08:41  ajc
  * Removed the housekeeper thread, moved terminate_idle_sessions() out to a
    timer event, and check_sched_shutdown() to the end of the worker thread
@@ -2212,4 +2216,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 3c7f6cc297edcf54902d1825092b94acd62150d0..1882aa8937aeb9355b96163a2b12ea8e63e51297 100644 (file)
@@ -56,13 +56,12 @@ void master_startup(void) {
        
        lprintf(7, "Opening databases\n");
        open_databases();
+       cdb_begin_transaction();
 
        if (do_defrag) {
                defrag_databases();
        }
 
-       cdb_begin_transaction();
-
        check_ref_counts();
 
        lprintf(7, "Creating base rooms (if necessary)\n");
@@ -74,10 +73,10 @@ void master_startup(void) {
        lprintf(7, "Seeding the pseudo-random number generator...\n");
        gettimeofday(&tv, NULL);
        srand(tv.tv_usec);
-
-       cdb_end_transaction();
 }
 
+
+
 /*
  * Cleanup routine to be called when the server is shutting down.
  */
@@ -95,10 +94,11 @@ void master_cleanup(void) {
        /* Run any cleanup routines registered by loadable modules */
        for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
                (*fcn->h_function_pointer)();
-               }
+       }
 
        /* Close databases */
        lprintf(7, "Closing databases\n");
+       cdb_end_transaction();
        close_databases();
 
        /* Do system-dependent stuff */
index 10be08d7891f5cd3bc91a2e1fe6ada71769fe9a3..8d67f9b68cb6d7aa7274dbeaf3f2f7471af0a356 100644 (file)
@@ -50,7 +50,8 @@ struct cdbssd {                       /* Session-specific DB stuff */
 struct cdbssd *ssd_arr = NULL;
 int num_ssd = 0;
 #define MYCURSOR       ssd_arr[CC->cs_pid].cursor
-#define MYTID          ssd_arr[CC->cs_pid].tid
+/* #define MYTID               ssd_arr[CC->cs_pid].tid */
+DB_TXN *MYTID;
 
 /*
  * Ensure that we have enough space for session-specific data.  We don't
index ce1ca76da2e4033a89d67f6b1832bdf6f6c1f772..58af5f115cc3f35510134b86fb432e95d5f97bc8 100644 (file)
@@ -515,17 +515,6 @@ void artv_do_import(void) {
                else if (!strcasecmp(buf, "message")) artv_import_message();
                else break;
 
-               /* Yes, this is correct: end *then* begin.  Since we're in a
-                * session command loop, there's already a transaction in
-                * progress.  We want to end it and then begin a new one at the
-                * end of every object import, otherwise the entire import
-                * logs as a single transaction.  Not only would that be a bad
-                * idea, but it'll actually crash the db when importing very
-                * large files.
-                */
-               cdb_end_transaction();
-               cdb_begin_transaction();
-
        }
        lprintf(7, "Invalid keyword <%s>.  Flushing input.\n", buf);
        while (client_gets(buf), strcmp(buf, "000"))  ;;
index e592b1415395bf3c76ed9a52ce337f6569f70f1f..338b30091da8cebf9dcb4e81f4faf6f51d9bef40 100644 (file)
@@ -953,13 +953,11 @@ int main(int argc, char **argv)
         * Load any server-side modules (plugins) available here.
         */
        lprintf(7, "Initializing loadable modules\n");
-       cdb_begin_transaction();
        if ((moddir = malloc(strlen(bbs_home_directory) + 9)) != NULL) {
                sprintf(moddir, "%s/modules", bbs_home_directory);
                DLoader_Init(moddir);
                free(moddir);
        }
-       cdb_end_transaction();
 
        /*
         * The rescan pipe exists so that worker threads can be woken up and
@@ -1049,7 +1047,6 @@ void worker_thread(void) {
 
        while (!time_to_die) {
 
-               cdb_begin_transaction();
 
                /* 
                 * A naive implementation would have all idle threads
@@ -1062,6 +1059,8 @@ void worker_thread(void) {
                 */
 
                begin_critical_section(S_I_WANNA_SELECT);
+               cdb_end_transaction();
+               cdb_begin_transaction();
 SETUP_FD:      memcpy(&readfds, &masterfds, sizeof masterfds);
                highest = masterhighest;
                begin_critical_section(S_SESSION_TABLE);
@@ -1193,7 +1192,6 @@ SETUP_FD: memcpy(&readfds, &masterfds, sizeof masterfds);
 
                check_sched_shutdown();
 
-               cdb_end_transaction();
        }
 
        /* If control reaches this point, the server is shutting down */