Changeset: 008d288edf5a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=008d288edf5a
Added Files:
sql/test/Dependencies/Tests/view_table_udf.sql
sql/test/Dependencies/Tests/view_table_udf.stable.err
sql/test/Dependencies/Tests/view_table_udf.stable.out
Modified Files:
clients/mapiclient/eventparser.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_runtime.c
monetdb5/optimizer/Tests/manifold2.stable.out.single
sql/backends/monet5/rel_bin.c
sql/backends/monet5/rel_bin.h
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_user.c
sql/server/rel_optimizer.c
sql/server/rel_optimizer.h
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_partition.c
sql/storage/sql_storage.h
sql/storage/store.c
sql/test/Dependencies/Tests/All
sql/test/Dependencies/Tests/Dependencies.stable.out
sql/test/Dependencies/Tests/Dependencies.stable.out.int128
sql/test/Dependencies/Tests/dependency_loop.stable.out
sql/test/Dependencies/Tests/dependency_loop.stable.out.int128
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/merge-partitions/Tests/mergepart21.stable.err
sql/test/mergetables/Tests/sqlsmith.Bug-6459.sql
sql/test/mergetables/Tests/sqlsmith.Bug-6472.sql
sql/test/mergetables/Tests/sqlsmith.Bug-6472.stable.out
sql/test/sys-schema/Tests/check_MaxStrLength_violations.sql
sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out
Branch: grouping-analytics
Log Message:
Merge with default
diffs (truncated from 3668 to 300 lines):
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -205,12 +205,13 @@ keyvalueparser(char *txt, EventRecord *e
*c = 0;
} else val =c;
- if( strstr(key,"clk")){
+ if( strstr(key,"ctime")){
ev->usec = atol(val);
return 0;
}
- if( strstr(key,"ctime")){
+ if( strstr(key,"clk")){
time_t sec;
+ uint64_t microsec;
struct tm curr_time;
c = strchr(val,'.');
@@ -220,16 +221,17 @@ keyvalueparser(char *txt, EventRecord *e
}
sec = atol(val);
+ microsec = sec % 1000000;
+ sec /= 1000000;
#ifdef HAVE_LOCALTIME_R
(void)localtime_r(&sec, &curr_time);
#else
curr_time = *localtime(&sec);
#endif
ev->time = malloc(DATETIME_CHAR_LENGTH*sizeof(char));
- snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d
%02d:%02d:%02d.%s",
+ snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d
%02d:%02d:%02d.%"PRIu64,
curr_time.tm_year + 1900, curr_time.tm_mon,
curr_time.tm_mday,
- curr_time.tm_hour, curr_time.tm_min,
curr_time.tm_sec,
- c);
+ curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec,
microsec);
ev->clkticks = sec * 1000000;
if (c != NULL) {
int64_t usec;
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -560,13 +560,6 @@ str runMALsequence(Client cntxt, MalBlkP
lastcheck = runtimeProfile.ticks;
}
- // runtimeProfileBegin already sets the time in the instruction
- if (cntxt->qtimeout && runtimeProfile.ticks - mb->starttime >
cntxt->qtimeout) {
- freeException(ret); /* in case it's set */
- ret = createException(MAL, "mal.interpreter",
SQLSTATE(HYT00) RUNTIME_QRY_TIMEOUT);
- break;
- }
-
/* The interpreter loop
* The interpreter is geared towards execution a MAL
* procedure together with all its descendant
@@ -795,6 +788,13 @@ str runMALsequence(Client cntxt, MalBlkP
} else {
ret = createException(MAL,"interpreter",
"failed instruction2str");
}
+ // runtimeProfileBegin already sets the time in the
instruction
+ if (cntxt->qtimeout && mb->starttime && GDKusec()-
mb->starttime > cntxt->qtimeout){
+ freeException(ret); /* in case it's set */
+ ret = createException(MAL, "mal.interpreter",
SQLSTATE(HYT00) RUNTIME_QRY_TIMEOUT);
+ break;
+ }
+
stkpc= mb->stop;
continue;
} }
@@ -911,6 +911,8 @@ str runMALsequence(Client cntxt, MalBlkP
/* unknown exceptions lead to propagation */
if (exceptionVar == -1) {
+ if (cntxt->qtimeout && mb->starttime && GDKusec()-
mb->starttime > cntxt->qtimeout)
+ ret= createException(MAL, "mal.interpreter",
SQLSTATE(HYT00) RUNTIME_QRY_TIMEOUT);
stkpc = mb->stop;
continue;
}
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -34,9 +34,13 @@
static str myname = 0; // avoid tracing the profiler module
/* The JSON rendering can be either using '\n' separators between
- * each key:value pair or as a single line */
-//#define PRETTIFY "\n"
-#define PRETTIFY
+ * each key:value pair or as a single line.
+ * The current stethoscope implementation requires the first option and
+ * also the term rendering PRET to be set to ''
+ */
+
+#define PRETTIFY "\n"
+//#define PRETTIFY
/* When the MAL block contains a BARRIER block we may end up with tons
* of profiler events. To avoid this, we stop emitting the events
@@ -149,14 +153,14 @@ renderProfilerEvent(Client cntxt, MalBlk
return;
}
-/* The stream of events can be complete read by the DBA,
+/* The stream of events can be complete read by the DBA,
* all other users can only see events assigned to their account
*/
if( malprofileruser!= MAL_ADMIN && malprofileruser != cntxt->user)
return;
usec= GDKusec();
- microseconds = (uint64_t)startup_time.tv_sec*1000000 +
(uint64_t)startup_time.tv_usec + (uint64_t)usec;
+ microseconds = (uint64_t)usec - ((uint64_t)startup_time.tv_sec*1000000
- (uint64_t)startup_time.tv_usec);
/* make profile event tuple */
lognew();
logadd("{"PRETTIFY); // fill in later with the event counter
@@ -166,7 +170,7 @@ renderProfilerEvent(Client cntxt, MalBlk
logadd("\"version\":\""VERSION" (hg id: %s)\","PRETTIFY,
mercurial_revision());
logadd("\"source\":\"trace\","PRETTIFY);
- logadd("\"oid\":"OIDFMT","PRETTIFY, cntxt->user);
+ logadd("\"user_id\":"OIDFMT","PRETTIFY, cntxt->user);
logadd("\"clk\":"LLFMT","PRETTIFY, usec);
logadd("\"ctime\":%"PRIu64","PRETTIFY, microseconds);
logadd("\"thread\":%d,"PRETTIFY, THRgettid());
@@ -313,7 +317,7 @@ renderProfilerEvent(Client cntxt, MalBlk
This information can be used to determine memory footprint and variable life
times.
*/
-#define PRET
+#define PRET
#ifdef MALARGUMENTDETAILS
// Also show details of the arguments for modelling
if(mb){
@@ -532,9 +536,9 @@ profilerEvent(Client cntxt, MalBlkPtr mb
if( maleventstream) {
renderProfilerEvent(cntxt, mb, stk, pci, start);
- if ( start && pci->pc ==0)
+ if ( !start && pci->pc ==0)
profilerHeartbeatEvent("ping");
- if ( !start && pci->token == ENDsymbol)
+ if ( start && pci->token == ENDsymbol)
profilerHeartbeatEvent("ping");
}
}
@@ -726,7 +730,7 @@ getTrace(Client cntxt, const char *nme)
void
clearTrace(Client cntxt)
{
- (void) cntxt;
+ (void) cntxt;
MT_lock_set(&mal_profileLock);
if (cntxt->profticks == NULL) {
MT_lock_unset(&mal_profileLock);
@@ -773,8 +777,8 @@ sqlProfilerEvent(Client cntxt, MalBlkPtr
if (errors > 0) {
/* stop profiling if an error occurred */
cntxt->sqlprofiler = FALSE;
- }
-
+ }
+
MT_lock_unset(&mal_profileLock);
GDKfree(stmt);
}
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -108,8 +108,6 @@ runtimeProfileInit(Client cntxt, MalBlkP
stk->tag = QRYqueue[i].tag;
qtop += i == qtop;
MT_lock_unset(&mal_delayLock);
- /* When you start a routine, also emit a heartbeat */
- profilerHeartbeatEvent("wait");
}
/* We should keep a short list of previously executed queries/client for
inspection */
@@ -142,8 +140,6 @@ runtimeProfileFinish(Client cntxt, MalBl
qtop = j;
QRYqueue[qtop].query = NULL; /* sentinel for SYSMONqueue() */
MT_lock_unset(&mal_delayLock);
- /* When you exit a routine, also emit a heartbeat */
- profilerHeartbeatEvent("wait");
}
void
diff --git a/monetdb5/optimizer/Tests/manifold2.stable.out.single
b/monetdb5/optimizer/Tests/manifold2.stable.out.single
--- a/monetdb5/optimizer/Tests/manifold2.stable.out.single
+++ b/monetdb5/optimizer/Tests/manifold2.stable.out.single
@@ -32,7 +32,7 @@ function user.tst(b:bat[:dbl], b2:bat[:d
barrier (X_6:oid, X_7:dbl) := iterator.new(b:bat[:dbl]); #[4] (0)
ITRbunIterator 12 13 <- 1
X_9:dbl := algebra.fetch(b2:bat[:dbl], X_6:oid); #[5] (0) ALGfetchoid 15
<- 2 12
X_11:dbl := calc.max(X_7:dbl, X_9:dbl); #[6] (0) CALCmax 17 <- 13 15
- bat.append(X_3:bat[:dbl], X_11:dbl); #[7] (0) BKCappend_val_wrap 18
<- 9 17
+ X_3:bat[:dbl] := bat.append(X_3:bat[:dbl], X_11:dbl); #[7] (0)
BKCappend_val_wrap 9 <- 9 17
redo (X_6:oid, X_7:dbl) := iterator.next(b:bat[:dbl]); #[8] (0)
ITRbunNext 12 13 <- 1
exit (X_6:oid, X_7:dbl); #[9] (0) 12 13
z:bat[:dbl] := X_3:bat[:dbl]; #[10] (0) 5 <- 9
@@ -57,7 +57,7 @@ function user.tst(b:bat[:dbl], b2:bat[:d
barrier (X_6:oid, X_7:dbl) := iterator.new(b:bat[:dbl]); #[4] (0)
ITRbunIterator 12 13 <- 1
X_9:dbl := algebra.fetch(b2:bat[:dbl], X_6:oid); #[5] (0) ALGfetchoid 15
<- 2 12
X_11:dbl := calc.max(X_7:dbl, X_9:dbl); #[6] (0) CALCmax 17 <- 13 15
- bat.append(X_3:bat[:dbl], X_11:dbl); #[7] (0) BKCappend_val_wrap 18
<- 9 17
+ X_3:bat[:dbl] := bat.append(X_3:bat[:dbl], X_11:dbl); #[7] (0)
BKCappend_val_wrap 9 <- 9 17
redo (X_6:oid, X_7:dbl) := iterator.next(b:bat[:dbl]); #[8] (0)
ITRbunNext 12 13 <- 1
exit (X_6:oid, X_7:dbl); #[9] (0) 12 13
z:bat[:dbl] := X_3:bat[:dbl]; #[10] (0) 5 <- 9
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -5722,241 +5722,3 @@ output_rel_bin(backend *be, sql_rel *rel
}
return s;
}
-
-static int exp_deps(mvc *sql, sql_exp *e, list *refs, list *l);
-
-static int
-exps_deps(mvc *sql, list *exps, list *refs, list *l)
-{
- node *n;
-
- for(n = exps->h; n; n = n->next) {
- if (exp_deps(sql, n->data, refs, l) != 0)
- return -1;
- }
- return 0;
-}
-
-static int
-id_cmp(int *id1, int *id2)
-{
- if (*id1 == *id2)
- return 0;
- return -1;
-}
-
-static list *
-cond_append(list *l, int *id)
-{
- if (*id >= 2000 && !list_find(l, id, (fcmp) &id_cmp))
- list_append(l, id);
- return l;
-}
-
-static int rel_deps(mvc *sql, sql_rel *r, list *refs, list *l);
-
-static int
-exp_deps(mvc *sql, sql_exp *e, list *refs, list *l)
-{
- if (THRhighwater()) {
- (void) sql_error(sql, 10, SQLSTATE(42000) "query too complex:
running out of stack space");
- return -1;
- }
-
- switch(e->type) {
- case e_psm:
- if (e->flag & PSM_SET || e->flag & PSM_RETURN) {
- return exp_deps(sql, e->l, refs, l);
- } else if (e->flag & PSM_VAR) {
- return 0;
- } else if (e->flag & PSM_WHILE || e->flag & PSM_IF) {
- if (exp_deps(sql, e->l, refs, l) != 0 ||
- exps_deps(sql, e->r, refs, l) != 0)
- return -1;
- if (e->flag == PSM_IF && e->f)
- return exps_deps(sql, e->r, refs, l);
- } else if (e->flag & PSM_REL) {
- sql_rel *rel = e->l;
- return rel_deps(sql, rel, refs, l);
- } else if (e->flag & PSM_EXCEPTION) {
- return exps_deps(sql, e->l, refs, l);
- }
- case e_atom:
- case e_column:
- break;
- case e_convert:
- return exp_deps(sql, e->l, refs, l);
- case e_func: {
- sql_subfunc *f = e->f;
-
- if (e->l && exps_deps(sql, e->l, refs, l) != 0)
- return -1;
- cond_append(l, &f->func->base.id);
- if (e->l && list_length(e->l) == 2 &&
strcmp(f->func->base.name, "next_value_for") == 0) {
- /* add dependency on seq nr */
- list *nl = e->l;
- sql_exp *schname = nl->h->data;
- sql_exp *seqname = nl->t->data;
-
- char *sch_name =
((atom*)schname->l)->data.val.sval;
- char *seq_name =
((atom*)seqname->l)->data.val.sval;
- sql_schema *sche = mvc_bind_schema(sql,
sch_name);
- sql_sequence *seq = find_sql_sequence(sche,
seq_name);
-
- cond_append(l, &seq->base.id);
- }
- } break;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list