]> code.citadel.org Git - citadel.git/commitdiff
Removed ctdl3264 experiment.
authorArt Cancro <ajc@citadel.org>
Sat, 25 Feb 2023 17:19:08 +0000 (12:19 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 25 Feb 2023 17:19:08 +0000 (12:19 -0500)
Dammit.  How did I get this far before realizing that there is no point in
doing this.  The message base may be free of any packed binary data, but it
is INDEXED by a packed long integer.  This means we'd have to rewrite the
entire thing anyway, and at that point there isn't any time savings over
just doing a ctdlmigrate.

So I am abandoning this effort and I'm just going to have to take my
system offline for an entire weekend to do the migration to 64-bit.  It is
long overdue.

citadel/Makefile
citadel/utils/ctdl3264.c [deleted file]
citadel/utils/ctdl3264_prep.sh [deleted file]

index cf3fe1a82c404fe887734b5d388f5a0f96c2716e..c89f92cc0aa6d115a38e8ffef2d8962b5edd6228 100644 (file)
@@ -11,7 +11,7 @@
 # config.mk is generated by ./configure
 include config.mk
 
-all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd ctdl3264
+all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd
 all: $(all)
 
 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
@@ -38,12 +38,6 @@ chkpw: utils/chkpw.c utils/*.h server/*.h
 chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
        cc ${CFLAGS} ${LDFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
 
-ctdl3264: utils/ctdl3264.c utils/*.h server/*.h utils/ctdl3264_structs.h
-       cc ${CFLAGS} ${LDFLAGS} utils/ctdl3264.c -lcitadel -lz -ldb -o ctdl3264
-
-utils/ctdl3264_structs.h: server/server.h utils/ctdl3264_prep.sh
-       utils/ctdl3264_prep.sh
-
 config.mk: configure
        ./configure
 
diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c
deleted file mode 100644 (file)
index 39c1f55..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-// Attempt to convert your database from 32-bit to 64-bit.
-// Don't run this.  It doesn't work and if you try to run it you will immediately die.
-//
-// Copyright (c) 2023 by the citadel.org team
-//
-// This program is open source software.  Use, duplication, or disclosure
-// is subject to the terms of the GNU General Public License, version 3.
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <libcitadel.h>
-#include <zlib.h>
-#include <db.h>
-#include "../server/sysdep.h"
-#include "../server/citadel_defs.h"
-#include "../server/server.h"
-#include "../server/citadel_dirs.h"
-#include "ctdl3264_structs.h"
-
-static DB *dbp[MAXCDB];                // One DB handle for each Citadel database
-static DB_ENV *dbenv;          // The DB environment (global)
-
-// Open the various databases we'll be using.  Any database which
-// does not exist should be created.  Note that we don't need a
-// critical section here, because there aren't any active threads
-// manipulating the database yet.
-void open_databases(void) {
-       int ret;
-       int i;
-       char dbfilename[32];
-       u_int32_t flags = 0;
-       int dbversion_major, dbversion_minor, dbversion_patch;
-
-       printf( "db: open_databases() starting\n"
-               "db:    Linked zlib: %s\n"
-               "db: Compiled libdb: %s\n"
-               "db:   Linked libdb: %s\n",
-               zlibVersion(),
-               DB_VERSION_STRING,
-               db_version(&dbversion_major, &dbversion_minor, &dbversion_patch)
-       );
-
-       // Create synthetic integer version numbers and compare them.
-       // Never allow citserver to run with a libdb older then the one with which it was compiled.
-       int compiled_db_version = ( (DB_VERSION_MAJOR * 1000000) + (DB_VERSION_MINOR * 1000) + (DB_VERSION_PATCH) );
-       int linked_db_version = ( (dbversion_major * 1000000) + (dbversion_minor * 1000) + (dbversion_patch) );
-       if (compiled_db_version > linked_db_version) {
-               printf( "db: citserver is running with a version of libdb older than the one with which it was compiled.\n"
-                       "db: This is an invalid configuration.  citserver will now exit to prevent data loss.");
-               exit(CTDLEXIT_DB);
-       }
-
-       printf("db: Setting up DB environment\n");
-       ret = db_env_create(&dbenv, 0);
-       if (ret) {
-               printf("db: db_env_create: %s\n", db_strerror(ret));
-               printf("db: exit code %d\n", ret);
-               exit(CTDLEXIT_DB);
-       }
-
-       // We want to specify the shared memory buffer pool cachesize, but everything else is the default.
-       ret = dbenv->set_cachesize(dbenv, 0, 64 * 1024, 0);
-       if (ret) {
-               printf("db: set_cachesize: %s\n", db_strerror(ret));
-               dbenv->close(dbenv, 0);
-               printf("db: exit code %d\n", ret);
-               exit(CTDLEXIT_DB);
-       }
-
-       if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT))) {
-               printf("db: set_lk_detect: %s\n", db_strerror(ret));
-               dbenv->close(dbenv, 0);
-               printf("db: exit code %d\n", ret);
-               exit(CTDLEXIT_DB);
-       }
-
-       flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN | DB_INIT_LOCK | DB_THREAD | DB_INIT_LOG;
-       printf("db: dbenv->open(dbenv, %s, %d, 0)\n", ctdl_db_dir, flags);
-       ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0);                                // try opening the database cleanly
-       if (ret == DB_RUNRECOVERY) {
-               printf("db: dbenv->open: %s\n", db_strerror(ret));
-               printf("db: attempting recovery...\n");
-               flags |= DB_RECOVER;
-               ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0);                        // try recovery
-       }
-       if (ret == DB_RUNRECOVERY) {
-               printf("db: dbenv->open: %s\n", db_strerror(ret));
-               printf("db: attempting catastrophic recovery...\n");
-               flags &= ~DB_RECOVER;
-               flags |= DB_RECOVER_FATAL;
-               ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0);                        // try catastrophic recovery
-       }
-       if (ret) {
-               printf("db: dbenv->open: %s\n", db_strerror(ret));
-               dbenv->close(dbenv, 0);
-               printf("db: exit code %d\n", ret);
-               exit(CTDLEXIT_DB);
-       }
-
-       for (i = 0; i < MAXCDB; ++i) {
-               printf("db: mounting database %d\n", i);
-               ret = db_create(&dbp[i], dbenv, 0);                                     // Create a database handle
-               if (ret) {
-                       printf("db: db_create: %s\n", db_strerror(ret));
-                       printf("db: exit code %d\n", ret);
-                       exit(CTDLEXIT_DB);
-               }
-
-               snprintf(dbfilename, sizeof dbfilename, "cdb.%02x", i);                 // table names by number
-               ret = dbp[i]->open(dbp[i], NULL, dbfilename, NULL, DB_BTREE, DB_AUTO_COMMIT, 0600);
-               if (ret) {
-                       printf("db: db_open[%02x]: %s\n", i, db_strerror(ret));
-                       if (ret == ENOMEM) {
-                               printf("db: You may need to tune your database; please check http://www.citadel.org for more information.\n");
-                       }
-                       printf("db: exit code %d\n", ret);
-                       exit(CTDLEXIT_DB);
-               }
-       }
-}
-
-
-// Close all of the db database files we've opened.  This can be done in a loop, since it's just a bunch of closes.
-void close_databases(void) {
-       int i;
-       int ret;
-
-       //syslog(LOG_INFO, "db: performing final checkpoint");
-       //if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
-               //syslog(LOG_ERR, "db: txn_checkpoint: %s", db_strerror(ret));
-       //}
-
-       printf("db: flushing the database logs\n");
-       if ((ret = dbenv->log_flush(dbenv, NULL))) {
-               printf("db: log_flush: %s\n", db_strerror(ret));
-       }
-
-       // close the tables
-       printf("db: closing databases\n");
-       for (i = 0; i < MAXCDB; ++i) {
-               printf("db: closing database %02x\n", i);
-               ret = dbp[i]->close(dbp[i], 0);
-               if (ret) {
-                       printf("db: db_close: %s\n", db_strerror(ret));
-               }
-
-       }
-
-       // Close the handle.
-       ret = dbenv->close(dbenv, 0);
-       if (ret) {
-               printf("db: DBENV->close: %s\n", db_strerror(ret));
-       }
-}
-
-int main(int argc, char **argv) {
-       char ctdldir[PATH_MAX]=CTDLDIR;
-
-       // Check to make sure we're running on the target 64-bit system
-       if (sizeof(void *) != 8) {
-               fprintf(stderr, "%s: this is a %ld-bit system.\n", argv[0], sizeof(void *)*8);
-               fprintf(stderr, "%s: you must run this on a 64-bit system, onto which a 32-bit database has been copied.\n", argv[0]);
-               exit(1);
-       }
-
-       // Parse command line
-       int a;
-       while ((a = getopt(argc, argv, "h:")) != EOF) {
-               switch (a) {
-               case 'h':
-                       strncpy(ctdldir, optarg, sizeof ctdldir);
-                       break;
-               default:
-                       fprintf(stderr, "%s: usage: %s [-h server_dir]\n", argv[0], argv[0]);
-                       exit(2);
-               }
-       }
-
-       open_databases();
-       close_databases();
-
-       exit(0);
-}
diff --git a/citadel/utils/ctdl3264_prep.sh b/citadel/utils/ctdl3264_prep.sh
deleted file mode 100755 (executable)
index 9a2ac20..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2023 by the citadel.org team
-# This program is open source software.  Use, duplication, or disclosure
-# is subject to the terms of the GNU General Public License, version 3.
-
-# Source our data structures from the real live working code
-SERVER_H=server/server.h
-
-# Generate the "32-bit" versions of these structures.
-# Note that this is specifically converting "32-bit to 64-bit" -- NOT "any-to-any"
-convert_struct() {
-       start_line=$(cat ${SERVER_H} | egrep -n "^struct $1 {" | cut -d: -f1)
-       tail +${start_line} ${SERVER_H} | sed '/};/q' \
-       | sed s/"^struct $1 {"/"struct ${1}_32 {"/g \
-       | sed s/"long "/"int32_t "/g \
-       | sed s/"time_t "/"int32_t "/g \
-       | sed s/"struct ExpirePolicy "/"struct ExpirePolicy_32 "/g
-       echo ''
-
-}
-
-# Here we go.  Let's make this thing happen.
-(
-
-       echo '// This file was automatically generated by ctdl3264_prep.sh'
-       echo '// Attempting to modify it would be an exercise in futility.'
-       echo ''
-
-       convert_struct "ctdluser"
-       convert_struct "ExpirePolicy"
-       convert_struct "ctdlroom"
-       convert_struct "floor"
-       convert_struct "visit"
-
-) >utils/ctdl3264_structs.h