Changeset: e038b4f1dd2b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e038b4f1dd2b
Modified Files:
        gdk/gdk.h
        monetdb5/mal/mal_factory.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_interpreter.c
        sql/server/sql_mvc.c
        sql/test/leaks/Tests/check1.stable.out
        sql/test/leaks/Tests/check1.stable.out.int128
        sql/test/leaks/Tests/check2.stable.out
        sql/test/leaks/Tests/check2.stable.out.int128
        sql/test/leaks/Tests/check3.stable.out
        sql/test/leaks/Tests/check3.stable.out.int128
        sql/test/leaks/Tests/check4.stable.out
        sql/test/leaks/Tests/check4.stable.out.int128
        sql/test/leaks/Tests/check5.stable.out
        sql/test/leaks/Tests/check5.stable.out.int128
Branch: default
Log Message:

Merge with Jun2016 branch.


diffs (truncated from 345 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1293,7 +1293,6 @@ gdk_export bte ATOMelmshift(int sz);
 #define Treplacevalue(b, p, v)         HTreplacevalue(b, p, v, T)
 #define HTfastins_nocheck(b, p, v, s, HT)                      \
        do {                                                    \
-               assert((b)->HT->width == (s));                  \
                (b)->HT->heap.free += (s);                      \
                (b)->HT->heap.dirty |= (s) != 0;                \
                HTputvalue((b), HT##loc((b), (p)), (v), 0, HT); \
diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -382,13 +382,12 @@ void mal_factory_reset(void)
                        /* MSresetVariables(mb, pl->stk, 0);*/
                        /* freeStack(pl->stk); there may be a reference?*/
                        /* we are inside the body of the factory and about to 
return */
-                       pl->factory = 0;
-                       if (pl->stk)
+                       if (pl->stk) {
                                pl->stk->keepAlive = FALSE;
-                       if ( pl->stk) {
-                               //garbageCollector(cntxt, mb, pl->stk,TRUE);
+                               garbageCollector(NULL, pl->factory, 
pl->stk,TRUE);
                                GDKfree(pl->stk);
                        }
+                       pl->factory = 0;
                        pl->stk=0;
                        pl->pc = 0;
                        pl->inuse = 0;
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -724,11 +724,13 @@ str runMALsequence(Client cntxt, MalBlkP
                                        nstk->up = stk;
                                        if (nstk->calldepth > 256) {
                                                ret= createException(MAL, 
"mal.interpreter", MAL_CALLDEPTH_FAIL);
+                                               GDKfree(nstk);
                                                break;
                                        }
                                        if ((unsigned)nstk->stkdepth > 
THREAD_STACK_SIZE / sizeof(mb->var[0]) / 4 && THRhighwater()){
                                                /* we are running low on stack 
space */
                                                ret= createException(MAL, 
"mal.interpreter", MAL_STACK_FAIL);
+                                               GDKfree(nstk);
                                                break;
                                        }
 
@@ -1424,8 +1426,10 @@ void garbageCollector(Client cntxt, MalB
        ValPtr v;
 
 #ifdef STACKTRACE
-       mnstr_printf(cntxt->fdout, "#--->stack before garbage collector\n");
-       printStack(cntxt->fdout, mb, stk, 0);
+       if (cntxt) {
+               mnstr_printf(cntxt->fdout, "#--->stack before garbage 
collector\n");
+               printStack(cntxt->fdout, mb, stk, 0);
+       }
 #endif
        for (k = 0; k < mb->vtop; k++) {
                if (isVarCleanup(mb, k) && (flag || isTmpVar(mb, k))) {
@@ -1435,8 +1439,10 @@ void garbageCollector(Client cntxt, MalB
                }
        }
 #ifdef STACKTRACE
-       mnstr_printf(cntxt->fdout, "#-->stack after garbage collector\n");
-       printStack(cntxt->fdout, mb, stk, 0);
+       if (cntxt) {
+               mnstr_printf(cntxt->fdout, "#-->stack after garbage 
collector\n");
+               printStack(cntxt->fdout, mb, stk, 0);
+       }
 #else
        (void)cntxt;
 #endif
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -64,6 +64,7 @@ mvc_init(int debug, store_type store, in
        if (first || catalog_version) {
                sql_schema *s;
                sql_table *t;
+               sqlid tid = 0, ntid, cid = 0, ncid;
                mvc *m = mvc_create(0, stk, 0, NULL, NULL);
 
                m->sa = sa_create();
@@ -80,12 +81,15 @@ mvc_init(int debug, store_type store, in
 
                if (!first) {
                        t = mvc_bind_table(m, s, "tables");
+                       tid = t->base.id;
                        mvc_drop_table(m, s, t, 0);
                        t = mvc_bind_table(m, s, "columns");
+                       cid = t->base.id;
                        mvc_drop_table(m, s, t, 0);
                }
 
                t = mvc_create_view(m, s, "tables", SQL_PERSIST, "SELECT 
\"id\", \"name\", \"schema_id\", \"query\", CAST(CASE WHEN \"system\" THEN 
\"type\" + 10 /* system table/view */ ELSE (CASE WHEN \"commit_action\" = 0 
THEN \"type\" /* table/view */ ELSE \"type\" + 20 /* global temp table */ END) 
END AS SMALLINT) AS \"type\", \"system\", \"commit_action\", \"access\", CASE 
WHEN (NOT \"system\" AND \"commit_action\" > 0) THEN 1 ELSE 0 END AS 
\"temporary\" FROM \"sys\".\"_tables\" WHERE \"type\" <> 2 UNION ALL SELECT 
\"id\", \"name\", \"schema_id\", \"query\", CAST(\"type\" + 30 /* local temp 
table */ AS SMALLINT) AS \"type\", \"system\", \"commit_action\", \"access\", 1 
AS \"temporary\" FROM \"tmp\".\"_tables\";", 1);
+               ntid = t->base.id;
                mvc_create_column_(m, t, "id", "int", 32);
                mvc_create_column_(m, t, "name", "varchar", 1024);
                mvc_create_column_(m, t, "schema_id", "int", 32);
@@ -101,10 +105,18 @@ mvc_init(int debug, store_type store, in
                        int p = PRIV_SELECT;
                        int zero = 0;
                        sql_table *privs = find_sql_table(s, "privileges");
+                       sql_table *deps = find_sql_table(s, "dependencies");
+                       sql_column *depids = find_sql_column(deps, "id");
+                       oid rid;
+
                        table_funcs.table_insert(m->session->tr, privs, 
&t->base.id, &pub, &p, &zero, &zero);
+                       while ((rid = 
table_funcs.column_find_row(m->session->tr, depids, &tid, NULL)) != oid_nil) {
+                               table_funcs.column_update_value(m->session->tr, 
depids, rid, &ntid);
+                       }
                }
 
                t = mvc_create_view(m, s, "columns", SQL_PERSIST, "SELECT * 
FROM (SELECT p.* FROM \"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM 
\"tmp\".\"_columns\" AS t) AS columns;", 1);
+               ncid = t->base.id;
                mvc_create_column_(m, t, "id", "int", 32);
                mvc_create_column_(m, t, "name", "varchar", 1024);
                mvc_create_column_(m, t, "type", "varchar", 1024);
@@ -121,7 +133,14 @@ mvc_init(int debug, store_type store, in
                        int p = PRIV_SELECT;
                        int zero = 0;
                        sql_table *privs = find_sql_table(s, "privileges");
+                       sql_table *deps = find_sql_table(s, "dependencies");
+                       sql_column *depids = find_sql_column(deps, "id");
+                       oid rid;
+
                        table_funcs.table_insert(m->session->tr, privs, 
&t->base.id, &pub, &p, &zero, &zero);
+                       while ((rid = 
table_funcs.column_find_row(m->session->tr, depids, &cid, NULL)) != oid_nil) {
+                               table_funcs.column_update_value(m->session->tr, 
depids, rid, &ncid);
+                       }
                } else { 
                        sql_create_env(m, s);
                        sql_create_privileges(m, s);
diff --git a/sql/test/leaks/Tests/check1.stable.out 
b/sql/test/leaks/Tests/check1.stable.out
--- a/sql/test/leaks/Tests/check1.stable.out
+++ b/sql/test/leaks/Tests/check1.stable.out
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       34      ]
 [ "str",       34      ]
diff --git a/sql/test/leaks/Tests/check1.stable.out.int128 
b/sql/test/leaks/Tests/check1.stable.out.int128
--- a/sql/test/leaks/Tests/check1.stable.out.int128
+++ b/sql/test/leaks/Tests/check1.stable.out.int128
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       36      ]
 [ "str",       36      ]
diff --git a/sql/test/leaks/Tests/check2.stable.out 
b/sql/test/leaks/Tests/check2.stable.out
--- a/sql/test/leaks/Tests/check2.stable.out
+++ b/sql/test/leaks/Tests/check2.stable.out
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       34      ]
 [ "str",       34      ]
diff --git a/sql/test/leaks/Tests/check2.stable.out.int128 
b/sql/test/leaks/Tests/check2.stable.out.int128
--- a/sql/test/leaks/Tests/check2.stable.out.int128
+++ b/sql/test/leaks/Tests/check2.stable.out.int128
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
 [ "sht",       56      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       36      ]
 [ "str",       36      ]
diff --git a/sql/test/leaks/Tests/check3.stable.out 
b/sql/test/leaks/Tests/check3.stable.out
--- a/sql/test/leaks/Tests/check3.stable.out
+++ b/sql/test/leaks/Tests/check3.stable.out
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       57      ]
 [ "sht",       57      ]
 [ "sht",       57      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       34      ]
 [ "str",       34      ]
diff --git a/sql/test/leaks/Tests/check3.stable.out.int128 
b/sql/test/leaks/Tests/check3.stable.out.int128
--- a/sql/test/leaks/Tests/check3.stable.out.int128
+++ b/sql/test/leaks/Tests/check3.stable.out.int128
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       57      ]
 [ "sht",       57      ]
 [ "sht",       57      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       36      ]
 [ "str",       36      ]
diff --git a/sql/test/leaks/Tests/check4.stable.out 
b/sql/test/leaks/Tests/check4.stable.out
--- a/sql/test/leaks/Tests/check4.stable.out
+++ b/sql/test/leaks/Tests/check4.stable.out
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       58      ]
 [ "sht",       58      ]
 [ "sht",       58      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
 [ "str",       32      ]
 [ "str",       34      ]
 [ "str",       34      ]
diff --git a/sql/test/leaks/Tests/check4.stable.out.int128 
b/sql/test/leaks/Tests/check4.stable.out.int128
--- a/sql/test/leaks/Tests/check4.stable.out.int128
+++ b/sql/test/leaks/Tests/check4.stable.out.int128
@@ -202,7 +202,7 @@ Ready.
 [ "sht",       0       ]
 [ "sht",       0       ]
 [ "sht",       10      ]
-[ "sht",       14      ]
+[ "sht",       15      ]
 [ "sht",       58      ]
 [ "sht",       58      ]
 [ "sht",       58      ]
@@ -274,7 +274,7 @@ Ready.
 [ "str",       10      ]
 [ "str",       13      ]
 [ "str",       13      ]
-[ "str",       14      ]
+[ "str",       15      ]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to