Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7564
Modified Files:
Makefile.ag sql.mx sql_gencode.mx sql_optimizer.mx
sql_scenario.mx
Removed Files:
sql_cache.mx
Log Message:
The cached SQL programs are stored as of now in the private
module for each client, called 'user'.
This way we can clean out the cache more easily.
Index: sql_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_scenario.mx,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -d -r1.256 -r1.257
--- sql_scenario.mx 1 Apr 2007 22:08:56 -0000 1.256
+++ sql_scenario.mx 7 Apr 2007 21:09:08 -0000 1.257
@@ -55,6 +55,7 @@
sql5_export str SQLstatement(int *ret, str *expr);
sql5_export str SQLcompile(str *ret, str *expr);
sql5_export str SQLtrace(int *ret);
+sql5_export str SQLCacheRemove(Client c, str nme);
#endif /* _SQL_SCENARIO_H_ */
@@ -68,7 +69,6 @@
#include "sql_result.h"
#include "sql_gencode.h"
#include "sql_optimizer.h"
-#include "sql_cache.h"
#include "sql_env.h"
#include "sql_mvc.h"
#include "sql_readline.h"
@@ -101,13 +101,10 @@
static void
monet5_freecode(backend_code code, backend_stack stk, int nr, char *name)
{
- int ret = 0;
-
(void) code;
(void) stk;
(void) nr;
- SQLCacheRemove(&ret, &name);
- (void) ret;
+ SQLCacheRemove(MCgetClient(), name);
#ifdef _SQL_SCENARIO_DEBUG
stream_printf(GDKout, "#monet5_free:%d\n", nr);
@@ -510,7 +507,7 @@
Symbol oldsym= c->curprg;
stmt *s = sql_symbol2stmt(m, m->sym);
- MSinitClientPrg(c,"sql_cache",nme);
+ MSinitClientPrg(c,"user",nme);
if (!s && (err = mvc_status(m))) {
stream_printf(c->fdout, "%s\n", m->errstr);
if( m->errstr)
@@ -1275,8 +1272,7 @@
mb= c->curprg->def;
if( be->q && mb &&
fndArgProperty(mb, (p=
getInstrPtr(mb,0)),0,putName("runonce",7)) ){
- int ret;
- SQLCacheRemove(&ret, &getFunctionId(p));
+ SQLCacheRemove(c, getFunctionId(p));
/* this should invalidate any match */
be->q->key= -1;
be->q->paramlen = -1;
@@ -1308,12 +1304,11 @@
SQLrecompile(Client c, backend *be)
{
stmt *s;
- int ret = 0;
mvc *m = be->mvc;
int oldvtop = c->curprg->def->vtop;
int oldstop = c->curprg->def->stop;
- SQLCacheRemove(&ret, &be->q->name);
+ SQLCacheRemove(c, be->q->name);
s = sql_symbol2stmt(m, be->q->s);
be->q->code = (backend_code)backend_dumpproc(be, c, be->q, s);
be->q->stk = 0;
@@ -1370,3 +1365,22 @@
throw(SQL, "assert", *msg);
return MAL_SUCCEED;
}
+
+str
+SQLCacheRemove(Client c, str nme)
+{
+ Symbol s;
+
+#ifdef _SQL_CACHE_DEBUG
+ stream_printf(GDKout, "SQLCacheRemove %s\n", nme);
+#endif
+
+ s= findSymbolInModule(c->nspace, nme);
+ if (s == NULL)
+ throw(MAL, "cache.remove", "internal error, symbol missing\n");
+ if( getInstrPtr(s->def,0)->token == FACTORYsymbol)
+ shutdownFactoryByName(c->nspace, nme);
+ else
+ deleteSymbol(c->nspace,s);
+ return MAL_SUCCEED;
+}
Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -d -r1.238 -r1.239
--- sql_gencode.mx 1 Apr 2007 22:08:55 -0000 1.238
+++ sql_gencode.mx 7 Apr 2007 21:09:08 -0000 1.239
@@ -104,17 +104,14 @@
static str exportValueRef;
static str exportResultRef;
static str exportOperationRef;
-static str sql_cacheRef;
void initSQLreferences(void){
optimizerInit();
exportValueRef = putName("exportValue",11);
exportResultRef= putName("exportResult",12);
exportOperationRef= putName("exportOperation",15);
- sql_cacheRef= putName("sql_cache",9);
if( algebraRef==NULL || exportValueRef==NULL ||
- exportResultRef==NULL || exportOperationRef==NULL ||
- sql_cacheRef== NULL)
+ exportResultRef==NULL || exportOperationRef==NULL )
GDKfatal("error initSQLreferences");
}
@-
@@ -1896,7 +1893,7 @@
/* we do not return anything */
setVarType(curBlk, 0, TYPE_void);
freezeVarType(curBlk,0);
- setModuleId(curInstr, sql_cacheRef);
+ setModuleId(curInstr, putName("user",4));
if (be->mvc->argc) {
for (argc = 0; argc < m->argc; argc++) {
@@ -1963,7 +1960,7 @@
InstrPtr q;
MalBlkPtr mb = c->curprg->def;
- q = newStmt2(mb, sql_cacheRef, cq->name);
+ q = newStmt2(mb, putName("user",4), cq->name);
/* cached (factorized queries return bit??) */
if (getInstrPtr(((Symbol)cq->code)->def, 0)->token == FACTORYsymbol ) {
setVarType(mb, getArg(q, 0), TYPE_bit);
@@ -2032,7 +2029,7 @@
setVarType(curBlk, 0, TYPE_void);
freezeVarType(curBlk,0);
}
- setModuleId(curInstr, sql_cacheRef);
+ setModuleId(curInstr, putName("user",4));
if (f->ops) {
int argc = 0;
--- sql_cache.mx DELETED ---
Index: sql_optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_optimizer.mx,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- sql_optimizer.mx 24 Mar 2007 21:23:25 -0000 1.149
+++ sql_optimizer.mx 7 Apr 2007 21:09:08 -0000 1.150
@@ -65,7 +65,6 @@
sql.bind
sql.bind_dbat
sql.bind_idxbat
-sql_cache.???
sql.clear_table
sql.column
sql.columnBind
@@ -94,7 +93,7 @@
#endif /* _SQL_OPTIMIZER_H_ */
@-
-The queries are stored in a cache after they have been
+The queries are stored in the user cache after they have been
type checked and optimized.
The Factory optimizer encapsulates the query with a re-entrance
structure. However, this structure is only effective if
@@ -405,7 +404,7 @@
str defaultPlan=
"inline,"
"remap,"
- /*"evaluate,"*/
+ "evaluate,"
"costModel,"
"coercions,"
"emptySet,"
@@ -461,16 +460,11 @@
void
addQueryToCache(Client c)
{
- Module cache;
backend *be = ((backend *) c->state[PARSER]);
str optimizer;
MalBlkPtr mb;
- cache = findModule(c->nspace, putName("sql_cache",9));
- if (cache == 0)
- return;
-
- insertSymbol(cache, c->curprg);
+ insertSymbol(c->nspace, c->curprg);
trimMalBlk(c->curprg->def);
c->blkmode = 0;
mb= c->curprg->def;
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.219
retrieving revision 1.220
diff -u -d -r1.219 -r1.220
--- sql.mx 1 Apr 2007 22:34:54 -0000 1.219
+++ sql.mx 7 Apr 2007 21:09:08 -0000 1.220
@@ -489,8 +489,6 @@
return algebra.join(m, e);
end aggr.rank_grp;
[EMAIL PROTECTED]
-Include the sql_cache functionality
@mal
command prelude()
@@ -499,7 +497,6 @@
command epilogue()
address SQLepilogue;
-include sql_cache;
sql.prelude();
@h
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/Makefile.ag,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- Makefile.ag 24 Jan 2007 23:54:49 -0000 1.40
+++ Makefile.ag 7 Apr 2007 21:09:08 -0000 1.41
@@ -25,7 +25,6 @@
sql_scenario.mx \
sql_gencode.mx \
sql_optimizer.mx \
- sql_cache.mx \
sql_result.mx \
sql_readline.mx
LIBS = ../../server/libsqlserver ../../storage/bat/libbatstore
../../common/libsqlcommon \
@@ -48,12 +47,8 @@
#$(CLIENTS_LIBS) $(MONETDB_LIBS) -lbat -lMapi -lmutils -lstream
$(READLINE_LIBS) $(PTHREAD_LIBS)
#}
-lib__sql_cache = {
- DIR = libdir/MonetDB5
- SOURCES = dummy.c
-}
scripts_mal = {
DIR = libdir/MonetDB5
- SOURCES = sql.mx sql_cache.mx
+ SOURCES = sql.mx
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins