Changeset: e8e1e0462ea9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e8e1e0462ea9
Modified Files:
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_private.h
gdk/gdk_system.c
monetdb5/mal/Tests/tst1200.stable.out
monetdb5/mal/Tests/tst1205.stable.out
monetdb5/mal/mal_instruction.c
sql/backends/monet5/sql.c
sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.SQL.py
sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.err
sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.out
Branch: default
Log Message:
Merge with Aug2018 branch.
diffs (258 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1047,8 +1047,10 @@ BATslice(BAT *b, BUN l, BUN h)
bn->trevsorted = b->trevsorted;
BATkey(bn, BATtkey(b));
}
- ALGODEBUG fprintf(stderr, "#BATslice()=" ALGOBATFMT "\n",
- ALGOBATPAR(bn));
+ ALGODEBUG fprintf(stderr,
+ "#BATslice(" ALGOBATFMT "," BUNFMT "," BUNFMT ")"
+ "=" ALGOBATFMT "\n",
+ ALGOBATPAR(b), l, h, ALGOBATPAR(bn));
return bn;
bunins_failed:
BBPreclaim(bn);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -101,7 +101,7 @@ static volatile ATOMIC_TYPE BBPsize = 0;
struct BBPfarm_t BBPfarms[MAXFARMS];
-#define KITTENNAP 4 /* used to suspend processing */
+#define KITTENNAP 1 /* used to suspend processing */
#define BBPNONAME "." /* filler for no name in BBP.dir */
/*
* The hash index uses a bucket index (int array) of size mask that is
@@ -2499,7 +2499,7 @@ decref(bat i, bool logical, bool release
(BBP_lrefs(i) > 0 &&
(b == NULL || BATdirty(b) || !(BBP_status(i) & BBPPERSISTENT)))) {
/* bat cannot be swapped out */
- } else if (b || (BBP_status(i) & BBPTMP)) {
+ } else if (b ? b->batSharecnt == 0 : (BBP_status(i) & BBPTMP)) {
/* bat will be unloaded now. set the UNLOADING bit
* while locked so no other thread thinks it's
* available anymore */
@@ -2653,7 +2653,7 @@ getBBPdescriptor(bat i, bool lock)
if (b == NULL) {
load = true;
BATDEBUG {
- fprintf(stderr, "#BBPdescriptor set to
unloading BAT %d\n", i);
+ fprintf(stderr, "#BBPdescriptor set to
loading BAT %d\n", i);
}
BBP_status_on(i, BBPLOADING, "BBPdescriptor");
}
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -278,7 +278,7 @@ void IMPSprint(BAT *b) /* never called:
b && b->torderidx ? "O" : "", \
b ? b->timprints ? "I" : b->theap.parentid &&
BBP_cache(b->theap.parentid)->timprints ? "(I)" : "" : ""
-#define BBP_BATMASK 511
+#define BBP_BATMASK (128 * SIZEOF_SIZE_T - 1)
#define BBP_THREADMASK 63
struct PROPrec {
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -82,10 +82,9 @@ sortlocklist(MT_Lock *l)
while (l && r) {
if (l->sleep < r->sleep ||
(l->sleep == r->sleep &&
- l->contention < r->contention) ||
- (l->sleep == r->sleep &&
- l->contention == r->contention &&
- l->count <= r->count)) {
+ (l->contention < r->contention ||
+ (l->contention == r->contention &&
+ l->count <= r->count)))) {
/* l is smaller */
if (ll == NULL) {
assert(t == NULL);
@@ -116,14 +115,25 @@ void
GDKlockstatistics(int what)
{
MT_Lock *l;
+ int n = 0;
if (ATOMIC_TAS(GDKlocklistlock, dummy) != 0) {
fprintf(stderr, "#WARNING: GDKlocklistlock is set, so cannot
access lock list\n");
return;
}
+ if (what == -1) {
+ for (l = GDKlocklist; l; l = l->next) {
+ l->count = 0;
+ l->contention = 0;
+ l->sleep = 0;
+ }
+ ATOMIC_CLEAR(GDKlocklistlock, dummy);
+ return;
+ }
GDKlocklist = sortlocklist(GDKlocklist);
fprintf(stderr, "# lock
name\tcount\tcontention\tsleep\tlocked\t(un)locker\n");
- for (l = GDKlocklist; l; l = l->next)
+ for (l = GDKlocklist; l; l = l->next) {
+ n++;
if (what == 0 ||
(what == 1 && l->count) ||
(what == 2 && l->contention) ||
@@ -133,6 +143,8 @@ GDKlockstatistics(int what)
l->count, l->contention, l->sleep,
l->lock ? "locked" : "",
l->locker ? l->locker : "");
+ }
+ fprintf(stderr, "#number of locks %d\n", n);
fprintf(stderr, "#total lock count %zu\n", (size_t) GDKlockcnt);
fprintf(stderr, "#lock contention %zu\n", (size_t)
GDKlockcontentioncnt);
fprintf(stderr, "#lock sleep count %zu\n", (size_t) GDKlocksleepcnt);
diff --git a/monetdb5/mal/Tests/tst1200.stable.out
b/monetdb5/mal/Tests/tst1200.stable.out
--- a/monetdb5/mal/Tests/tst1200.stable.out
+++ b/monetdb5/mal/Tests/tst1200.stable.out
@@ -987,7 +987,7 @@ Ready.
[ 14@0, 23:59:59.999, 23, 59, 59, 999 ]
[ 15@0, nil, nil, nil, nil, nil
]
[ 16@0, nil, nil, nil, nil, nil
]
-[ 17@0, nil, nil, nil, nil, nil
]
+[ 17@0, nil, 24, 0, 0, 999 ]
[ 18@0, nil, nil, nil, nil, nil
]
[ 19@0, nil, nil, nil, nil, nil
]
[ 20@0, nil, nil, nil, nil, nil
]
diff --git a/monetdb5/mal/Tests/tst1205.stable.out
b/monetdb5/mal/Tests/tst1205.stable.out
--- a/monetdb5/mal/Tests/tst1205.stable.out
+++ b/monetdb5/mal/Tests/tst1205.stable.out
@@ -805,7 +805,7 @@ Ready.
[ 14@0, 23:59:59.999, 23, 59, 59, 999 ]
[ 15@0, nil, nil, nil, nil, nil ]
[ 16@0, nil, nil, nil, nil, nil ]
-[ 17@0, nil, nil, nil, nil, nil ]
+[ 17@0, nil, 24, 0, 0, 999 ]
[ 18@0, nil, nil, nil, nil, nil ]
[ 19@0, nil, nil, nil, nil, nil ]
[ 20@0, nil, nil, nil, nil, nil ]
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -111,7 +111,7 @@ newMalBlk(int elements)
if (mb == NULL)
return NULL;
- /* each MAL instruction implies at least on variable
+ /* each MAL instruction implies at least one variable
* we reserve some extra for constants */
v = (VarRecord *) GDKzalloc(sizeof(VarRecord) * (elements + 8) );
if (v == NULL) {
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
@@ -975,8 +975,10 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
b = mvc_bind(m, sname, tname, cname, access);
- if (b && b->ttype != coltype)
+ if (b && b->ttype != coltype) {
+ BBPunfix(b->batCacheid);
throw(SQL,"sql.bind",SQLSTATE(42000) "Column type mismatch");
+ }
if (b) {
if (pci->argc == (8 + upd) && getArgType(mb, pci, 6 + upd) ==
TYPE_int) {
BUN cnt = BATcount(b), psz;
@@ -987,8 +989,10 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
if (access == 0) {
psz = cnt ? (cnt / nr_parts) : 0;
bn = BATslice(b, part_nr * psz, (part_nr + 1 ==
nr_parts) ? cnt : ((part_nr + 1) * psz));
- if(bn == NULL)
+ if(bn == NULL) {
+ BBPunfix(b->batCacheid);
throw(SQL, "sql.bind", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+ }
BAThseqbase(bn, part_nr * psz);
} else {
/* BAT b holds the UPD_ID bat */
@@ -997,7 +1001,7 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
if (c == NULL) {
BBPunfix(b->batCacheid);
throw(SQL,"sql.bind",SQLSTATE(HY005)
"Cannot access the update column %s.%s.%s",
- sname,tname,cname);
+ sname,tname,cname);
}
cnt = BATcount(c);
psz = cnt ? (cnt / nr_parts) : 0;
@@ -1017,9 +1021,11 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
BAT *uv = mvc_bind(m, sname, tname, cname, RD_UPD_VAL);
bat *uvl = getArgReference_bat(stk, pci, 1);
- if (uv == NULL)
+ if (uv == NULL) {
+ BBPunfix(b->batCacheid);
throw(SQL,"sql.bind",SQLSTATE(HY005) "Cannot
access the update column %s.%s.%s",
sname,tname,cname);
+ }
BBPkeepref(*bid = b->batCacheid);
BBPkeepref(*uvl = uv->batCacheid);
return MAL_SUCCEED;
@@ -1035,6 +1041,7 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
if (ui == NULL || uv == NULL) {
bat_destroy(uv);
bat_destroy(ui);
+ BBPunfix(b->batCacheid);
throw(SQL,"sql.bind",SQLSTATE(HY005)
"Cannot access the insert column %s.%s.%s",
sname, tname, cname);
}
@@ -1043,6 +1050,7 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
bat_destroy(ui);
bat_destroy(uv);
if (id == NULL || vl == NULL) {
+ BBPunfix(b->batCacheid);
bat_destroy(id);
bat_destroy(vl);
throw(SQL, "sql.bind", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
@@ -1057,8 +1065,10 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
*bid = e_bat(TYPE_oid);
*uvl = e_bat(c->type.type->localtype);
- if(*bid == BID_NIL || *uvl == BID_NIL)
+ if(*bid == BID_NIL || *uvl == BID_NIL) {
+ BBPunfix(b->batCacheid);
throw(SQL, "sql.bind", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+ }
}
BBPunfix(b->batCacheid);
} else {
diff --git
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.SQL.py
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.SQL.py
---
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.SQL.py
+++
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.SQL.py
@@ -63,6 +63,7 @@ except Exception, e:
print(e, file=sys.stderr)
print(query(c1, 'select * from t2'))
run(c1, 'drop table t2')
+run(c1, 'drop sequence myseq')
# clean up
c1.close()
diff --git
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.err
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.err
---
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.err
+++
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.err
@@ -28,7 +28,7 @@ stderr of test 'dependency_column_on_seq
# 16:44:25 > "/usr/bin/python"
"dependency_column_on_sequence.Bug-6618.SQL.py"
"dependency_column_on_sequence.Bug-6618"
# 16:44:25 >
-2B000!DROP SEQUENCE: unable to drop sequence seq_7622 (there are database
objects which depend on it)
+2B000!DROP SEQUENCE: unable to drop sequence seq_8831 (there are database
objects which depend on it)
2B000!DROP SEQUENCE: unable to drop sequence myseq (there are database objects
which depend on it)
diff --git
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.out
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.out
---
a/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.out
+++
b/sql/test/BugTracker-2018/Tests/dependency_column_on_sequence.Bug-6618.stable.out
@@ -58,6 +58,7 @@ insert into t2(val) values (10), (20)
drop sequence myseq
[(1, 10), (2, 20)]
drop table t2
+drop sequence myseq
# 15:49:25 >
# 15:49:25 > "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list