Changeset: dc84e23b5b1b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dc84e23b5b1b
Modified Files:
        gdk/gdk_logger.c
        tools/mserver/mserver5.1.in
        tools/mserver/mserver5.c
Branch: Dec2023
Log Message:

Refuse to start if geom incompatibility found + option to start anyway.
If server has geom, but database was created without, refuse to start
up.  But add option --without-geom to start up without geom support.
The other way round, database was created with geom, but server does not
support it already gave an error.
This fixes #7518.


diffs (82 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1038,6 +1038,7 @@ log_read_types_file(logger *lg, FILE *fp
 {
        int id = 0;
        char atom_name[IDLENGTH];
+       bool seen_geom = false;
 
        /* scanf should use IDLENGTH somehow */
        while (fscanf(fp, "%d,%63s\n", &id, atom_name) == 2) {
@@ -1047,9 +1048,17 @@ log_read_types_file(logger *lg, FILE *fp
                        GDKerror("unknown type in log file '%s'\n", atom_name);
                        return GDK_FAIL;
                }
+               seen_geom |= strcmp(atom_name, "mbr") == 0 || strcmp(atom_name, 
"wkb") == 0;
                lg->type_id[i] = (int8_t) id;
                lg->type_nr[id < 0 ? 256 + id : id] = i;
        }
+#ifdef HAVE_GEOM
+       if (!seen_geom && ATOMindex("mbr") > 0) {
+               GDKerror("incompatible database: server supports GEOM, but 
database does not\n");
+               return GDK_FAIL;
+       }
+#endif
+       (void) seen_geom;
        return GDK_SUCCEED;
 }
 
diff --git a/tools/mserver/mserver5.1.in b/tools/mserver/mserver5.1.in
--- a/tools/mserver/mserver5.1.in
+++ b/tools/mserver/mserver5.1.in
@@ -121,6 +121,18 @@ Load extra module in the form of a dynam
 file) which should be located in the lib/monetdb5 directory.
 This option can be repeated for different modules.
 .TP
+.B \-\-without\-geom
+Start the server without 
+.I geom
+support, even if it is available.
+Normally the server will refuse to start if
+.I geom
+is loaded, but the
+database was created by a server without
+.I geom
+support.
+With this option it is possible to start the server anyway.
+.TP
 .B \-\-help
 Print list of options.
 .TP
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -342,6 +342,7 @@ main(int argc, char **av)
 
                {"read-password-initialize-and-exit", no_argument, NULL, 0},
                {"loadmodule", required_argument, NULL, 0},
+               {"without-geom", no_argument, NULL, 0},
 
                {NULL, 0, NULL, 0}
        };
@@ -526,6 +527,19 @@ main(int argc, char **av)
                                                        "ERROR: maximum number 
of modules reached\n");
                                break;
                        }
+                       if (strcmp(long_options[option_index].name, 
"without-geom") == 0) {
+                               for (int i = 0; i < mods; i++) {
+                                       if (strcmp(modules[i], "geom") == 0) {
+                                               while (i + 1 < mods) {
+                                                       modules[i] = modules[i 
+ 1];
+                                                       i++;
+                                               }
+                                               mods--;
+                                               break;
+                                       }
+                               }
+                               break;
+                       }
                        usage(prog, -1);
                        /* not reached */
                case 'c':
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to