Changeset: 0881d6f715a8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0881d6f715a8
Added Files:
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.sql
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.stable.err
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.stable.out
Modified Files:
clients/mapiclient/tomograph.c
gdk/gdk_batop.c
gdk/gdk_select.c
monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
monetdb5/mal/mal_dataflow.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/pqueue.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.mx
sql/server/sql_env.c
sql/server/sql_env.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/storage/sql_storage.h
sql/storage/store.c
sql/test/BugConstraints/Tests/add_constraint_1643522.stable.err
sql/test/BugConstraints/Tests/delete_primarykey_1643845.stable.err
sql/test/BugConstraints/Tests/drop_column_1643542.stable.err
sql/test/BugConstraints/Tests/update_primarykey_1643375.stable.err
sql/test/BugTracker-2008/Tests/sql_command_kills_db.SF-2233677.stable.err
sql/test/BugTracker-2009/Tests/ambiguous_order_by.SF-2827916.stable.err
sql/test/BugTracker-2009/Tests/ambiguous_view.stable.err
sql/test/BugTracker-2009/Tests/assert_in_update.SF-2807336.stable.err
sql/test/BugTracker-2009/Tests/copy_into_error_off_by_one.SF-2833696.stable.err
sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.err
sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err
sql/test/BugTracker-2009/Tests/create_table_dup_name.SF-2879005.stable.err
sql/test/BugTracker-2009/Tests/drop-sequence-crash.SF-2854195.stable.err
sql/test/BugTracker-2009/Tests/except_error_wrong.SF-2808409.stable.err
sql/test/BugTracker-2009/Tests/explain_gives_crash.SF-2741829.stable.err
sql/test/BugTracker-2009/Tests/incomplete.SF.2536893.stable.err
sql/test/BugTracker-2009/Tests/insert_into_values_bug.SF-2807609.stable.err
sql/test/BugTracker-2009/Tests/limit_in_subquery.SF-2620437.stable.err
sql/test/BugTracker-2009/Tests/not_invalidtable_crash.SF-2927174.stable.err
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err.Solaris
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err.Windows
sql/test/BugTracker-2009/Tests/primekeyconstraint.SF-2783425.stable.err
sql/test/BugTracker-2009/Tests/rollback_bug.stable.err
sql/test/BugTracker-2009/Tests/rollback_mistake.SF-2814622.stable.err
sql/test/BugTracker-2009/Tests/segv_for_unknown_identifier_in_subquery.SF-2874045.stable.err
sql/test/BugTracker-2009/Tests/select_X_where_bla_EQ_whatever.SF-282597.stable.err
sql/test/BugTracker-2009/Tests/select_from_history.SF-2556566.stable.err
sql/test/BugTracker-2009/Tests/subquery_returns_table_crash.SF-2513620.stable.err
sql/test/BugTracker-2009/Tests/temp_table_fail_leaves_data.SF-2793286.stable.err
sql/test/BugTracker-2009/Tests/temporary_table_leftover.SF-2734713.stable.err
sql/test/BugTracker-2009/Tests/unique_constraint_on_char.SF-2873564.stable.err
sql/test/BugTracker-2009/Tests/wrong_error_message.SF-2637051.stable.err
sql/test/BugTracker-2010/Tests/TypeException_with_missing_function.Bug-2674.stable.err
sql/test/BugTracker-2010/Tests/call_function_without_warning.Bug-2752.stable.err
sql/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.stable.err
sql/test/BugTracker-2010/Tests/crash_default_unlocked.Bug-2744.stable.err
sql/test/BugTracker-2010/Tests/crash_on_in_2.Bug-2604.stable.err
sql/test/BugTracker-2010/Tests/crashonschema.Bug-2547.stable.err
sql/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err.Darwin
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err.Windows
sql/test/BugTracker-2010/Tests/incomplete-utf8-sequence.Bug-2575.stable.err
sql/test/BugTracker-2010/Tests/prepare_stmt.Bug-2533.Bug-2534.stable.err
sql/test/BugTracker-2010/Tests/second_function_existing_signature.Bug-2611.stable.err
sql/test/BugTracker-2010/Tests/select_from_seq.Bug-2730.stable.err
sql/test/BugTracker-2010/Tests/select_star.Bug-2563.stable.err
sql/test/BugTracker-2010/Tests/sequence-restart-with-null.Bug-2648.stable.err
sql/test/BugTracker-2010/Tests/subselect.Bug-2537.stable.err
sql/test/BugTracker-2010/Tests/sum_on_date_crash.Bug-2643.stable.err
sql/test/BugTracker-2010/Tests/times-crash.Bug-2586.stable.err
sql/test/BugTracker-2010/Tests/wrong_error_message_dropping_view.Bug-2713.stable.err
sql/test/BugTracker-2012/Tests/create_function.Bug-3172.stable.err
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.err
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090_nogeom.stable.err
sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err
sql/test/BugTracker-2013/Tests/All
sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.stable.err
sql/test/BugTracker-2013/Tests/psm_functions_and_accessrights.Bug-3300.stable.err
sql/test/BugTracker/Tests/bind_with_cast.SF-1720934.stable.err
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err.Windows
sql/test/Dependencies/Tests/Dependencies.stable.err
sql/test/Tests/coalesce.stable.err.single
sql/test/Tests/setoptimizer.stable.err
sql/test/Triggers/Tests/recursive_triggers.stable.err
sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-table.stable.err
sql/test/ssqq/Tests/insert_queue.stable.err
Branch: default
Log Message:
merge with default
diffs (truncated from 1770 to 300 lines):
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -793,7 +793,7 @@ static void dumpboxes(void)
//fprintf(f,""LLFMT" %f 0 0 \n",
box[i].clkstart, (box[i].memstart/1024.0));
fprintf(f, ""LLFMT" %f %f 0 0\n",
box[i].clkend, (box[i].memend / 1024.0), box[i].footend/1024.0);
} else
- if (box[i].state == PING) {
+ if (box[i].state >= PING) {
/* cpu stat events may arrive out of order,
drop those */
if ( box[i].clkstart <= e)
continue;
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -2247,8 +2247,8 @@ BATmergecand(BAT *a, BAT *b)
BATcheck(b, "BATmergecand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(BATcount(a) <= 1 || a->tsorted);
assert(BATcount(b) <= 1 || b->tsorted);
assert(BATcount(a) <= 1 || a->tkey);
@@ -2256,7 +2256,13 @@ BATmergecand(BAT *a, BAT *b)
assert(a->T->nonil);
assert(b->T->nonil);
- /* XXX we could return a if b is empty (and v.v.) */
+ /* we could return a if b is empty (and v.v.) */
+ if ( BATcount(a) == 0){
+ return BATcopy(b, b->htype, b->ttype, 0);
+ }
+ if ( BATcount(b) == 0){
+ return BATcopy(a, a->htype, a->ttype, 0);
+ }
bn = BATnew(TYPE_void, TYPE_oid, BATcount(a) + BATcount(b));
if (bn == NULL)
@@ -2344,8 +2350,8 @@ BATintersectcand(BAT *a, BAT *b)
BATcheck(b, "BATintersectcand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(a->tsorted);
assert(b->tsorted);
assert(a->tkey);
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -183,7 +183,7 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn,
/* inner check */
#define impscheck(CAND,TEST,ADD) \
do { \
- e = i+limit-pr_off+off; \
+ e = (BUN) (i+limit-pr_off+off); \
if (im[icnt] & mask) { \
if ((im[icnt] & ~innermask) == 0) { \
while (o < e && p < q) { \
@@ -599,7 +599,7 @@ fullscan_any(BAT *b, BAT *s, BAT *bn, co
/* scan/imprints select with candidates */
scan_sel(candscan, o = (oid) (*candlist++), w = (BUN) ((*(oid *) Tloc(s,q?(q -
1):0)) + 1))
/* scan/imprints select without candidates */
-scan_sel(fullscan, o = p+off, w = q+off)
+scan_sel(fullscan, o = (oid) (p+off), w = (BUN) (q+off))
static BAT *
diff --git
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
--- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
+++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
@@ -30,16 +30,16 @@ stderr of test 'opt_sql_append` in direc
# 22:58:57 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=rome"
"--port=36275"
# 22:58:57 >
-MAPI = (monetdb) /var/tmp/mtest-5003/.s.monetdb.36177
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '\tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz
-MAPI = (monetdb) /var/tmp/mtest-5003/.s.monetdb.36177
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from 'a:\tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: a:\tmp/xyz
-MAPI = (monetdb) /var/tmp/mtest-5003/.s.monetdb.36177
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '\tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz
-MAPI = (monetdb) /var/tmp/mtest-5003/.s.monetdb.36177
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from 'Z:/tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: Z:/tmp/xyz
diff --git
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
---
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
+++
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
@@ -30,16 +30,16 @@ stderr of test 'opt_sql_append` in direc
# 22:58:57 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=rome"
"--port=36275"
# 22:58:57 >
-MAPI = monetdb@LAB03:34567
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '/tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: /tmp/xyz
-MAPI = monetdb@LAB03:34567
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '\tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz
-MAPI = monetdb@LAB03:34567
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '/tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: /tmp/xyz
-MAPI = monetdb@LAB03:34567
+MAPI = (monetdb) /var/tmp/mtest-15953/.s.monetdb.31373
QUERY = explain copy into ttt from '\tmp/xyz';
ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -61,10 +61,10 @@ typedef struct queue {
int size; /* size of queue */
int last; /* last element in the queue */
int exitcount; /* how many threads should exit */
+ int exitedcount; /* how many threads have exited
*/
FlowEvent *data;
MT_Lock l; /* it's a shared resource, ie we need locks */
MT_Sema s; /* threads wait on empty queues */
- MT_Sema e; /* synchronize exiting of thread */
} Queue;
/*
@@ -127,11 +127,11 @@ q_create(int sz, const char *name)
return NULL;
}
q->exitcount = 0;
+ q->exitedcount = 0;
(void) name; /* in case MT_LOCK_TRACE is not enabled in gdk_system.h */
MT_lock_init(&q->l, name);
MT_sema_init(&q->s, 0, name);
- MT_sema_init(&q->e, 0, name);
return q;
}
@@ -220,7 +220,9 @@ q_dequeue(Queue *q)
if (q->exitcount > 0) {
q->exitcount--;
MT_lock_unset(&q->l, "q_dequeue");
- MT_sema_up(&q->e, "q_dequeue");
+ MT_lock_set(&mal_contextLock, "q_dequeue");
+ q->exitedcount++;
+ MT_lock_unset(&mal_contextLock, "q_dequeue");
return NULL;
}
assert(q->last > 0);
@@ -678,6 +680,13 @@ runMALdataflow(Client cntxt, MalBlkPtr m
/* create one more worker to compensate for our waiting until
* all work is done */
MT_lock_set(&mal_contextLock, "runMALdataflow");
+ for (i = 0; i < THREADS && todo->exitedcount > 0; i++) {
+ if (workers[i].flag == EXITED) {
+ todo->exitedcount--;
+ workers[i].flag = IDLE;
+ MT_join_thread(workers[i].id);
+ }
+ }
for (i = 0; i < THREADS; i++) {
if (workers[i].flag == IDLE) {
if (MT_create_thread(&workers[i].id,
DFLOWworker, (void *) &workers[i], MT_THR_JOINABLE) < 0) {
@@ -764,16 +773,6 @@ runMALdataflow(Client cntxt, MalBlkPtr m
todo->exitcount++;
MT_lock_unset(&todo->l, "runMALdataflow");
MT_sema_up(&todo->s, "runMALdataflow");
- MT_sema_down(&todo->e, "runMALdataflow");
- MT_lock_set(&mal_contextLock, "runMALdataflow");
- for (i = 0; i < THREADS; i++) {
- if (workers[i].flag == EXITED) {
- MT_join_thread(workers[i].id);
- workers[i].flag = IDLE;
- break;
- }
- }
- MT_lock_unset(&mal_contextLock, "runMALdataflow");
}
return msg;
}
diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -84,12 +84,15 @@ MAThasMoreElements(Client cntxt, MalBlkP
* do not produce RUNTIME_OBJECT_MISSING.
*/
static str
-MATpackInternal(MalStkPtr stk, InstrPtr p)
+MATpackInternal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
int i, *ret = (int*) getArgReference(stk,p,0);
BAT *b, *bn;
BUN cap = 0;
int tt = TYPE_any;
+ int sorted =1, keyed=1, voidheaded=1;
+ (void) cntxt;
+ (void) mb;
for (i = 1; i < p->argc; i++) {
int bid = stk->stk[getArg(p,i)].val.ival;
@@ -105,11 +108,16 @@ MATpackInternal(MalStkPtr stk, InstrPtr
tt = b->ttype;
cap += BATcount(b);
}
+ if ( !b->tsorted) sorted =0;
+ if ( !b->tkey) keyed =0;
+ if ( b->htype != TYPE_void ) voidheaded =0;
}
if (tt == TYPE_any){
*ret = 0;
return MAL_SUCCEED;
}
+ if (tt == TYPE_oid && sorted && keyed && voidheaded)
+ return MATmergepack(cntxt, mb, stk, p);
bn = BATnew(TYPE_void, tt, cap);
if (bn == NULL)
@@ -435,9 +443,7 @@ MATpack3(Client cntxt, MalBlkPtr mb, Mal
str
MATpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
- (void) cntxt;
- (void) mb;
- return MATpackInternal(stk,p);
+ return MATpackInternal(cntxt,mb,stk,p);
}
// merging multiple OID lists, optimized for empty bats
@@ -445,45 +451,95 @@ MATpack(Client cntxt, MalBlkPtr mb, MalS
str
MATmergepack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
- int i, *ret = (int*) getArgReference(stk,p,0);
- int top=0, *bids;
- BAT *b, *bn, *bm;
+ int i,j= 0, *ret = (int*) getArgReference(stk,p,0);
+ int top=0;
+ oid **o_end, **o_src, *o, *oo, onxt;
+ BAT *b, *bn, *bm, **bats;
BUN cap = 0;
(void)cntxt;
(void)mb;
- bids = (int*) GDKzalloc(sizeof(int) * p->argc);
- if ( bids ==0)
+ bats = (BAT**) GDKzalloc(sizeof(BAT*) * p->argc);
+ o_end = (oid**) GDKzalloc(sizeof(oid*) * p->argc);
+ o_src = (oid**) GDKzalloc(sizeof(oid*) * p->argc);
+
+ if ( bats ==0 || o_end == 0 || o_src == 0){
+ if (bats) GDKfree(bats);
+ if (o_src) GDKfree(o_src);
+ if (o_end) GDKfree(o_end);
throw(MAL,"mat.mergepack",MAL_MALLOC_FAIL);
+ }
for (i = 1; i < p->argc; i++) {
int bid = stk->stk[getArg(p,i)].val.ival;
- b = BBPquickdesc(ABS(bid),FALSE);
+ b = BATdescriptor(ABS(bid));
if (b ){
cap += BATcount(b);
- if ( BATcount(b) )
- bids[top++] = b->batCacheid;
+ if ( BATcount(b) ){
+ // pre-sort the arguments
+ onxt = *(oid*) Tloc(b,BUNfirst(b));
+ for( j =top; j > 0 && onxt < *o_src[j-1]; j--){
+ o_src[j] = o_src[j-1];
+ o_end[j] = o_end[j-1];
+ bats[j] = bats[j-1];
+ }
+ o_src[j] = (oid*) Tloc(b,BUNfirst(b));
+ o_end[j] = o_src[j] + BATcount(b);
+ bats[j] = b;
+ top++;
+ }
}
}
bn = BATnew(TYPE_void, TYPE_oid, cap);
if (bn == NULL)
throw(MAL, "mat.pack", MAL_MALLOC_FAIL);
- if( cap > 0)
- for (i = 0; i < top; i++) {
- b = BATdescriptor(bids[i]);
- if( b ){
- if ( i == 1)
- BATseqbase(bn, b->hseqbase);
- bm = BATmergecand(bn,b);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list