Changeset: 673282da16ee for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=673282da16ee Added Files: monetdb5/modules/mal/Tests/cpustat.mal monetdb5/modules/mal/querylog.c monetdb5/modules/mal/querylog.h monetdb5/modules/mal/querylog.mal monetdb5/optimizer/opt_querylog.c monetdb5/optimizer/opt_querylog.h sql/scripts/15_querylog.sql sql/test/BugTracker-2009/Tests/multi-column_join_with_expression.SF-2783279.sql sql/test/BugTracker-2013/Tests/select-view-view.Bug-3245.sql sql/test/BugTracker-2013/Tests/select-view-view.Bug-3245.stable.err sql/test/BugTracker-2013/Tests/select-view-view.Bug-3245.stable.out sql/test/bugs/Tests/emili.sql sql/test/bugs/Tests/emili.stable.err sql/test/bugs/Tests/emili.stable.out sql/test/bugs/Tests/polymorphism.sql sql/test/bugs/Tests/polymorphism.stable.err sql/test/bugs/Tests/polymorphism.stable.out Removed Files: monetdb5/optimizer/opt_history.c monetdb5/optimizer/opt_history.h sql/scripts/15_history.sql sql/test/BugTracker-2009/Tests/multi-column_join_with_expression.SF-2783279.csv sql/test/BugTracker-2009/Tests/multi-column_join_with_expression.SF-2783279.sql.in Modified Files: NT/installer32/MonetDB5-SQL-Installer.vdproj NT/installer64/MonetDB5-SQL-Installer.vdproj clients/Tests/exports.stable.out clients/python2/monetdb/control.py clients/python2/monetdb/sql/converters.py clients/python2/monetdb/sql/cursors.py clients/python2/monetdb/sql/monetize.py clients/python2/test/capabilities.py clients/python2/test/control.py clients/python2/test/dbapi20.py clients/python2/test/test_control.py clients/python3/monetdb/control.py clients/python3/monetdb/sql/converters.py clients/python3/monetdb/sql/cursors.py clients/python3/monetdb/sql/monetize.py clients/python3/test/capabilities.py clients/python3/test/run.sh clients/python3/test/runtests.py clients/python3/test/test_control.py gdk/gdk_batop.c gdk/gdk_join.c gdk/gdk_logger.c gdk/gdk_relop.mx monetdb5/ChangeLog.Feb2013 monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out monetdb5/mal/mal_authorize.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_profiler.h monetdb5/mal/mal_runtime.c monetdb5/mal/mal_runtime.h monetdb5/mal/mal_stack.h monetdb5/modules/mal/Makefile.ag monetdb5/modules/mal/Tests/All monetdb5/modules/mal/Tests/clients01.mal monetdb5/modules/mal/clients.c monetdb5/modules/mal/clients.h monetdb5/modules/mal/clients.mal monetdb5/modules/mal/mal_init.mal monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/profiler.h monetdb5/modules/mal/profiler.mal monetdb5/optimizer/Makefile.ag monetdb5/optimizer/Tests/dataflow3.mal monetdb5/optimizer/opt_pipes.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_support.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.mal monetdb5/tools/Tests/mserver5--help.stable.err sql/backends/monet5/UDF/Tests/udf-fuse.stable.out sql/backends/monet5/UDF/Tests/udf-reverse.stable.out sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.mx sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_optimizer.c sql/common/sql_types.c sql/include/sql_catalog.h sql/jdbc/tests/Tests/Test_Dobjects.stable.out sql/jdbc/tests/Tests/Test_JdbcClient.stable.out sql/scripts/Makefile.ag sql/server/rel_optimizer.c sql/server/rel_select.c sql/server/sql_env.c sql/server/sql_env.h sql/server/sql_mvc.c sql/storage/bat/bat_storage.c sql/storage/store.c sql/test/BugConstraints/Tests/add_constraint_1643522.stable.err sql/test/BugConstraints/Tests/add_constraint_1643522.stable.out 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/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out sql/test/BugTracker-2008/Tests/sql_command_kills_db.SF-2233677.stable.err sql/test/BugTracker-2009/Tests/All sql/test/BugTracker-2009/Tests/POWER_vs_prod.SF-2596114.stable.out sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out sql/test/BugTracker-2009/Tests/reorder.SF-2770608.sql sql/test/BugTracker-2009/Tests/table-leftovers.SF-2779462.sql sql/test/BugTracker-2009/Tests/use_order_column_first.SF-2686008.stable.out sql/test/BugTracker-2011/Tests/copy-into-file-error.Bug-2722.stable.out sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.stable.out sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out sql/test/BugTracker-2011/Tests/func_iter_vs_bulk.Bug-2826.stable.out sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out sql/test/BugTracker-2012/Tests/aggregate_vs_positional_column_crash.Bug-3085.stable.out sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.err sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart-0.Bug-3063.stable.out sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart-1.Bug-3063.stable.out sql/test/BugTracker-2013/Tests/All sql/test/BugTracker/Tests/explain.SF-1739353.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit sql/test/BugTracker/Tests/multi-column-constraint.SF-1964587.stable.out sql/test/BugTracker/Tests/rank_over.SF-1691098.stable.out sql/test/BugTracker/Tests/with_only_once.SF-1720293.stable.out sql/test/Dependencies/Tests/Dependencies.stable.err sql/test/Dependencies/Tests/Dependencies.stable.out sql/test/Dependencies/Tests/dependency_loop.stable.out sql/test/DropCascade/Tests/drop_columns_cascade.stable.out sql/test/DropCascade/Tests/drop_pkey_cascade.stable.out sql/test/Dump/Tests/dump-empty.stable.out sql/test/Dump/Tests/dump.stable.out sql/test/Dump/Tests/dump.stable.out.Windows sql/test/Tests/keys.stable.out sql/test/Tests/setoptimizer.stable.err sql/test/Tests/setoptimizer.stable.out sql/test/Tests/systemfunctions.stable.out sql/test/UserDump/Tests/create.stable.out sql/test/bugs/Tests/All sql/test/bugs/Tests/crash_order_by.stable.out sql/test/bugs/Tests/groupby_having_charlength-bug-sf-943566.stable.out sql/test/bugs/Tests/insert_delete-bug-sf-904025.stable.out sql/test/bugs/Tests/simple_view.stable.out sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out sql/test/concurrent/Tests/crash_on_concurrent_use.SF-1411926.stable.out sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/mapi/Tests/php_monetdb.stable.out sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err sql/test/setoptimizer.sql sql/test/testdb/Tests/testdb-dump.stable.out sql/test/testdb/Tests/testdb-dump.stable.out.Windows tools/mserver/mserver5.1 tools/mserver/mserver5.c Branch: sciql Log Message:
merged from default diffs (truncated from 7394 to 300 lines): diff --git a/NT/installer32/MonetDB5-SQL-Installer.vdproj b/NT/installer32/MonetDB5-SQL-Installer.vdproj --- a/NT/installer32/MonetDB5-SQL-Installer.vdproj +++ b/NT/installer32/MonetDB5-SQL-Installer.vdproj @@ -3629,8 +3629,8 @@ } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_E13B077DCC48449BBB7679B67C003143" { - "SourcePath" = "8:lib\\monetdb5\\createdb\\15_history.sql" - "TargetName" = "8:15_history.sql" + "SourcePath" = "8:lib\\monetdb5\\createdb\\15_querylog.sql" + "TargetName" = "8:15_querylog.sql" "Tag" = "8:" "Folder" = "8:_7F962DDBDF894636B6CAFE6FE4887567" "Condition" = "8:" diff --git a/NT/installer64/MonetDB5-SQL-Installer.vdproj b/NT/installer64/MonetDB5-SQL-Installer.vdproj --- a/NT/installer64/MonetDB5-SQL-Installer.vdproj +++ b/NT/installer64/MonetDB5-SQL-Installer.vdproj @@ -2069,8 +2069,8 @@ } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5F72DF110CF843B188EFA0A1BEB1872C" { - "SourcePath" = "8:lib\\monetdb5\\createdb\\15_history.sql" - "TargetName" = "8:15_history.sql" + "SourcePath" = "8:lib\\monetdb5\\createdb\\15_querylog.sql" + "TargetName" = "8:15_querylog.sql" "Tag" = "8:" "Folder" = "8:_7F962DDBDF894636B6CAFE6FE4887567" "Condition" = "8:" diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1133,7 +1133,7 @@ str CLS_split(Client cntxt, MalBlkPtr mb str CLTActions(int *ret); str CLTInfo(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CLTLastCommand(int *ret); -str CLTLogin(int *ret); +str CLTLogin(int *ret, int *nme); str CLTTime(int *ret); str CLTaddUser(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CLTbackendsum(str *ret, str *pw); @@ -1286,6 +1286,8 @@ str CMDconvertsignal_oid(Client cntxt, M str CMDconvertsignal_sht(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CMDconvertsignal_str(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CMDconvertsignal_wrd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +str CMDcpuloadPercentage(int *cycles, int *io, lng *user, lng *nice, lng *sys, lng *idle, lng *iowait); +str CMDcpustats(lng *user, lng *nice, lng *sys, lng *idle, lng *iowait); str CMDdeactivateProfiler(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str CMDdebug(int *ret, int *flg); str CMDdumpTrace(int *res); @@ -1798,10 +1800,8 @@ int OPTdumpQEPImplementation(Client cntx int OPTemptySetImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTevaluateImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTfactorizeImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str OPTforgetPrevious(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTgarbageCollectorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTgroupsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); -int OPThistoryImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTinlineImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTisAlias(InstrPtr p); int OPTjoinPathImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); @@ -1823,6 +1823,7 @@ str OPTpeers(Client cntxt, MalBlkPtr mb, int OPTprejoinImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTpushrangesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +int OPTquerylogImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTrecyclerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTreduceImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTremapImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); @@ -2015,6 +2016,16 @@ sht PropertyIndex(str name); str PropertyName(sht idx); prop_op_t PropertyOperator(str s); str PropertyOperatorString(prop_op_t op); +str QLOGcall(int *ret, oid *idx, lng *tick1, lng *tick2, str *arg, wrd *tuples, lng *xtime, lng *rtime, int *cpu, int *iowait, lng *space); +void QLOGcalls(BAT **r); +void QLOGcatalog(BAT **r); +str QLOGdefine(oid *ret, oid *idx, str *q, str *pipe, lng *optimize, str *usr, lng *tick); +str QLOGdone(int *ret); +str QLOGinit(int *ret); +str QLOGinitThreshold(int *ret, int *threshold); +int QLOGisset(void); +str QLOGissetFcn(int *ret); +str QLOGreset(int *ret); str QOTclrdebugOptimizers(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str QOTdebugOptimizers(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str QOTgetStatistics(int *ret, str *nme); @@ -2508,6 +2519,7 @@ str differenceRef; int discardBox(Box box, str name); str disconnectRef; int displayModule(stream *f, Module v, str fcn, int listing); +void displayVolume(Client cntxt, lng vol); str divRef; void dumpExceptionsToStream(stream *out, str msg); void dumpHelpTable(stream *f, Module s, str text, int flag); @@ -2605,6 +2617,7 @@ str getTypeName(malType tpe); lng getUserTime(void); str getVarName(MalBlkPtr mb, int i); wrd getVarRows(MalBlkPtr mb, int v); +lng getVolume(MalStkPtr stk, InstrPtr pci, int rd); MalBlkPtr gotoMalBlkMarker(MalBlkPtr mb, str marker); str grabRef; str groupRef; @@ -2633,6 +2646,7 @@ void initLibraries(void); void initNamespace(void); void initParser(void); void initProfiler(MalBlkPtr mb); +int initQlog(void); int inlineMALblock(MalBlkPtr mb, int pc, MalBlkPtr mc); int inlineProp; str inplaceRef; @@ -2753,6 +2767,7 @@ MT_Sema mal_parallelism; MT_Lock mal_profileLock; str mal_quote(const char *msg, size_t size); MT_Lock mal_remoteLock; +char *mal_trace; void mal_unquote(char *msg); str mapiRef; str markHRef; @@ -2920,6 +2935,7 @@ void printTraceCall(stream *out, MalBlkP str prodRef; int profilerAvailable(void); void profilerEvent(int idx, MalBlkPtr mb, MalStkPtr stk, int pc, int start); +void profilerGetCPUStat(lng *user, lng *nice, lng *sys, lng *idle, lng *iowait); void profilerHeartbeatEvent(str msg); str profilerRef; str projectRef; @@ -2949,6 +2965,7 @@ InstrPtr pushZero(MalBlkPtr mb, InstrPtr str putName(str nme, size_t len); str putRef; str queryRef; +str querylogRef; str rankRef; str rank_grpRef; int rcachePolicy; @@ -3004,6 +3021,9 @@ str runMALdataflow(Client cntxt, MalBlkP str runMALsequence(Client cntxt, MalBlkPtr mb, int startpc, int stoppc, MalStkPtr stk, MalStkPtr env, InstrPtr pcicaller); str runScenario(Client c); int runonceProp; +void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int stkpc, RuntimeProfile prof, int start); +void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, RuntimeProfile prof); +void runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof, int initmemory); str safeguardStack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int safetyBarrier(InstrPtr p, InstrPtr q); int saveBox(Box box, int flag); @@ -3018,6 +3038,7 @@ void setArgType(MalBlkPtr mb, InstrPtr p InstrPtr setArgument(MalBlkPtr mb, InstrPtr p, int idx, int varid); str setEndPoint(Module cntxt, str mod, str fcn); void setFilter(Module cntxt, str mod, str fcn); +void setFilterAll(void); void setFilterOnBlock(MalBlkPtr mb, str mod, str fcn); void setFilterVariable(MalBlkPtr mb, int i); Module setInheritance(Module head, Module first, Module second); @@ -3159,6 +3180,7 @@ str unpackRef; str unpinRef; int unsafeProp; void updateBigFoot(Client cntxt, int bid, int add); +void updateFootPrint(MalBlkPtr mb, MalStkPtr stk, int varid); str updateRef; void updateScenario(str scen, str nme, MALfcn fcn); int updatesProp; diff --git a/clients/python2/monetdb/control.py b/clients/python2/monetdb/control.py --- a/clients/python2/monetdb/control.py +++ b/clients/python2/monetdb/control.py @@ -1,39 +1,83 @@ from monetdb import mapi +from monetdb.exceptions import OperationalError, InterfaceError + def parse_statusline(line): - split = line.split(',') + """ + parses a sabdb format status line. Support v1 and v2. + + """ + if not line.startswith('=sabdb:'): + raise OperationalError('wrong result recieved') + + prot_version, rest = line.split(":", 2)[1:] + + if prot_version not in ["1", "2"]: + raise InterfaceError("unsupported sabdb protocol") + else: + prot_version = int(prot_version) + + subparts = rest.split(',') + sub_iter = iter(subparts) info = {} - info['path'] = split[0] - info['name'] = info['path'].split("/")[-1] - info['locked'] = split[1] == ("1") - info['state'] = int(split[2]) - info['scenarios'] = split[3].split("'") - info['connections'] = split[4].split("'") - info['start_counter'] = int(split[5]) - info['stop_counter'] = int(split[6]) - info['crash_counter'] = int(split[7]) - info['avg_uptime'] = int(split[8]) - info['max_uptime'] = int(split[9]) - info['min_uptime'] = int(split[10]) - info['last_crash'] = int(split[11]) - info['lastStart'] = int(split[12]) - info['crash_avg1'] = split[13] == ("1") - info['crash_avg10'] = float(split[14]) - info['crash_avg30'] = float(split[15]) + + info['name'] = sub_iter.next() + info['path'] = sub_iter.next() + info['locked'] = sub_iter.next() == "1" + info['state'] = int(sub_iter.next()) + info['scenarios'] = sub_iter.next().split("'") + if prot_version == 1: + sub_iter.next() + info['start_counter'] = int(sub_iter.next()) + info['stop_counter'] = int(sub_iter.next()) + info['crash_counter'] = int(sub_iter.next()) + info['avg_uptime'] = int(sub_iter.next()) + info['max_uptime'] = int(sub_iter.next()) + info['min_uptime'] = int(sub_iter.next()) + info['last_crash'] = int(sub_iter.next()) + info['last_start'] = int(sub_iter.next()) + if prot_version > 1: + info['last_stop'] = int(sub_iter.next()) + info['crash_avg1'] = sub_iter.next() == "1" + info['crash_avg10'] = float(sub_iter.next()) + info['crash_avg30'] = float(sub_iter.next()) + return info + +def isempty(result): + """ raises an exception if the result is not empty""" + if result != "": + raise OperationalError(result) + else: + return True + + class Control: """ - Use this module to manage your MonetDB databases. You can create, start, stop, - lock, unlock, destroy your databases and request status information. + Use this module to manage your MonetDB databases. You can create, start, + stop, lock, unlock, destroy your databases and request status information. """ def __init__(self, hostname, port, passphrase): self.server = mapi.Connection() - self.server.connect(hostname, port, 'monetdb', passphrase, 'merovingian', 'control') + self.hostname = hostname + self.port = port + self.passphrase = passphrase + + # check connection + self.server.connect(hostname, port, 'monetdb', passphrase, + 'merovingian', 'control') + self.server.disconnect() def _send_command(self, database_name, command): - return self.server.cmd("%s %s\n" % (database_name, command)) + self.server.connect(self.hostname, self.port, 'monetdb', + self.passphrase, 'merovingian', 'control') + try: + return self.server.cmd("%s %s\n" % (database_name, command)) + finally: + # always close connection + self.server.disconnect() def create(self, database_name): """ @@ -41,7 +85,7 @@ class Control: A database created with this command makes it available for use, however in maintenance mode (see monetdb lock). """ - return self._send_command(database_name, "create") + return isempty(self._send_command(database_name, "create")) def destroy(self, database_name): """ @@ -49,7 +93,7 @@ class Control: logfiles. Once destroy has completed, all data is lost. Be careful when using this command. """ - return self._send_command(database_name, "destroy") + return isempty(self._send_command(database_name, "destroy")) def lock(self, database_name): """ @@ -59,7 +103,7 @@ class Control: automatically. Use the "release" command to bring the database back for normal usage. """ - return self._send_command(database_name, "lock") + return isempty(self._send_command(database_name, "lock")) def release(self, database_name): """ @@ -67,7 +111,7 @@ class Control: database is available again for normal use. Use the "lock" command to take a database under maintenance. """ - return self._send_command(database_name, "release") _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list