Changeset: 804427e295f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=804427e295f6
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_upgrades.c
Branch: default
Log Message:
Merge with Nov2019
diffs (206 lines):
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -565,9 +565,11 @@ SQLinit(Client c)
} else if (maybeupgrade) {
if ((msg = SQLtrans(m)) == MAL_SUCCEED) {
SQLupgrades(c,m);
- /* sometimes the upgrade ends in a COMMIT,
- * sometimes not */
- if (m->session->tr->active)
+ /* Commit at the end of the upgrade */
+ assert(m->session->tr->active);
+ if (mvc_status(m) < 0)
+ msg = mvc_rollback(m, 0, NULL, false);
+ else
msg = mvc_commit(m, 0, NULL, false);
}
}
diff --git a/sql/backends/monet5/sql_upgrades.c
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -248,7 +248,6 @@ sql_update_hugeint(Client c, mvc *sql, c
"update sys.functions set system = true where name =
'filter' and schema_id = (select id from sys.schemas where name = 'json');\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -297,7 +296,6 @@ sql_update_geom(Client c, mvc *sql, int
}
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -411,7 +409,6 @@ sql_update_jul2017(Client c, const char
res_tables_destroy(output);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -456,7 +453,6 @@ sql_update_jul2017_sp2(Client c)
"GRANT EXECUTE ON FUNCTION sys.environment() TO
PUBLIC;\n"
"GRANT SELECT ON sys.environment TO PUBLIC;\n"
);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
err = SQLstatementIntern(c, &buf, "update", true,
false, NULL);
@@ -508,7 +504,6 @@ sql_update_jul2017_sp3(Client c, mvc *sq
"create trigger system_update_schemas after update on
sys.schemas for each statement call sys_update_schemas();\n"
"create trigger system_update_tables after update on
sys._tables for each statement call sys_update_tables();\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
err = SQLstatementIntern(c, &buf, "update", true, false, NULL);
@@ -545,7 +540,6 @@ sql_update_mar2018_geom(Client c, sql_ta
"update sys._tables set system = true where name =
'geometry_columns' and schema_id in (select id from schemas where name =
'sys');\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1014,7 +1008,6 @@ sql_update_mar2018(Client c, mvc *sql, c
);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1025,7 +1018,6 @@ sql_update_mar2018(Client c, mvc *sql, c
"ALTER TABLE sys.function_types SET READ ONLY;\n"
"ALTER TABLE sys.function_languages SET READ
ONLY;\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
err = SQLstatementIntern(c, &buf, "update", true, false, NULL);
@@ -1057,7 +1049,6 @@ sql_update_mar2018_netcdf(Client c, cons
"grant execute on procedure
sys.netcdf_importvar(integer, varchar(256)) to public;\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1133,7 +1124,6 @@ sql_update_mar2018_samtools(Client c, mv
"GRANT EXECUTE ON PROCEDURE bam.bam_export(STRING) TO
PUBLIC;\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1160,7 +1150,6 @@ sql_update_mar2018_sp1(Client c, const c
"update sys.functions set system = true where name in
('dependencies_functions_on_triggers') and schema_id = (select id from
sys.schemas where name = 'sys');\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1189,7 +1178,6 @@ sql_update_remote_tables(Client c, mvc *
"update sys.functions set system = true where name =
'remote_table_credentials' and schema_id = (select id from sys.schemas where
name = 'sys');\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1312,7 +1300,6 @@ sql_replace_Mar2018_ids_view(Client c, m
);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1334,7 +1321,6 @@ sql_update_gsl(Client c, const char *pre
"drop function sys.chi2prob(double, double);\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1361,7 +1347,6 @@ sql_update_aug2018(Client c, mvc *sql, c
"update sys.functions set system = true where name in
('group_concat') and schema_id = (select id from sys.schemas where name =
'sys');\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1403,7 +1388,6 @@ sql_update_aug2018_sp2(Client c, const c
"update sys.functions set side_effect =
true where language <> 0 and not side_effect and type <> 4 and (type = 2 or
(language <> 2 and id not in (select func_id from sys.args where inout =
1)));\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1447,7 +1431,6 @@ sql_drop_functions_dependencies_Xs_on_Ys
"DROP FUNCTION dependencies_keys_on_foreignKeys();\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1533,7 +1516,6 @@ sql_update_apr2019(Client c, mvc *sql, c
"update sys._columns set type_digits = 1048576 where
name = 'query' and table_id in (select id from sys._tables t where t.name =
'tables' and t.schema_id in (select id from sys.schemas s where s.name =
'sys'));\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -1543,7 +1525,6 @@ sql_update_apr2019(Client c, mvc *sql, c
"ALTER TABLE sys.keywords SET READ ONLY;\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
err = SQLstatementIntern(c, &buf, "update", true, false, NULL);
@@ -1860,7 +1841,6 @@ sql_update_storagemodel(Client c, mvc *s
" and name in ('columnsize', 'heapsize', 'hashsize',
'imprintsize') and type = %d;\n", (int) F_FUNC);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -2273,7 +2253,6 @@ sql_update_nov2019(Client c, mvc *sql, c
" and name in ('master', 'stop', 'accept', 'replicate',
'beat') and type = %d;\n", (int) F_PROC);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
@@ -2354,7 +2333,7 @@ sql_update_default(Client c, mvc *sql, c
" and name = 'sessions';\n");
pos += snprintf(buf + pos, bufsize - pos,
"update sys.functions set system = true where schema_id
= (select id from sys.schemas where name = 'sys')"
- " and name in ('settimeout', 'querytimeout',
'sessiontimeout', 'stopsession') and type = %d;\n", (int) F_PROC);
+ " and name in ('querytimeout', 'sessiontimeout',
'stopsession') and type = %d;\n", (int) F_PROC);
/* 26_sysmon */
t = mvc_bind_table(sql, sys, "queue");
@@ -2388,7 +2367,6 @@ sql_update_default(Client c, mvc *sql, c
" and name = 'queue';\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n",
prev_schema);
- pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
assert(pos < bufsize);
printf("Running database upgrade commands:\n%s\n", buf);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list