Changeset: 5df54f939917 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5df54f939917 Modified Files: clients/Tests/exports.stable.out sql/backends/monet5/sql.c Branch: cleanup_types Log Message:
merged with default diffs (truncated from 1321 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -215,7 +215,7 @@ BBPrec *BBP[N_BBPINIT]; gdk_return BBPaddfarm(const char *dirname, uint32_t rolemask, bool logerror); void BBPcold(bat i); int BBPfix(bat b); -unsigned BBPheader(FILE *fp, int *lineno, bat *bbpsize, lng *logno, lng *transid, bool allow_hge_upgrade); +unsigned BBPheader(FILE *fp, int *lineno, bat *bbpsize, lng *logno, bool allow_hge_upgrade); bat BBPindex(const char *nme); gdk_return BBPjson_upgrade(json_storage_conversion); void BBPkeepref(BAT *b) __attribute__((__nonnull__(1))); @@ -227,7 +227,6 @@ int BBPrelease(bat b); int BBPrename(BAT *b, const char *nme); int BBPretain(bat b); gdk_return BBPsave(BAT *b); -gdk_return BBPsync(int cnt, bat *restrict subcommit, BUN *restrict sizes, lng logno, lng transid); void BBPtmlock(void); void BBPtmunlock(void); int BBPunfix(bat b); @@ -416,7 +415,7 @@ void STRMPdestroy(BAT *b); BAT *STRMPfilter(BAT *b, BAT *s, const char *q, const bool keep_nils); bool THRhighwater(void); gdk_return TMsubcommit(BAT *bl) __attribute__((__warn_unused_result__)); -gdk_return TMsubcommit_list(bat *restrict subcommit, BUN *restrict sizes, int cnt, lng logno, lng transid) __attribute__((__warn_unused_result__)); +gdk_return TMsubcommit_list(bat *restrict subcommit, BUN *restrict sizes, int cnt, lng logno) __attribute__((__warn_unused_result__)); void VALclear(ValPtr v); int VALcmp(const ValRecord *p, const ValRecord *q); void *VALconvert(int typ, ValPtr t); diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2188,7 +2188,7 @@ dump_table(Mapi mid, const char *schema, fprintf(stderr, "no tables matching %s.%s\n", schema, tname); goto doreturn; } - tables = malloc(rows * sizeof(struct tables)); + tables = malloc((size_t) rows * sizeof(struct tables)); if (tables == NULL) { mapi_close_handle(hdl); fprintf(stderr, "malloc failure\n"); @@ -3203,6 +3203,123 @@ dump_database(Mapi mid, stream *sqlf, co mapi_close_handle(hdl); hdl = NULL; + /* dump views, functions and triggers */ + if ((hdl = mapi_query(mid, views_functions_triggers)) == NULL || + mapi_error(mid)) + goto bailout; + + while (rc == 0 && + mnstr_errnr(sqlf) == MNSTR_NO__ERROR && + mapi_fetch_row(hdl) != 0) { + char *id = strdup(mapi_fetch_field(hdl, 0)); + char *schema = strdup(mapi_fetch_field(hdl, 1)); + char *name = strdup(mapi_fetch_field(hdl, 2)); + const char *query = mapi_fetch_field(hdl, 3); + const char *remark = mapi_fetch_field(hdl, 4); + + if (mapi_error(mid) || id == NULL || schema == NULL || name == NULL) { + free(id); + free(schema); + free(name); + goto bailout; + } + if (sname != NULL && strcmp(schema, sname) != 0) { + free(id); + free(schema); + free(name); + continue; + } + if (curschema == NULL || strcmp(schema, curschema) != 0) { + if (curschema) + free(curschema); + curschema = strdup(schema); + if (curschema == NULL) { + free(id); + free(schema); + free(name); + goto bailout; + } + mnstr_printf(sqlf, "SET SCHEMA "); + dquoted_print(sqlf, curschema, ";\n"); + } + if (query) { + /* view or trigger */ + mnstr_printf(sqlf, "%s\n", query); + /* only views have comments due to query */ + comment_on(sqlf, "VIEW", schema, name, NULL, remark); + } else { + /* procedure */ + dump_functions(mid, sqlf, 0, schema, name, id); + } + free(id); + free(schema); + free(name); + } + mapi_close_handle(hdl); + hdl = NULL; + + /* dump DEFAULT clauses for tables */ + if (dump_table_defaults(mid, NULL, NULL, sqlf)) + goto bailout2; + + if (!describe) { + if (dump_foreign_keys(mid, NULL, NULL, NULL, sqlf)) + goto bailout2; + + /* dump sequences, part 2 */ + if ((hdl = mapi_query(mid, sequences2)) == NULL || + mapi_error(mid)) + goto bailout; + + while (mapi_fetch_row(hdl) != 0) { + const char *schema = mapi_fetch_field(hdl, 0); /* sch */ + const char *name = mapi_fetch_field(hdl, 1); /* seq */ + const char *restart = mapi_fetch_field(hdl, 3); /* rs */ + const char *minvalue; + const char *maxvalue; + const char *increment = mapi_fetch_field(hdl, 6); /* inc */ + const char *cycle = mapi_fetch_field(hdl, 8); /* cycle */ + + if (mapi_get_field_count(hdl) > 9) { + /* new version (Jan2022) of sys.describe_sequences */ + minvalue = mapi_fetch_field(hdl, 11); /* rmi */ + maxvalue = mapi_fetch_field(hdl, 12); /* rma */ + } else { + /* old version (pre Jan2022) of sys.describe_sequences */ + minvalue = mapi_fetch_field(hdl, 4); /* minvalue */ + maxvalue = mapi_fetch_field(hdl, 5); /* maxvalue */ + if (strcmp(minvalue, "0") == 0) + minvalue = NULL; + if (strcmp(maxvalue, "0") == 0) + maxvalue = NULL; + } + + if (sname != NULL && strcmp(schema, sname) != 0) + continue; + + mnstr_printf(sqlf, + "ALTER SEQUENCE "); + dquoted_print(sqlf, schema, "."); + dquoted_print(sqlf, name, NULL); + mnstr_printf(sqlf, " RESTART WITH %s", restart); + if (strcmp(increment, "1") != 0) + mnstr_printf(sqlf, " INCREMENT BY %s", increment); + if (minvalue) + mnstr_printf(sqlf, " MINVALUE %s", minvalue); + if (maxvalue) + mnstr_printf(sqlf, " MAXVALUE %s", maxvalue); + mnstr_printf(sqlf, " %sCYCLE;\n", strcmp(cycle, "true") == 0 ? "" : "NO "); + if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR) { + mapi_close_handle(hdl); + hdl = NULL; + goto bailout2; + } + } + if (mapi_error(mid)) + goto bailout; + mapi_close_handle(hdl); + } + /* add tables to MERGE tables */ if ((hdl = mapi_query(mid, mergetables)) == NULL || mapi_error(mid)) goto bailout; @@ -3334,123 +3451,6 @@ dump_database(Mapi mid, stream *sqlf, co mapi_close_handle(hdl); hdl = NULL; - /* dump views, functions and triggers */ - if ((hdl = mapi_query(mid, views_functions_triggers)) == NULL || - mapi_error(mid)) - goto bailout; - - while (rc == 0 && - mnstr_errnr(sqlf) == MNSTR_NO__ERROR && - mapi_fetch_row(hdl) != 0) { - char *id = strdup(mapi_fetch_field(hdl, 0)); - char *schema = strdup(mapi_fetch_field(hdl, 1)); - char *name = strdup(mapi_fetch_field(hdl, 2)); - const char *query = mapi_fetch_field(hdl, 3); - const char *remark = mapi_fetch_field(hdl, 4); - - if (mapi_error(mid) || id == NULL || schema == NULL || name == NULL) { - free(id); - free(schema); - free(name); - goto bailout; - } - if (sname != NULL && strcmp(schema, sname) != 0) { - free(id); - free(schema); - free(name); - continue; - } - if (curschema == NULL || strcmp(schema, curschema) != 0) { - if (curschema) - free(curschema); - curschema = strdup(schema); - if (curschema == NULL) { - free(id); - free(schema); - free(name); - goto bailout; - } - mnstr_printf(sqlf, "SET SCHEMA "); - dquoted_print(sqlf, curschema, ";\n"); - } - if (query) { - /* view or trigger */ - mnstr_printf(sqlf, "%s\n", query); - /* only views have comments due to query */ - comment_on(sqlf, "VIEW", schema, name, NULL, remark); - } else { - /* procedure */ - dump_functions(mid, sqlf, 0, schema, name, id); - } - free(id); - free(schema); - free(name); - } - mapi_close_handle(hdl); - hdl = NULL; - - /* dump DEFAULT clauses for tables */ - if (dump_table_defaults(mid, NULL, NULL, sqlf)) - goto bailout2; - - if (!describe) { - if (dump_foreign_keys(mid, NULL, NULL, NULL, sqlf)) - goto bailout2; - - /* dump sequences, part 2 */ - if ((hdl = mapi_query(mid, sequences2)) == NULL || - mapi_error(mid)) - goto bailout; - - while (mapi_fetch_row(hdl) != 0) { - const char *schema = mapi_fetch_field(hdl, 0); /* sch */ - const char *name = mapi_fetch_field(hdl, 1); /* seq */ - const char *restart = mapi_fetch_field(hdl, 3); /* rs */ - const char *minvalue; - const char *maxvalue; - const char *increment = mapi_fetch_field(hdl, 6); /* inc */ - const char *cycle = mapi_fetch_field(hdl, 8); /* cycle */ - - if (mapi_get_field_count(hdl) > 9) { - /* new version (Jan2022) of sys.describe_sequences */ - minvalue = mapi_fetch_field(hdl, 11); /* rmi */ - maxvalue = mapi_fetch_field(hdl, 12); /* rma */ - } else { - /* old version (pre Jan2022) of sys.describe_sequences */ - minvalue = mapi_fetch_field(hdl, 4); /* minvalue */ - maxvalue = mapi_fetch_field(hdl, 5); /* maxvalue */ - if (strcmp(minvalue, "0") == 0) - minvalue = NULL; - if (strcmp(maxvalue, "0") == 0) - maxvalue = NULL; - } - - if (sname != NULL && strcmp(schema, sname) != 0) - continue; - - mnstr_printf(sqlf, - "ALTER SEQUENCE "); - dquoted_print(sqlf, schema, "."); - dquoted_print(sqlf, name, NULL); - mnstr_printf(sqlf, " RESTART WITH %s", restart); - if (strcmp(increment, "1") != 0) - mnstr_printf(sqlf, " INCREMENT BY %s", increment); - if (minvalue) - mnstr_printf(sqlf, " MINVALUE %s", minvalue); - if (maxvalue) - mnstr_printf(sqlf, " MAXVALUE %s", maxvalue); - mnstr_printf(sqlf, " %sCYCLE;\n", strcmp(cycle, "true") == 0 ? "" : "NO "); - if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR) { - mapi_close_handle(hdl); - hdl = NULL; - goto bailout2; - } - } - if (mapi_error(mid)) - goto bailout; - mapi_close_handle(hdl); - } - if ((hdl = mapi_query(mid, table_grants)) == NULL || mapi_error(mid)) goto bailout; diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Tue Feb 6 2024 Sjoerd Mullender <sjo...@acm.org> +- The SQL transaction ID is no longer saved in the BBP.dir file. + * Wed Jan 3 2024 Sjoerd Mullender <sjo...@acm.org> _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org