Go back to exporting dir and usersbynumber records.
authorArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:13:18 +0000 (06:13 -0900)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:13:18 +0000 (06:13 -0900)
We will also be exporting fulltext, euidindex, etc records.
Re-generating them on the target server after import is just way too time consuming.

citadel/utils/ctdldump.c

index b5a6085d80bf358988209617db382011ce646056..03b3f46099a25c3360c5e158f04c00a0845bae13 100644 (file)
@@ -279,12 +279,11 @@ void export_visit(int which_cdb, DBT *in_key, DBT *in_data) {
 
 
 // export function for a directory record
-// (This is a secondary index -- should we just regenerate the data after import?)
-// void export_dir(int which_cdb, DBT *in_key, DBT *in_data) {
-       // printf("dir|");
-       // fwrite(in_key->data, in_key->size, 1, stdout);
-       // printf("|%s|\n", (char *)in_data->data);
-// }
+void export_dir(int which_cdb, DBT *in_key, DBT *in_data) {
+       printf("dir|");
+       fwrite(in_key->data, in_key->size, 1, stdout);
+       printf("|%s|\n", (char *)in_data->data);
+}
 
 
 // export function for a use table record
@@ -327,15 +326,15 @@ void export_bigmsg(int which_cdb, DBT *in_key, DBT *in_data) {
 
 // export users-by-number records
 // (This is a secondary index -- should we just regenerate the data after import?)
-//void export_usersbynumber(int which_cdb, DBT *in_key, DBT *in_data) {
+void export_usersbynumber(int which_cdb, DBT *in_key, DBT *in_data) {
 
        // key is a long
-       //long usernum;
-       //memcpy(&usernum, in_key->data, sizeof(usernum));
+       long usernum;
+       memcpy(&usernum, in_key->data, sizeof(usernum));
 
        // value is a string
-       //printf("usersbynumber|%ld|%s|\n", usernum, (char *)in_data->data);
-//}
+       printf("usersbynumber|%ld|%s|\n", usernum, (char *)in_data->data);
+}
 
 
 // export function for a config record
@@ -362,12 +361,12 @@ void (*export_functions[])(int which_cdb, DBT *in_key, DBT *in_data) = {
        export_floor,           // CDB_FLOORTAB
        export_msglist,         // CDB_MSGLISTS
        export_visit,           // CDB_VISIT
-       zero_function,          // CDB_DIRECTORY (regenerate this on the server)
+       export_dir,             // CDB_DIRECTORY
        export_usetable,        // CDB_USETABLE
        export_bigmsg,          // CDB_BIGMSGS
-       zero_function,          // CDB_FULLTEXT (regenerate this on the server)
-       zero_function,          // CDB_EUIDINDEX (regenerate this on the server)
-       zero_function,          // CDB_USERSBYNUMBER (regenerate this on the server)
+       zero_function,          // CDB_FULLTEXT
+       zero_function,          // CDB_EUIDINDEX
+       export_usersbynumber,   // CDB_USERSBYNUMBER
        zero_function,          // CDB_UNUSED1 (obsolete)
        export_config           // CDB_CONFIG
 };
@@ -512,10 +511,6 @@ int main(int argc, char **argv) {
        printf("begin|\n");
        for (i = 0; i < MAXCDB; ++i) {
                export_table(i, src_dbenv);
-               if (i == CDB_CONFIG) {
-                       printf("config|regenerate_secondary_indices|1|\n");             // Force citserver to rebuild those tables
-                       printf("config|MM_fulltext_wordbreaker|0|\n");                  // Burn the full text search index
-               }
        }
        close_dbenv(src_dbenv);
        printf("end|\n");