MonetDB: balanced_union - Fixes errors in join_push_down_munion ...
Changeset: f9b374a7c095 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f9b374a7c095 Modified Files: sql/server/rel_optimize_proj.c Branch: balanced_union Log Message: Fixes errors in join_push_down_munion implementation diffs (35 lines): diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c --- a/sql/server/rel_optimize_proj.c +++ b/sql/server/rel_optimize_proj.c @@ -3779,10 +3779,10 @@ rel_push_join_down_munion(visitor *v, sq sql_rel *rp = rel_dup(m->data); if (!is_project(rp->op)) rp = rel_project(v->sql->sa, rp, rel_projections(v->sql, rp, NULL, 1, 1)); - rel_rename_exps(v->sql, l->exps, rp->exps); - if (l != ol) { + rel_rename_exps(v->sql, r->exps, rp->exps); + if (r != or) { rp = rel_project(v->sql->sa, rp, NULL); - rp->exps = exps_copy(v->sql, ol->exps); + rp->exps = exps_copy(v->sql, or->exps); set_processed(rp); } /* combine them */ @@ -3805,13 +3805,13 @@ rel_push_join_down_munion(visitor *v, sq sql_rel *pc = rel_dup(n->data); if (!is_project(pc->op)) pc = rel_project(v->sql->sa, pc, rel_projections(v->sql, pc, NULL, 1, 1)); - rel_rename_exps(v->sql, l->exps, pc->exps); - if (l != ol) { + rel_rename_exps(v->sql, r->exps, pc->exps); + if (r != or) { pc = rel_project(v->sql->sa, pc, NULL); - pc->exps = exps_copy(v->sql, ol->exps); + pc->exps = exps_copy(v->sql, or->exps); set_processed(pc); } - pc = rel_crossproduct(v->sql->sa, pc, rel_dup(ol), rel->op); + pc = rel_crossproduct(v->sql->sa, rel_dup(ol), pc, rel->op); pc->exps = exps_copy(v->sql, exps); pc->attr = exps_copy(v->sql, attr); set_processed(pc); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Dec2023 - Don't duplicate entries in sql_dcatalog.
Changeset: 912c89178a17 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/912c89178a17 Modified Files: gdk/gdk_logger.c Branch: Dec2023 Log Message: Don't duplicate entries in sql_dcatalog. diffs (13 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -1803,7 +1803,8 @@ bm_subcommit(logger *lg, logged_range *p cleanup++; if (lids[p] == -1) continue; - if (BUNappend(dcatalog, &(oid){p}, true) != GDK_SUCCEED) { + if (BUNfnd(dcatalog, &(oid){p}) == BUN_NONE && + BUNappend(dcatalog, &(oid){p}, true) != GDK_SUCCEED) { while (BATcount(dcatalog) > dcnt) { if (BUNdelete(dcatalog, BATcount(dcatalog) - 1) != GDK_SUCCEED) { TRC_CRITICAL(WAL, "delete after failed append failed\n"); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - Rename re_* functions to avoid conflicts with...
Changeset: e69d10afeee7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e69d10afeee7 Modified Files: monetdb5/modules/mal/pcre.c Branch: default Log Message: Rename re_* functions to avoid conflicts with regex.h. diffs (truncated from 309 to 300 lines): diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c --- a/monetdb5/modules/mal/pcre.c +++ b/monetdb5/modules/mal/pcre.c @@ -63,7 +63,7 @@ struct RE { * byte and don't deal with multibyte encodings (such as UTF-8). */ static inline bool -re_is_pattern_properly_escaped(const char *pat, unsigned char esc) +mnre_is_pattern_properly_escaped(const char *pat, unsigned char esc) { bool escaped = false; @@ -94,7 +94,7 @@ is_strcmpable(const char *pat, const cha /* Match regular expression by comparing bytes. */ static inline bool -re_match(const char *restrict s, const struct RE *restrict pattern) +mnre_match(const char *restrict s, const struct RE *restrict pattern) { const struct RE *r; @@ -142,14 +142,14 @@ re_match(const char *restrict s, const s * we need to backtrack, so use recursion; here we know we * have the %, look for an _ in the rest of the pattern * (note %_ and _% are equivalent and is taken care of by -* the pattern construction in re_create) */ +* the pattern construction in mnre_create) */ for (const struct RE *p = r->n; p; p = p->n) { if (p->skip != 0) { struct RE pat = *r; pat.search = false; pat.skip = 0; do { - if (re_match(s, &pat)) + if (mnre_match(s, &pat)) return true; do s++; @@ -213,7 +213,7 @@ re_match(const char *restrict s, const s } static void -re_destroy(struct RE *p) +mnre_destroy(struct RE *p) { if (p) { GDKfree(p->k); @@ -235,7 +235,7 @@ re_destroy(struct RE *p) * the first. */ static struct RE * -re_create(const char *pat, bool caseignore, uint32_t esc) +mnre_create(const char *pat, bool caseignore, uint32_t esc) { struct RE *r = GDKmalloc(sizeof(struct RE)), *n = r; bool escaped = false; @@ -312,7 +312,7 @@ re_create(const char *pat, bool caseigno *q = 0; return r; bailout: - re_destroy(r); + mnre_destroy(r); return NULL; } @@ -1131,7 +1131,7 @@ choose_like_path(bool *use_re, bool *use if (strNil(pat) || strNil(esc)) { *empty = true; } else { - if (!re_is_pattern_properly_escaped(pat, (unsigned char) *esc)) + if (!mnre_is_pattern_properly_escaped(pat, (unsigned char) *esc)) throw(MAL, "pcre.sql2pcre", SQLSTATE(22019) ILLEGAL_ARGUMENT ": (I)LIKE pattern must not end with escape character"); @@ -1169,16 +1169,16 @@ PCRElike_imp(bit *ret, const char *const *ret = *isens ? GDKstrcasecmp(*s, *pat) == 0 : strcmp(*s, *pat) == 0; } else { - if (!(re = re_create(*pat, *isens, (unsigned char) **esc))) + if (!(re = mnre_create(*pat, *isens, (unsigned char) **esc))) res = createException(MAL, "pcre.like4", SQLSTATE(HY013) MAL_MALLOC_FAIL); else - *ret = re_match(*s, re); + *ret = mnre_match(*s, re); } } if (re) - re_destroy(re); + mnre_destroy(re); return res; } @@ -1202,11 +1202,11 @@ PCREnotlike(bit *ret, const char *const } static inline str -re_like_build(struct RE **re, const char *pat, bool caseignore, +mnre_like_build(struct RE **re, const char *pat, bool caseignore, bool use_strcmp, uint32_t esc) { if (!use_strcmp) { - if (!(*re = re_create(pat, caseignore, esc))) + if (!(*re = mnre_create(pat, caseignore, esc))) return createException(MAL, "pcre.re_like_build", SQLSTATE(HY013) MAL_MALLOC_FAIL); } @@ -1214,7 +1214,7 @@ re_like_build(struct RE **re, const char } static inline bit -re_like_proj_apply(const char *s, const struct RE *restrict re, +mnre_like_proj_apply(const char *s, const struct RE *
MonetDB: check - merge with default
Changeset: 2e2b4a44301c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2e2b4a44301c Branch: check Log Message: merge with default diffs (truncated from 309 to 300 lines): diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c --- a/monetdb5/modules/mal/pcre.c +++ b/monetdb5/modules/mal/pcre.c @@ -63,7 +63,7 @@ struct RE { * byte and don't deal with multibyte encodings (such as UTF-8). */ static inline bool -re_is_pattern_properly_escaped(const char *pat, unsigned char esc) +mnre_is_pattern_properly_escaped(const char *pat, unsigned char esc) { bool escaped = false; @@ -94,7 +94,7 @@ is_strcmpable(const char *pat, const cha /* Match regular expression by comparing bytes. */ static inline bool -re_match(const char *restrict s, const struct RE *restrict pattern) +mnre_match(const char *restrict s, const struct RE *restrict pattern) { const struct RE *r; @@ -142,14 +142,14 @@ re_match(const char *restrict s, const s * we need to backtrack, so use recursion; here we know we * have the %, look for an _ in the rest of the pattern * (note %_ and _% are equivalent and is taken care of by -* the pattern construction in re_create) */ +* the pattern construction in mnre_create) */ for (const struct RE *p = r->n; p; p = p->n) { if (p->skip != 0) { struct RE pat = *r; pat.search = false; pat.skip = 0; do { - if (re_match(s, &pat)) + if (mnre_match(s, &pat)) return true; do s++; @@ -213,7 +213,7 @@ re_match(const char *restrict s, const s } static void -re_destroy(struct RE *p) +mnre_destroy(struct RE *p) { if (p) { GDKfree(p->k); @@ -235,7 +235,7 @@ re_destroy(struct RE *p) * the first. */ static struct RE * -re_create(const char *pat, bool caseignore, uint32_t esc) +mnre_create(const char *pat, bool caseignore, uint32_t esc) { struct RE *r = GDKmalloc(sizeof(struct RE)), *n = r; bool escaped = false; @@ -312,7 +312,7 @@ re_create(const char *pat, bool caseigno *q = 0; return r; bailout: - re_destroy(r); + mnre_destroy(r); return NULL; } @@ -1131,7 +1131,7 @@ choose_like_path(bool *use_re, bool *use if (strNil(pat) || strNil(esc)) { *empty = true; } else { - if (!re_is_pattern_properly_escaped(pat, (unsigned char) *esc)) + if (!mnre_is_pattern_properly_escaped(pat, (unsigned char) *esc)) throw(MAL, "pcre.sql2pcre", SQLSTATE(22019) ILLEGAL_ARGUMENT ": (I)LIKE pattern must not end with escape character"); @@ -1169,16 +1169,16 @@ PCRElike_imp(bit *ret, const char *const *ret = *isens ? GDKstrcasecmp(*s, *pat) == 0 : strcmp(*s, *pat) == 0; } else { - if (!(re = re_create(*pat, *isens, (unsigned char) **esc))) + if (!(re = mnre_create(*pat, *isens, (unsigned char) **esc))) res = createException(MAL, "pcre.like4", SQLSTATE(HY013) MAL_MALLOC_FAIL); else - *ret = re_match(*s, re); + *ret = mnre_match(*s, re); } } if (re) - re_destroy(re); + mnre_destroy(re); return res; } @@ -1202,11 +1202,11 @@ PCREnotlike(bit *ret, const char *const } static inline str -re_like_build(struct RE **re, const char *pat, bool caseignore, +mnre_like_build(struct RE **re, const char *pat, bool caseignore, bool use_strcmp, uint32_t esc) { if (!use_strcmp) { - if (!(*re = re_create(pat, caseignore, esc))) + if (!(*re = mnre_create(pat, caseignore, esc))) return createException(MAL, "pcre.re_like_build", SQLSTATE(HY013) MAL_MALLOC_FAIL); } @@ -1214,7 +1214,7 @@ re_like_build(struct RE **re, const char } static inline bit -re_like_proj_apply(const char *s, const struct RE *restrict re, +mnre_like_proj_apply(const char *s, const struct RE *restrict re, const char *pat,
MonetDB: check - add new catalog version
Changeset: f2f8f97a8e28 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f2f8f97a8e28 Modified Files: sql/storage/bat/bat_logger.c sql/storage/store.c Branch: check Log Message: add new catalog version diffs (25 lines): diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c --- a/sql/storage/bat/bat_logger.c +++ b/sql/storage/bat/bat_logger.c @@ -24,6 +24,7 @@ #define CATALOG_JUL2021 52300 /* first in Jul2021 */ #define CATALOG_JAN2022 52301 /* first in Jan2022 */ #define CATALOG_SEP2022 52302 /* first in Sep2022 */ +#define CATALOG_FIRST_AFTER_DEC2023 52303 /* first after Dec2023 */ /* Note, CATALOG version 52300 is the first one where the basic system * tables (the ones created in store.c) have fixed and unchangeable diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -22,8 +22,8 @@ #include "bat/bat_table.h" #include "bat/bat_logger.h" -/* version 05.23.02 of catalog */ -#define CATALOG_VERSION 52303 /* first after Dec2023 */ +/* version 05.23.03 of catalog */ +#define CATALOG_VERSION 52304 /* second after Dec2023 */ ulng store_function_counter(sqlstore *store) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - bat_logger upgrade code: add _columns.check column
Changeset: 401c9bf21e6d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/401c9bf21e6d Modified Files: sql/storage/bat/bat_logger.c Branch: check Log Message: bat_logger upgrade code: add _columns.check column diffs (69 lines): diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c --- a/sql/storage/bat/bat_logger.c +++ b/sql/storage/bat/bat_logger.c @@ -93,6 +93,14 @@ bl_preversion(sqlstore *store, int oldve } #endif +#ifdef CATALOG_FIRST_AFTER_DEC2023 + if (oldversion == CATALOG_FIRST_AFTER_DEC2023) { + /* upgrade to default releases */ + store->catalog_version = oldversion; + return GDK_SUCCEED; + } +#endif + return GDK_FAIL; } @@ -3240,6 +3248,50 @@ bl_postversion(void *Store, void *Lg) } #endif + +#ifdef CATALOG_FIRST_AFTER_DEC2023 + if (store->catalog_version <= CATALOG_FIRST_AFTER_DEC2023) { + /* new STRING column sys.keys.check */ + BAT *b = log_temp_descriptor(log_find_bat(lg, 2088)); /* sys.keys.id */ + if (b == NULL) + return GDK_FAIL; + BAT *check = BATconstant(b->hseqbase, TYPE_str, ATOMnilptr(TYPE_str), BATcount(b), PERSISTENT); + bat_destroy(b); + if (check == NULL) + return GDK_FAIL; + if ((check = BATsetaccess(check, BAT_READ)) == NULL || + /* 2165 is sys.keys.check */ + BUNappend(lg->catalog_id, &(int) {2165}, true) != GDK_SUCCEED || + BUNappend(lg->catalog_bid, &check->batCacheid, true) != GDK_SUCCEED || + BUNappend(lg->catalog_lid, &lng_nil, false) != GDK_SUCCEED || + BUNappend(lg->catalog_cnt, &(lng){BATcount(check)}, false) != GDK_SUCCEED + ) { + bat_destroy(check); + return GDK_FAIL; + } + BBPretain(check->batCacheid); + bat_destroy(check); + + if (tabins(lg, old_lg, tabins_first, -1, 0, + 2076, &(msk) {false},/* sys._columns */ + /* 2165 is sys.keys.check */ + 2077, &(int) {2165}, /* sys._columns.id */ + 2078, "check", /* sys._columns.name */ + 2079, "varchar", /* sys._columns.type */ + 2080, &(int) {2048}, /* sys._columns.type_digits */ + 2081, &(int) {0},/* sys._columns.type_scale */ + /* 2016 is sys.functions */ + 2082, &(int) {2016}, /* sys._columns.table_id */ + 2083, str_nil, /* sys._columns.default */ + 2084, &(bit) {TRUE}, /* sys._columns.null */ + 2085, &(int) {6},/* sys._columns.number */ + 2086, str_nil, /* sys._columns.storage */ + 0) != GDK_SUCCEED) + return GDK_FAIL; + tabins_first = false; + } +#endif + return GDK_SUCCEED; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Dec2023 - Refuse to start if geom incompatibility found...
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
MonetDB: default - Merge with Dec2023 branch.
Changeset: 2495e1dbce95 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2495e1dbce95 Modified Files: gdk/gdk_logger.c tools/mserver/mserver5.c Branch: default Log Message: Merge with Dec2023 branch. diffs (92 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) { @@ -1049,9 +1050,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; } @@ -1802,7 +1811,8 @@ bm_subcommit(logger *lg, logged_range *p cleanup++; if (lids[p] == -1) continue; - if (BUNappend(dcatalog, &(oid){p}, true) != GDK_SUCCEED) { + if (BUNfnd(dcatalog, &(oid){p}) == BUN_NONE && + BUNappend(dcatalog, &(oid){p}, true) != GDK_SUCCEED) { while (BATcount(dcatalog) > dcnt) { if (BUNdelete(dcatalog, BATcount(dcatalog) - 1) != GDK_SUCCEED) { TRC_CRITICAL(WAL, "delete after failed append failed\n"); 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