Changeset: 3a917ae41c40 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3a917ae41c40 Modified Files: clients/Tests/exports.stable.out monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/mal/mal.h monetdb5/mal/mal_instruction.c monetdb5/mal/mal_instruction.h monetdb5/mal/mal_listing.c monetdb5/mal/mal_listing.h monetdb5/mal/mal_session.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.c sql/backends/monet5/sql_optimizer.c Branch: Dec2023 Log Message:
cleanup no longer used history api diffs (truncated from 310 to 300 lines): 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 @@ -810,7 +810,6 @@ int UTF8_strwidth(const char *restrict s void addMalException(MalBlkPtr mb, str msg); str addOptimizerPipe(Client cntxt, MalBlkPtr mb, const char *name); str addPipeDefinition(Client cntxt, const char *name, const char *pipe); -void addtoMalBlkHistory(MalBlkPtr mb); const char *affectedRowsRef; const char *aggrRef; const char *alarmRef; @@ -982,8 +981,6 @@ Symbol getFunctionSymbol(Module scope, I int getHgeConstant(MalBlkPtr mb, hge val); int getIntConstant(MalBlkPtr mb, int val); int getLngConstant(MalBlkPtr mb, lng val); -MalBlkPtr getMalBlkHistory(MalBlkPtr mb, int idx); -MalBlkPtr getMalBlkOptimized(MalBlkPtr mb, const char *name); Module getModule(const char *nme); void getModuleList(Module **out, int *length); BAT *getModules(void); @@ -1208,7 +1205,6 @@ const char *remapRef; const char *remoteRef; void removeInstruction(MalBlkPtr mb, InstrPtr p); void removeInstructionBlock(MalBlkPtr mb, int pc, int cnt); -void removeMalBlkHistory(MalBlkPtr mb); void renameVariables(MalBlkPtr mb); const char *rename_columnRef; const char *rename_schemaRef; @@ -1246,7 +1242,6 @@ const char *setVariableRef; void setVariableScope(MalBlkPtr mb); void setVariableType(MalBlkPtr mb, const int idx, malType type); const char *set_protocolRef; -void showMalBlkHistory(stream *out, MalBlkPtr mb); const char *singleRef; void slash_2_dir_sep(str fname); const char *sliceRef; diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c --- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c +++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c @@ -292,11 +292,8 @@ OPTsql_append(Client cntxt, MalBlkPtr mb mb = s->def; stk= 0; } - if( mb->errors ){ - /* when we have errors, we still want to see them */ - addtoMalBlkHistory(mb); + if (mb->errors) return MAL_SUCCEED; - } actions = OPTsql_appendImplementation(cntxt, mb,stk,p); /* Defense line against incorrect plans */ diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -180,10 +180,7 @@ typedef struct MALBLK { unsafeProp:1; /* unsafe property */ str errors; /* left over errors */ - struct MALBLK *history; /* of optimizer actions */ - short keephistory; /* do we need the history at all */ int maxarg; /* keep track on the maximal arguments used */ - ptr replica; /* for the replicator tests */ /* During the run we keep track on the maximum number of concurrent threads and memory claim */ ATOMIC_TYPE workers; diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -265,10 +265,6 @@ freeMalBlk(MalBlkPtr mb) GDKfree(mb->var); mb->var = 0; - if (mb->history) { - freeMalBlk(mb->history); - mb->history = NULL; - } mb->binding[0] = 0; mb->tag = 0; mb->memory = 0; @@ -295,8 +291,6 @@ copyMalBlk(MalBlkPtr old) if (mb == NULL) return NULL; mb->alternative = old->alternative; - mb->history = NULL; - mb->keephistory = old->keephistory; mb->var = (VarRecord *) GDKzalloc(sizeof(VarRecord) * old->vsize); if (mb->var == NULL) { @@ -342,7 +336,6 @@ copyMalBlk(MalBlkPtr old) mb->runtime = old->runtime; mb->calls = old->calls; mb->optimize = old->optimize; - mb->replica = old->replica; mb->maxarg = old->maxarg; mb->inlineProp = old->inlineProp; mb->unsafeProp = old->unsafeProp; @@ -359,74 +352,6 @@ copyMalBlk(MalBlkPtr old) return NULL; } -void -addtoMalBlkHistory(MalBlkPtr mb) -{ - if (mb->keephistory) { - MalBlkPtr cpy = copyMalBlk(mb); - if (cpy == NULL) - return; /* ignore history */ - cpy->history = NULL; - /* append to the linked list */ - MalBlkPtr *h = &mb->history; - while (*h) - h = &(*h)->history; - *h = cpy; - } -} - -void -removeMalBlkHistory(MalBlkPtr mb) -{ - if (mb->history) { - removeMalBlkHistory(mb->history); - freeMalBlk(mb->history); - mb->history = NULL; - } -} - -MalBlkPtr -getMalBlkHistory(MalBlkPtr mb, int idx) -{ - MalBlkPtr h = mb; - - while (h && idx-- >= 0) - h = h->history; - return h ? h : mb; -} - -/* Localize the plan using the optimizer name */ -MalBlkPtr -getMalBlkOptimized(MalBlkPtr mb, const char *name) -{ - MalBlkPtr h = mb->history; - InstrPtr p; - int i = 0; - char buf[IDLENGTH] = { 0 }, *n; - size_t nlen; - if (name == 0) - return mb; - nlen = strlen(name); - if (nlen >= sizeof(buf)) { - mb->errors = createMalException(mb, 0, TYPE, "Optimizer name is too large"); - return NULL; - } - memcpy(buf, name, nlen + 1); - n = strchr(buf, ']'); - if (n) - *n = 0; - while (h) { - for (i = 1; i < h->stop; i++) { - p = getInstrPtr(h, i); - if (p->token == REMsymbol - && strstr(getVarConstant(h, getArg(p, 0)).val.sval, buf)) - return h; - } - h = h->history; - } - return 0; -} - /* The MAL records should be managed from a pool to * avoid repeated alloc/free and reduce probability of * memory fragmentation. (todo) @@ -608,18 +533,6 @@ findVariableLength(MalBlkPtr mb, const c return -1; } -/* Note that getType also checks for type names directly. They have - * preference over variable names. */ -malType -getType(MalBlkPtr mb, const char *nme) -{ - int i; - i = findVariable(mb, nme); - if (i < 0) - return getAtomIndex(nme, strlen(nme), TYPE_any); - return getVarType(mb, i); -} - str getArgDefault(MalBlkPtr mb, InstrPtr p, int idx) { @@ -901,8 +814,8 @@ trimMalVariables_(MalBlkPtr mb, MalStkPt } } mb->vtop = cnt; - } /* rename the temporary variable */ - mb->vid = 0; /* Obsolete, name generation is postponed until needed for( i =0; i< cnt; i++) if( isTmpVar(mb,i)) (void) snprintf(getVarName(mb,i), IDLENGTH,"%c_%d", getVarKind(mb,i), mb->vid++); */ + } + mb->vid = 0; GDKfree(alias); } diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h --- a/monetdb5/mal/mal_instruction.h +++ b/monetdb5/mal/mal_instruction.h @@ -162,10 +162,6 @@ mal_export int newMalBlkStmt(MalBlkPtr m mal_export int resizeMalBlk(MalBlkPtr mb, int elements); mal_export void freeMalBlk(MalBlkPtr mb); mal_export MalBlkPtr copyMalBlk(MalBlkPtr mb); -mal_export void addtoMalBlkHistory(MalBlkPtr mb); -mal_export void removeMalBlkHistory(MalBlkPtr mb); -mal_export MalBlkPtr getMalBlkHistory(MalBlkPtr mb, int idx); -mal_export MalBlkPtr getMalBlkOptimized(MalBlkPtr mb, const char *name); mal_export void trimMalVariables(MalBlkPtr mb, MalStkPtr stk); mal_export void trimMalVariables_(MalBlkPtr mb, MalStkPtr glb); mal_export void moveInstruction(MalBlkPtr mb, int pc, int target); diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c --- a/monetdb5/mal/mal_listing.c +++ b/monetdb5/mal/mal_listing.c @@ -680,32 +680,3 @@ printSignature(stream *fd, Symbol s, int } else mnstr_printf(fd, "printSignature: " MAL_MALLOC_FAIL); } - -void -showMalBlkHistory(stream *out, MalBlkPtr mb) -{ - MalBlkPtr m = mb; - InstrPtr p = NULL, sig; - int i, j = 0; - str msg; - - sig = getInstrPtr(mb, 0); - m = m->history; - while (m) { - // find the last optimizer step - for (i = m->stop - 1; i > 0; i--) { - p = getInstrPtr(m, i); - if (p->argc > 1) - break; - } - msg = instruction2str(m, 0, p, FALSE); - if (msg) { - mnstr_printf(out, "%s.%s[%2d] %s\n", - getModuleId(sig), getFunctionId(sig), j++, msg + 3); - GDKfree(msg); - } else { - mnstr_printf(out, "#failed instruction2str()\n"); - } - m = m->history; - } -} diff --git a/monetdb5/mal/mal_listing.h b/monetdb5/mal/mal_listing.h --- a/monetdb5/mal/mal_listing.h +++ b/monetdb5/mal/mal_listing.h @@ -24,6 +24,5 @@ mal_export void traceInstruction(compone mal_export str instruction2str(MalBlkPtr mb, MalStkPtr stl, InstrPtr p, int hidden); mal_export str mal2str(MalBlkPtr mb, int first, int last); -mal_export void showMalBlkHistory(stream *out, MalBlkPtr mb); #endif /* _MAL_LIST_H */ 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 @@ -115,11 +115,6 @@ MSresetClientPrg(Client cntxt, const cha throw(MAL, "resetClientPrg", SQLSTATE(HY013) MAL_MALLOC_FAIL); setVarType(mb, findVariable(mb, fcn), TYPE_void); - /* remove any MAL history */ - if (mb->history) { - freeMalBlk(mb->history); - mb->history = 0; - } return MAL_SUCCEED; } diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c --- a/monetdb5/optimizer/opt_wrapper.c +++ b/monetdb5/optimizer/opt_wrapper.c @@ -173,7 +173,6 @@ OPTwrapper(Client cntxt, MalBlkPtr mb, M freeException(msg); return newmsg; } - addtoMalBlkHistory(mb); break; } } diff --git a/monetdb5/optimizer/optimizer.c b/monetdb5/optimizer/optimizer.c --- a/monetdb5/optimizer/optimizer.c +++ b/monetdb5/optimizer/optimizer.c @@ -73,7 +73,6 @@ QOToptimize(Client cntxt, MalBlkPtr mb, throw(MAL, "optimizer.optimize", SQLSTATE(HY002) SEMANTIC_OPERATION_MISSING); removeInstruction(mb, pci); - addtoMalBlkHistory(s->def); return optimizeMALBlock(cntxt, s->def); } diff --git a/sql/backends/monet5/sql_optimizer.c b/sql/backends/monet5/sql_optimizer.c _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org