Changeset: ce3fd1e9f40b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ce3fd1e9f40b Modified Files: monetdb5/mal/mal_debugger.c monetdb5/modules/mal/mdb.c monetdb5/optimizer/opt_mitosis.c monetdb5/optimizer/opt_mitosis.h Branch: SciQL-2 Log Message:
changed files according to the changes made in default diffs (160 lines): diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c --- a/monetdb5/mal/mal_debugger.c +++ b/monetdb5/mal/mal_debugger.c @@ -18,6 +18,7 @@ #include "mal_interpreter.h" /* for getArgReference() */ #include "mal_linker.h" /* for getAddress() */ #include "mal_listing.h" +#include "mal_function.h" #include "mal_module.h" /* for showModuleStatistics() */ #include "mal_parser.h" #include "mal_namespace.h" @@ -910,7 +911,7 @@ retryRead: } else if (isdigit((int) *b) || *b == '-' || *b == '+') goto partial; if (m) - printFunction(out, m, 0, lstng); + debugFunction(out, m, 0, lstng, 0,m->stop); } else { /* * Listing the program starts at the pc last given. @@ -932,7 +933,7 @@ partial: *b = 0; if (stepsize < 0) first -= stepsize; - listFunction(out, mb, 0, lstng, first, stepsize); + debugFunction(out, mb, 0, lstng, first, stepsize); first = first + stepsize > mb->stop ? first : first + stepsize; } continue; diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c --- a/monetdb5/modules/mal/mdb.c +++ b/monetdb5/modules/mal/mdb.c @@ -38,6 +38,7 @@ #include "monetdb_config.h" #include "mdb.h" +#include "mal_function.h" #define MDBstatus(X) \ if( stk->cmd && X==0 ) \ @@ -482,7 +483,7 @@ MDBlistDetail(Client cntxt, MalBlkPtr mb { (void) p; (void) stk; - printFunction(cntxt->fdout, mb, 0, LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS ); + debugFunction(cntxt->fdout, mb, 0, LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS, 0, mb->stop ); return MAL_SUCCEED; } @@ -496,7 +497,7 @@ MDBlist3Detail(Client cntxt, MalBlkPtr m s = findSymbol(cntxt->nspace, putName(modnme,strlen(modnme)), putName(fcnnme, strlen(fcnnme))); if (s == NULL) throw(MAL,"mdb.list","Could not find %s.%s", modnme, fcnnme); - printFunction(cntxt->fdout, s->def, 0, LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS ); + debugFunction(cntxt->fdout, s->def, 0, LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS , 0, s->def->stop); (void) mb; /* fool compiler */ return NULL; } diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c --- a/monetdb5/optimizer/opt_mitosis.c +++ b/monetdb5/optimizer/opt_mitosis.c @@ -1,9 +1,20 @@ /* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * 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 * - * Copyright 2008-2015 MonetDB B.V. + * 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-2015 MonetDB B.V. + * All Rights Reserved. */ #include "monetdb_config.h" @@ -41,6 +52,21 @@ getVarMergeTableId(MalBlkPtr mb, int v) return -1; } + +/* The plans are marked with the concurrent user load. + * * If this has changed, we may want to recompile the query + * */ +int +OPTmitosisPlanOverdue(Client cntxt, str fname) +{ + Symbol s; + + s = findSymbol(cntxt->nspace, userRef, fname); + if(s ) + return s->def->activeClients != MCactiveClients(); + return 0; +} + int OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) { @@ -51,12 +77,14 @@ OPTmitosisImplementation(Client cntxt, M size_t argsize = 6 * sizeof(lng); /* per op: 6 = (2+1)*2 <= 2 args + 1 res, each with head & tail */ int threads = GDKnr_threads ? GDKnr_threads : 1; + int activeClients; (void) cntxt; (void) stk; if (!eligible(mb)) return 0; + activeClients = mb->activeClients = MCactiveClients(); old = mb->stmt; for (i = 1; i < mb->stop; i++) { InstrPtr p = old[i]; @@ -116,19 +144,22 @@ OPTmitosisImplementation(Client cntxt, M * threads than strictly needed. * Experience shows that the pieces should not be too small. * If we should limit to |threads| is still an open issue. + * + * Take into account the number of client connections, + * because all user together are responsible for resource contentions */ - r = (wrd) (monet_memory / argsize/ MCactiveClients()); + r = (wrd) (monet_memory / argsize); /* if data exceeds memory size, * i.e., (rowcnt*argsize > monet_memory), * i.e., (rowcnt > monet_memory/argsize = r) */ - if (rowcnt > r && r / threads > 0) { + if (rowcnt > r && r / threads / activeClients > 0) { /* create |pieces| > |threads| partitions such that * |threads| partitions at a time fit in memory, * i.e., (threads*(rowcnt/pieces) <= r), * i.e., (rowcnt/pieces <= r/threads), * i.e., (pieces => rowcnt/(r/threads)) * (assuming that (r > threads*MINPARTCNT)) */ - pieces = (int) (rowcnt / (r / threads/ MCactiveClients())) + 1; + pieces = (int) (rowcnt / (r / threads / activeClients)) + 1; } else if (rowcnt > MINPARTCNT) { /* exploit parallelism, but ensure minimal partition size to * limit overhead */ diff --git a/monetdb5/optimizer/opt_mitosis.h b/monetdb5/optimizer/opt_mitosis.h --- a/monetdb5/optimizer/opt_mitosis.h +++ b/monetdb5/optimizer/opt_mitosis.h @@ -15,6 +15,7 @@ #define MINPARTCNT 100000 /* minimal record count per partition */ opt_export int OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); +opt_export int OPTmitosisPlanOverdue(Client cntxt, str fname); #define OPTDEBUGmitosis if ( optDebug & ((lng)1 <<DEBUG_OPT_MITOSIS) ) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list