Changeset: 96f969c4d7fb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=96f969c4d7fb
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:
Add upgrade code for log_flushing functions.
diffs (truncated from 439 to 300 lines):
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
@@ -2001,6 +2001,36 @@ sql_update_nov2019(Client c, mvc *sql, c
return err; /* usually MAL_SUCCEED */
}
+static str
+sql_update_default(Client c, mvc *sql, const char *prev_schema)
+{
+ size_t bufsize = 1024, pos = 0;
+ char *err = NULL, *buf = GDKmalloc(bufsize);
+
+ (void) sql;
+
+ if (buf == NULL)
+ throw(SQL, "sql_update_default", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+
+ pos += snprintf(buf + pos, bufsize - pos,
+ "set schema \"sys\";\n"
+ "create procedure suspend_log_flushing()\n"
+ " external name sql.suspend_log_flushing;\n"
+ "create procedure resume_log_flushing()\n"
+ " external name sql.resume_log_flushing;\n"
+ "update sys.functions set system = true where schema_id
= (select id from sys.schemas where name = 'sys')"
+ " and name in ('suspend_log_flushing',
'resume_log_flushing') 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);
+ err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
+ GDKfree(buf);
+ return err; /* usually MAL_SUCCEED */
+}
+
void
SQLupgrades(Client c, mvc *m)
{
@@ -2229,5 +2259,12 @@ SQLupgrades(Client c, mvc *m)
}
}
+ if (!sql_bind_func(m->sa, s, "suspend_log_flushing", NULL, NULL,
F_PROC)) {
+ if ((err = sql_update_default(c, m, prev_schema)) != NULL) {
+ fprintf(stderr, "!%s\n", err);
+ freeException(err);
+ }
+ }
+
GDKfree(prev_schema);
}
diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -5971,6 +5971,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 15:17:55 >
diff --git
a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
---
a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
+++
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
@@ -5971,6 +5971,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 15:17:55 >
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
@@ -5175,6 +5175,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 15:55:37 >
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
@@ -5175,6 +5175,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 16:02:52 >
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -6010,6 +6010,17 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
+# MonetDB/SQL module loaded
# 16:53:35 >
# 16:53:35 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-30908" "--port=39660"
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
@@ -5175,6 +5175,17 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
+# MonetDB/SQL module loaded
# 15:55:37 >
# 15:55:37 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-12365" "--port=35877"
diff --git
a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
@@ -6010,6 +6010,17 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
+# MonetDB/SQL module loaded
# 15:43:25 >
# 15:43:25 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5725" "--port=37647"
diff --git a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -5971,6 +5971,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 15:17:04 >
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
@@ -5175,6 +5175,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 21:10:45 >
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
@@ -5175,6 +5175,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 16:02:52 >
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
@@ -6010,6 +6010,17 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
+# MonetDB/SQL module loaded
# 18:26:24 >
# 18:26:24 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-20759" "--port=37815"
diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -5971,6 +5971,16 @@ update sys.functions set system = true w
set schema "sys";
commit;
+Running database upgrade commands:
+set schema "sys";
+create procedure suspend_log_flushing()
+ external name sql.suspend_log_flushing;
+create procedure resume_log_flushing()
+ external name sql.resume_log_flushing;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name in ('suspend_log_flushing',
'resume_log_flushing') and type = 2;
+set schema "sys";
+commit;
+
# MonetDB/SQL module loaded
# 16:02:38 >
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list