Changeset: 888d92856caa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=888d92856caa
Branch: mtest
Log Message:

merge with default


diffs (truncated from 500 to 300 lines):

diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -220,6 +220,7 @@ typedef PVOID volatile ATOMIC_PTR_TYPE;
 #define ATOMIC_PTR_GET(var)            (*(var))
 #define ATOMIC_PTR_SET(var, val)       _InterlockedExchangePointer(var, 
(PVOID) (val))
 #define ATOMIC_PTR_XCG(var, val)       _InterlockedExchangePointer(var, 
(PVOID) (val))
+#pragma intrinsic(_InterlockedCompareExchangePointer)
 static inline bool
 ATOMIC_PTR_CAS(ATOMIC_PTR_TYPE *var, void **exp, void *des)
 {
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -320,8 +320,6 @@ static void wininit_##n(void)                               
                \
 __declspec(allocate(".CRT$XCU")) void (*wininit_##n##_)(void) = wininit_##n; \
 __pragma(comment(linker, "/include:" _LOCK_PREF_ "wininit_" #n "_"))
 
-#pragma intrinsic(_InterlockedCompareExchangePointer)
-
 #define MT_lock_init(l, n)                                     \
        do {                                                    \
                InitializeCriticalSection(&(l)->lock);          \
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -262,7 +262,7 @@ runtimeProfileInit(Client cntxt, MalBlkP
        QRYqueue[qhead].mb = mb;
        QRYqueue[qhead].tag = qtag++;
        QRYqueue[qhead].stk = stk;                              // for status 
pause 'p'/running '0'/ quiting 'q'
-       QRYqueue[qhead].finished =
+       QRYqueue[qhead].finished = 0;
        QRYqueue[qhead].start = time(0);
        q = isaSQLquery(mb);
        QRYqueue[qhead].query = q? GDKstrdup(q):0;
diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c
--- a/monetdb5/modules/mal/sysmon.c
+++ b/monetdb5/modules/mal/sysmon.c
@@ -82,10 +82,14 @@ SYSMONstatistics(Client cntxt, MalBlkPtr
                                goto bailout;
                        }
 
-                       tsn = timestamp_fromtime(USRstats[i].finished);
-                       if (is_timestamp_nil(tsn)) {
-                               msg = createException(MAL, "SYSMONstatistics", 
SQLSTATE(22003) "failed to convert finish time");
-                               goto bailout;
+                       if (USRstats[i].finished == 0) {
+                               tsn = timestamp_nil;
+                       } else {
+                               tsn = timestamp_fromtime(USRstats[i].finished);
+                               if (is_timestamp_nil(tsn)) {
+                                       msg = createException(MAL, 
"SYSMONstatistics", SQLSTATE(22003) "failed to convert finish time");
+                                       goto bailout;
+                               }
                        }
                        if (BUNappend(finished, &tsn, false) != GDK_SUCCEED){
                                msg = createException(MAL, "SYSMONstatistics", 
"Failed to append 'finished'");
@@ -218,10 +222,14 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, 
                        if (BUNappend(started, &tsn, false) != GDK_SUCCEED)
                                goto bailout;
 
-                       tsn = timestamp_fromtime(QRYqueue[i].finished);
-                       if (is_timestamp_nil(tsn)) {
-                               msg = createException(MAL, "SYSMONqueue", 
SQLSTATE(22003) "cannot convert time");
-                               goto bailout;
+                       if (QRYqueue[i].finished == 0) {
+                               tsn = timestamp_nil;
+                       } else {
+                               tsn = timestamp_fromtime(QRYqueue[i].finished);
+                               if (is_timestamp_nil(tsn)) {
+                                       msg = createException(MAL, 
"SYSMONqueue", SQLSTATE(22003) "cannot convert time");
+                                       goto bailout;
+                               }
                        }
                        if (BUNappend(finished, &tsn, false) != GDK_SUCCEED)
                                goto bailout;
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -1611,7 +1611,7 @@ str
 mvc_append_column(sql_trans *t, sql_column *c, BAT *ins)
 {
        int res = store_funcs.append_col(t, c, ins, TYPE_bat);
-       if (res != 0)
+       if (res != LOG_OK)
                throw(SQL, "sql.append", SQLSTATE(42000) "Cannot append 
values");
        return MAL_SUCCEED;
 }
@@ -1667,7 +1667,7 @@ mvc_append_wrap(Client cntxt, MalBlkPtr 
        const char *tname = *getArgReference_str(stk, pci, 3);
        const char *cname = *getArgReference_str(stk, pci, 4);
        ptr ins = getArgReference(stk, pci, 5);
-       int tpe = getArgType(mb, pci, 5);
+       int tpe = getArgType(mb, pci, 5), err = 0;
        sql_schema *s;
        sql_table *t;
        sql_column *c;
@@ -1702,12 +1702,15 @@ mvc_append_wrap(Client cntxt, MalBlkPtr 
        if( b && BATcount(b) > 4096 && !b->batTransient)
                BATmsync(b);
        if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
-               store_funcs.append_col(m->session->tr, c, ins, tpe);
+               if (store_funcs.append_col(m->session->tr, c, ins, tpe) != 
LOG_OK)
+                       err = 1;
        } else if (cname[0] == '%') {
                sql_idx *i = mvc_bind_idx(m, s, cname + 1);
-               if (i)
-                       store_funcs.append_idx(m->session->tr, i, ins, tpe);
-       }
+               if (i && store_funcs.append_idx(m->session->tr, i, ins, tpe) != 
LOG_OK)
+                       err = 1;
+       }
+       if (err)
+               throw(SQL, "sql.append", SQLSTATE(42S02) "append failed");
        if (b) {
                BBPunfix(b->batCacheid);
        }
@@ -1727,7 +1730,7 @@ mvc_update_wrap(Client cntxt, MalBlkPtr 
        bat Tids = *getArgReference_bat(stk, pci, 5);
        bat Upd = *getArgReference_bat(stk, pci, 6);
        BAT *tids, *upd;
-       int tpe = getArgType(mb, pci, 6);
+       int tpe = getArgType(mb, pci, 6), err = 0;
        sql_schema *s;
        sql_table *t;
        sql_column *c;
@@ -1769,14 +1772,17 @@ mvc_update_wrap(Client cntxt, MalBlkPtr 
        if( tids && BATcount(tids) > 4096 && !tids->batTransient)
                BATmsync(tids);
        if (cname[0] != '%' && (c = mvc_bind_column(m, t, cname)) != NULL) {
-               store_funcs.update_col(m->session->tr, c, tids, upd, TYPE_bat);
+               if (store_funcs.update_col(m->session->tr, c, tids, upd, 
TYPE_bat) != LOG_OK)
+                       err = 1;
        } else if (cname[0] == '%') {
                sql_idx *i = mvc_bind_idx(m, s, cname + 1);
-               if (i)
-                       store_funcs.update_idx(m->session->tr, i, tids, upd, 
TYPE_bat);
+               if (i && store_funcs.update_idx(m->session->tr, i, tids, upd, 
TYPE_bat) != LOG_OK)
+                       err = 1;
        }
        BBPunfix(tids->batCacheid);
        BBPunfix(upd->batCacheid);
+       if (err)
+               throw(SQL, "sql.update", SQLSTATE(42S02) "update failed");
        return MAL_SUCCEED;
 }
 
@@ -1803,6 +1809,8 @@ mvc_clear_table_wrap(Client cntxt, MalBl
        if (t == NULL)
                throw(SQL, "sql.clear_table", SQLSTATE(42S02) "Table missing 
%s.%s", sname,tname);
        *res = mvc_clear_table(m, t);
+       if (*res == BUN_NONE)
+               throw(SQL, "sql.clear_table", SQLSTATE(42S02) "clear failed");
        return MAL_SUCCEED;
 }
 
@@ -1850,7 +1858,8 @@ mvc_delete_wrap(Client cntxt, MalBlkPtr 
        }
        if( b && BATcount(b) > 4096 && !b->batTransient)
                BATmsync(b);
-       store_funcs.delete_tab(m->session->tr, t, b, tpe);
+       if (store_funcs.delete_tab(m->session->tr, t, b, tpe) != LOG_OK)
+               throw(SQL, "sql.delete", SQLSTATE(3F000) "delete failed");
        if (b)
                BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
@@ -4075,7 +4084,7 @@ vacuum(Client cntxt, MalBlkPtr mb, MalSt
        bat bid;
        BAT *b, *del;
        node *o;
-       int i, bids[2049];
+       int i, bids[2049], err = 0;
 
        if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
                return msg;
@@ -4140,17 +4149,21 @@ vacuum(Client cntxt, MalBlkPtr mb, MalSt
        }
        BBPunfix(del->batCacheid);
 
-       mvc_clear_table(m, t);
+       if (mvc_clear_table(m, t) == BUN_NONE)
+               throw(SQL, name, SQLSTATE(42000) "vacumm: clear failed");
        for (o = t->columns.set->h, i = 0; o; o = o->next, i++) {
                sql_column *c = o->data;
                BAT *ins = BATdescriptor(bids[i]);      /* use the insert bat */
 
                if( ins){
-                       store_funcs.append_col(tr, c, ins, TYPE_bat);
+                       if (store_funcs.append_col(tr, c, ins, TYPE_bat) != 
LOG_OK)
+                               err = 1;
                        BBPunfix(ins->batCacheid);
                }
                BBPrelease(bids[i]);
        }
+       if (err)
+               throw(SQL, name, SQLSTATE(42000) "vacuum: reappend failed");
        /* TODO indices */
        return MAL_SUCCEED;
 }
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -701,7 +701,7 @@ SQLengineIntern(Client c, backend *be)
                msg = SQLrun(c,m);
 
 cleanup_engine:
-       if (m->type == Q_SCHEMA && m->qc != NULL)
+       if (m->emode != m_prepare && m->type == Q_SCHEMA && m->qc != NULL)
                qc_clean(m->qc);
        if (msg) {
                /* don't print exception decoration, just the message */
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
@@ -798,6 +798,8 @@ SQLreader(Client c)
                        go = msg == MAL_SUCCEED;
                        commit_done = true;
                }
+               if (m->session->tr && m->session->tr->active)
+                       c->idle = 0;
 
                if (go && in->pos >= in->len) {
                        ssize_t rd;
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out 
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
--- a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
@@ -14,7 +14,7 @@ stdout of test 'ValidateSystemCatalogTab
 Checking     45 tables/keys  in schema sys for Primary Key uniqueness 
violations.
 Checking     45 columns      in schema sys for Primary Key Not Null violations.
 Checking     30 tables/keys  in schema sys for Unique Constraint violations.
-Checking     96 foreign keys in schema sys for Foreign Key referential 
integrity violations.
+Checking     95 foreign keys in schema sys for Foreign Key referential 
integrity violations.
 Checking    169 columns      in schema sys for Not Null violations.
 Checking    153 columns      in schema sys for Max Character Length violations.
 Checking      6 tables/keys  in schema tmp for Primary Key uniqueness 
violations.
diff --git 
a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out.Windows 
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out.Windows
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out.Windows
@@ -0,0 +1,45 @@
+stdout of test 'ValidateSystemCatalogTables` in directory 'sql/jdbc/tests` 
itself:
+
+
+# 16:25:09 >  
+# 16:25:09 >  "./ValidateSystemCatalogTables.SQL.sh" 
"ValidateSystemCatalogTables"
+# 16:25:09 >  
+
+
+# 16:25:09 >  
+# 16:25:09 >  java nl.cwi.monetdb.client.JdbcClient -h localhost -p 34154 -d 
mTests_sql_jdbc_tests -e -f 
/home/dinther/dev/dev/MonetDB/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
+# 16:25:09 >  
+
+\vsci
+Checking     45 tables/keys  in schema sys for Primary Key uniqueness 
violations.
+Checking     45 columns      in schema sys for Primary Key Not Null violations.
+Checking     30 tables/keys  in schema sys for Unique Constraint violations.
+Checking     95 foreign keys in schema sys for Foreign Key referential 
integrity violations.
+Checking    169 columns      in schema sys for Not Null violations.
+Checking    145 columns      in schema sys for Max Character Length violations.
+Checking      6 tables/keys  in schema tmp for Primary Key uniqueness 
violations.
+Checking      6 columns      in schema tmp for Primary Key Not Null violations.
+Checking      7 tables/keys  in schema tmp for Unique Constraint violations.
+Checking     13 foreign keys in schema tmp for Foreign Key referential 
integrity violations.
+Checking     35 columns      in schema tmp for Not Null violations.
+Checking     14 columns      in schema tmp for Max Character Length violations.
+\vsi sys
+Checking     10 keys         in schema sys for Primary Key uniqueness 
violations.
+Checking      7 keys         in schema sys for Unique Constraint violations.
+Checking      0 foreign keys in schema sys for Foreign Key referential 
integrity violations.
+Checking     29 columns      in schema sys for Not Null violations.
+Checking    145 columns      in schema sys for Max Character Length violations.
+\vsi tmp
+Checking      0 keys         in schema tmp for Primary Key uniqueness 
violations.
+Checking      0 keys         in schema tmp for Unique Constraint violations.
+Checking      0 foreign keys in schema tmp for Foreign Key referential 
integrity violations.
+Checking      0 columns      in schema tmp for Not Null violations.
+Checking     14 columns      in schema tmp for Max Character Length violations.
+\vdbi
+No user schemas found in this database.
+
+
+# 16:25:12 >  
+# 16:25:12 >  "Done."
+# 16:25:12 >  
+
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2024,7 +2024,7 @@ static BUN
 clear_col(sql_trans *tr, sql_column *c)
 {
        if (bind_col_data(tr, c) == LOG_ERR)
-               return 0;
+               return BUN_NONE;
        c->t->s->base.wtime = c->t->base.wtime = c->base.wtime = tr->wstime;
        if (c->data)
                return clear_delta(tr, c->data);
@@ -2037,7 +2037,7 @@ clear_idx(sql_trans *tr, sql_idx *i)
        if (!isTable(i->t) || (hash_index(i->type) && list_length(i->columns) 
<= 1) || !idx_has_column(i->type))
                return 0;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to