Changeset: ea93ca193e10 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ea93ca193e10 Added Files: monetdb5/mal/mal_private.h Removed Files: sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows.32bit Modified Files: monetdb5/mal/Makefile.ag monetdb5/mal/mal_client.c monetdb5/mal/mal_client.h monetdb5/mal/mal_session.c monetdb5/optimizer/opt_pushselect.c sql/backends/monet5/sql.mx sql/backends/monet5/sql_scenario.c sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.stable.err Branch: default Log Message:
Merge with Feb2013 branch. diffs (truncated from 428 to 300 lines): diff --git a/monetdb5/mal/Makefile.ag b/monetdb5/mal/Makefile.ag --- a/monetdb5/mal/Makefile.ag +++ b/monetdb5/mal/Makefile.ag @@ -61,7 +61,8 @@ lib_mal = { mal_stack.c mal_stack.h \ mal_type.c mal_type.h \ mal_utils.c mal_utils.h \ - mal_xml.c mal_xml.h + mal_xml.c mal_xml.h \ + mal_private.h } headers_h = { diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c --- a/monetdb5/mal/mal_client.c +++ b/monetdb5/mal/mal_client.c @@ -56,6 +56,7 @@ #include "mal_import.h" #include "mal_parser.h" #include "mal_namespace.h" +#include "mal_private.h" #include <mapi.h> /* for PROMPT1 */ @@ -175,7 +176,7 @@ MCgetClient(int id) return mal_clients + id; } -static void +void MCexitClient(Client c) { #ifdef MAL_CLIENT_DEBUG diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h new file mode 100644 --- /dev/null +++ b/monetdb5/mal/mal_private.h @@ -0,0 +1,22 @@ +/* + * The contents of this file are subject to the MonetDB Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.monetdb.org/Legal/MonetDBLicense + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is the MonetDB Database System. + * + * The Initial Developer of the Original Code is CWI. + * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. + * Copyright August 2008-2013 MonetDB B.V. + * All Rights Reserved. + */ + +/* This file should not be included in any file outside of this directory */ + +extern void MCexitClient(Client c); diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -27,6 +27,7 @@ #include "mal_readline.h" #include "mal_authorize.h" #include "mal_sabaoth.h" +#include "mal_private.h" #include <gdk.h> /* for opendir and friends */ /* @@ -136,6 +137,18 @@ MSinitClientPrg(Client cntxt, str mod, s * The scheduleClient receives a challenge response consisting of * endian:user:password:lang:database: */ +static void +exit_streams( bstream *fin, stream *fout ) +{ + if (fout && fout != GDKstdout) { + mnstr_flush(fout); + (void) mnstr_close(fout); + (void) mnstr_destroy(fout); + } + if (fin) + (void) bstream_destroy(fin); +} + void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout) { @@ -154,7 +167,7 @@ MSscheduleClient(str command, str challe user = s + 1; } else { mnstr_printf(fout, "!incomplete challenge '%s'\n", user); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -167,7 +180,7 @@ MSscheduleClient(str command, str challe /* decode algorithm, i.e. {plain}mypasswordchallenge */ if (*passwd != '{') { mnstr_printf(fout, "!invalid password entry\n"); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -175,7 +188,7 @@ MSscheduleClient(str command, str challe s = strchr(algo, '}'); if (!s) { mnstr_printf(fout, "!invalid password entry\n"); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -183,7 +196,7 @@ MSscheduleClient(str command, str challe passwd = s + 1; } else { mnstr_printf(fout, "!incomplete challenge '%s'\n", user); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -195,7 +208,7 @@ MSscheduleClient(str command, str challe lang = s + 1; } else { mnstr_printf(fout, "!incomplete challenge, missing language\n"); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -220,7 +233,7 @@ MSscheduleClient(str command, str challe "did you mean to connect to monetdbd instead?\n", database, dbname); /* flush the error to the client, and abort further execution */ - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } else { @@ -235,7 +248,7 @@ MSscheduleClient(str command, str challe err = AUTHcheckCredentials(&uid, &root, &user, &passwd, &challenge, &algo); if (err != MAL_SUCCEED) { mnstr_printf(fout, "!%s\n", err); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -249,7 +262,7 @@ MSscheduleClient(str command, str challe GDKfree(err); mnstr_printf(fout, "!internal server error, " "please try again later\n"); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -260,7 +273,7 @@ MSscheduleClient(str command, str challe } else { mnstr_printf(fout, "!server is running in " "maintenance mode, please try again later\n"); - mnstr_flush(fout); + exit_streams(fin, fout); SABAOTHfreeStatus(&stats); GDKfree(command); return; @@ -272,7 +285,7 @@ MSscheduleClient(str command, str challe if (c == NULL) { mnstr_printf(fout, "!maximum concurrent client limit reached " "(%d), please try again later\n", MAL_MAXCLIENTS); - mnstr_flush(fout); + exit_streams(fin, fout); GDKfree(command); return; } @@ -311,6 +324,8 @@ MSscheduleClient(str command, str challe mnstr_printf(fout, "!internal server error (cannot fork new " "client thread), please try again later\n"); mnstr_flush(fout); + c->mode = FINISHING; + MCexitClient(c); showException(c->fdout, MAL, "initClient", "cannot fork new client thread"); return; } diff --git a/monetdb5/optimizer/opt_pushselect.c b/monetdb5/optimizer/opt_pushselect.c --- a/monetdb5/optimizer/opt_pushselect.c +++ b/monetdb5/optimizer/opt_pushselect.c @@ -114,7 +114,7 @@ OPTpushselectImplementation(Client cntxt mnstr_printf(cntxt->fdout,"#Push select optimizer started\n"); (void) stk; (void) pci; - vars= (int*) GDKmalloc(sizeof(int)* mb->vtop); + vars= (int*) GDKmalloc(sizeof(int)* mb->vtop); limit = mb->stop; slimit= mb->ssize; old = mb->stmt; @@ -130,8 +130,10 @@ OPTpushselectImplementation(Client cntxt if (getModuleId(p) == algebraRef && (getFunctionId(p) == tintersectRef || getFunctionId(p) == tinterRef || - getFunctionId(p) == tdifferenceRef || getFunctionId(p) == tdiffRef)) + getFunctionId(p) == tdifferenceRef || getFunctionId(p) == tdiffRef)) { + GDKfree(vars); return 0; + } if (getModuleId(p) == algebraRef && getFunctionId(p) == sliceRef) nr_topn++; diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx --- a/sql/backends/monet5/sql.mx +++ b/sql/backends/monet5/sql.mx @@ -6389,8 +6389,8 @@ sql5_export str second_interval_daytime( sql5_export str second_interval_2_daytime( daytime *res, lng *s, int *d); sql5_export str timestamp_2_daytime( daytime *res, timestamp *v, int *d); sql5_export str date_2_timestamp( timestamp *res, date *v, int *d); -str SQLcurrent_daytime(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str SQLcurrent_timestamp(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +sql5_export str SQLcurrent_daytime(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +sql5_export str SQLcurrent_timestamp(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); @c str second_interval_daytime( lng *res, daytime *s, int *d, int *sk ) 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 @@ -1103,7 +1103,7 @@ SQLstatementIntern(Client c, str *expr, * Scan the complete string for SQL statements, stop at the first error. */ c->sqlcontext = sql; - while( m->scanner.rs->pos < m->scanner.rs->len ){ + while( msg == MAL_SUCCEED && m->scanner.rs->pos < m->scanner.rs->len ){ sql_rel *r; stmt *s; int oldvtop, oldstop; diff --git a/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit b/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit --- a/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit +++ b/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Darwin.32bit @@ -29,34 +29,34 @@ Ready. (u'10/1051', 262144, 60175) (u'10/1052', 262144, 60175) (u'10/1053', 262144, 60175) -(u'10/1054', 524288, 60175) +(u'10/1054', 262144, 60175) (u'10/1055', 524288, 60175) (u'10/1056', 524288, 60175) -(u'10/1057', 60175, 60175) +(u'10/1057', 524288, 60175) (u'10/1060', 60175, 60175) -(u'10/1061', 262144, 60175) +(u'10/1061', 60175, 60175) (u'10/1062', 262144, 60175) (u'10/1063', 262144, 60175) -(u'10/1064', 60175, 60175) +(u'10/1064', 262144, 60175) (u'10/1065', 60175, 60175) -(u'10/1066', 262144, 60175) +(u'10/1066', 60175, 60175) (u'10/1067', 262144, 60175) [(u'10/1050', 0), (u'10/1051', 0), (u'10/1052', 0), (u'10/1053', 0), (u'10/1054', 0), (u'10/1055', 0), (u'10/1056', 0), (u'10/1057', 0), (u'10/1060', 0), (u'10/1061', 0), (u'10/1062', 0), (u'10/1063', 0), (u'10/1064', 0), (u'10/1065', 0), (u'10/1066', 0), (u'10/1067', 0)] (u'10/1050', 262144, 0) (u'10/1051', 262144, 0) (u'10/1052', 262144, 0) (u'10/1053', 262144, 0) -(u'10/1054', 524288, 0) +(u'10/1054', 262144, 0) (u'10/1055', 524288, 0) (u'10/1056', 524288, 0) -(u'10/1057', 60175, 0) +(u'10/1057', 524288, 0) (u'10/1060', 60175, 0) -(u'10/1061', 262144, 0) +(u'10/1061', 60175, 0) (u'10/1062', 262144, 0) (u'10/1063', 262144, 0) -(u'10/1064', 60175, 0) +(u'10/1064', 262144, 0) (u'10/1065', 60175, 0) -(u'10/1066', 262144, 0) +(u'10/1066', 60175, 0) (u'10/1067', 262144, 0) # 13:16:20 > diff --git a/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows b/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows --- a/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows +++ b/sql/benchmarks/tpch/fileleak/Tests/delete_all.stable.out.Windows @@ -29,34 +29,34 @@ Ready. (u'10\\1051', 240700, 60175) (u'10\\1052', 240700, 60175) (u'10\\1053', 240700, 60175) -(u'10\\1054', 524288, 60175) +(u'10\\1054', 240700, 60175) (u'10\\1055', 524288, 60175) (u'10\\1056', 524288, 60175) -(u'10\\1057', 60175, 60175) +(u'10\\1057', 524288, 60175) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list