add total to purged use table records
authorArt Cancro <ajc@citadel.org>
Wed, 15 Feb 2023 00:11:03 +0000 (19:11 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 15 Feb 2023 00:11:03 +0000 (19:11 -0500)
why is this table so big?

citadel/server/modules/expire/serv_expire.c
citadel/utils/ctdl3264.c
citadel/utils/ctdl3264_prep.sh

index 396932213405b691bfdce1adb176e7a91018e676..7e9ff4e01bef223cf7f168e8abee5bd2ff47d092 100644 (file)
@@ -593,6 +593,7 @@ int PurgeVisits(void) {
 // Purge the use table of old entries.
 int PurgeUseTable(StrBuf *ErrMsg) {
        int purged = 0;
+       int total = 0;
        struct cdbdata *cdbut;
        struct UseTable ut;
        struct UPurgeList *ul = NULL;
@@ -603,6 +604,7 @@ int PurgeUseTable(StrBuf *ErrMsg) {
        syslog(LOG_DEBUG, "Purge use table: phase 1");
        cdb_rewind(CDB_USETABLE);
        while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
+               ++total;
                if (cdbut->len > sizeof(struct UseTable))
                        memcpy(&ut, cdbut->ptr, sizeof(struct UseTable));
                else {
@@ -632,7 +634,7 @@ int PurgeUseTable(StrBuf *ErrMsg) {
                ul = uptr;
        }
 
-       syslog(LOG_DEBUG, "Purge use table: finished (purged %d records)", purged);
+       syslog(LOG_DEBUG, "Purge use table: finished (purged %d of %d records)", purged, total);
        return(purged);
 }
 
index 0baa2e23e251010bbaf727bd816de79c70af5b21..b863e5ec539287bca383e8989edccda486f29083 100644 (file)
 
 
 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
+       while ((int a = getopt(argc, argv, "h:w:")) != EOF) {
+               switch (a) {
+               case 'h':
+                       strncpy(ctdldir, optarg, sizeof ctdldir);
+                       break;
+               case 'w':
+                       watchdog = atoi(optarg);
+                       break;
+               default:
+                       fprintf(stderr, "%s: usage: %s [-h server_dir]\n", argv[0], argv[0]);
+                       exit(2);
+               }
+       }
 
        exit(0);
 }
index 960ade31edf7f0c43106699a3b7ce2b0573a8fcf..9a2ac207240c7fbbd31dd81ec900ab0f182c359d 100755 (executable)
@@ -12,9 +12,7 @@ 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/"int "/"int32_t "/g \
        | sed s/"long "/"int32_t "/g \
-       | sed s/"unsigned "/"uint32_t "/g \
        | sed s/"time_t "/"int32_t "/g \
        | sed s/"struct ExpirePolicy "/"struct ExpirePolicy_32 "/g
        echo ''