Changeset: 36165887b09d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36165887b09d
Added Files:
        monetdb5/mal/Tests/recycle04.mal
        monetdb5/mal/Tests/recycle04.stable.err
        monetdb5/mal/Tests/recycle04.stable.out
Modified Files:
        monetdb5/mal/Tests/All
        monetdb5/mal/Tests/recycle00.stable.out
        monetdb5/mal/Tests/recycle01.stable.out
        monetdb5/mal/Tests/recycle02.stable.out
        monetdb5/mal/Tests/recycle03.stable.out
        monetdb5/mal/Tests/recycle05.mal
        monetdb5/mal/mal_recycle.c
        monetdb5/mal/mal_recycle.h
        monetdb5/modules/mal/recycle.c
        monetdb5/modules/mal/recycle.h
        monetdb5/modules/mal/recycle.mal
        monetdb5/optimizer/opt_octopus.c
        monetdb5/optimizer/opt_recycler.c
Branch: default
Log Message:

Another major reduction on recycler code
Recycling BATs seem to work for subselect.
First eviction tests succeeded (recycle04)


diffs (truncated from 2291 to 300 lines):

diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -233,7 +233,8 @@ tst901b
 recycle00
 recycle01
 recycle02
-#recycle03
+recycle03
+recycle04
 #recycle05
 #recycle06
 #recycle07
diff --git a/monetdb5/mal/Tests/recycle00.stable.out 
b/monetdb5/mal/Tests/recycle00.stable.out
--- a/monetdb5/mal/Tests/recycle00.stable.out
+++ b/monetdb5/mal/Tests/recycle00.stable.out
@@ -36,7 +36,7 @@ end qry;
 #
 function user.main():void;
 #test the basics of the replicator 
-    recycle.setAdmPolicy(1);
+    mdb.List("user","qry");
     io.print("start");
     user.qry();
     io.print("next");
@@ -45,6 +45,13 @@ function user.main():void;
     user.qry();
     recycle.dump();
 end main;
+function user.qry():void;               #  0 qry:void := user.qry() 
+    recycle.start();                    #  1 _5:void := RECYCLEstart() 
+    i := 23;                            #  2 i:int := _2:int {R}
+    j := calc.*(i,i);                   #  3 j:int := CMDvarMULsignal(i:int, 
i:int) {R}
+    io.print(j);                        #  4 _4:void := IOprint_val(j:int) 
+    recycle.stop();                     #  5 _6:void := RECYCLEstop() 
+end qry;                                #  6  
 [ "start" ]
 [ 529 ]
 [ "next" ]
diff --git a/monetdb5/mal/Tests/recycle01.stable.out 
b/monetdb5/mal/Tests/recycle01.stable.out
--- a/monetdb5/mal/Tests/recycle01.stable.out
+++ b/monetdb5/mal/Tests/recycle01.stable.out
@@ -8,29 +8,27 @@ stdout of test 'recycle01` in directory 
 # MonetDB server v5.5.0, based on kernel v1.23.0
 # Serving database 'mTests_src_mal'
 # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
-# Copyright (c) 1993-2008 CWI, all rights reserved
-# Visit http://monetdb.cwi.nl/ for further information
-# Listening for connection requests on mapi:monetdb://gio.ins.cwi.nl:33469/
-##test the basics of the recycler
-## reusing select results
-#
-#function user.bind(s:str,t:str,c:str,i:int):bat[:oid,:int];
-#      b:= bat.new(:oid,:int);
-#      bat.insert(b,0@0,0);
-#      bat.insert(b,1@0,1);
-#      bat.insert(b,2@0,2);
-#      bat.insert(b,3@0,3);
-#      bat.insert(b,4@0,4);
-#      bat.insert(b,5@0,5);
-#      bat.insert(b,6@0,6);
-#      bat.insert(b,7@0,7);
-#      bat.insert(b,8@0,8);
-#      bat.insert(b,9@0,9);
-#      bat.insert(b,10@0,10);
-#      bat.insert(b,11@0,11);
-#      return bind:=b;
-#end bind;
-function user.bind(s:str,t:str,c:str,i:int):bat[:oid,:int];
+# Found 15.591 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:30811/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-24776/.s.monetdb.30811
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+function sql.mvc():int;
+    return mvc := 1;
+end mvc;
+function sql.tid(mvc:int,s:str,t:str):bat[:oid,:oid];
+    b := bat.new(:oid,:oid);
+barrier i := 0@0:oid;
+    bat.append(b,i);
+    redo i := iterator.next(1@0:oid,12@0:oid);
+exit i;
+    return tid := b;
+end tid;
+function sql.bind(mvc:int,s:str,t:str,c:str,i:int):bat[:oid,:int];
     b := bat.new(:oid,:int);
     bat.insert(b,0@0,0);
     bat.insert(b,1@0,1);
@@ -46,14 +44,12 @@ function user.bind(s:str,t:str,c:str,i:i
     bat.insert(b,11@0,11);
     return bind := b;
 end bind;
-#
-#function qry(low:int, hgh:int);
-#      b:= user.bind("schema","table","column",0);
-#      s1:= algebra.select(b,low,hgh);
-#end qry;
-function user.qry(low:int,hgh:int):void;
-    b := user.bind("schema","table","column",0);
-    s1 := algebra.select(b,low,hgh);
+function sql.qry(low:int,hgh:int):void;
+    m := sql.mvc();
+    x:bat[:oid,:oid]  := sql.tid(m,"sys","tbl");
+    b:bat[:oid,:int]  := sql.bind(m,"sys","tbl","col",0);
+    s := algebra.subselect(b,x,low,hgh,true,true,false);
+    io.print(s);
 end qry;
 #
 #recycle.setRetainPolicy(1);
@@ -71,32 +67,84 @@ end qry;
 #
 function user.main():void;
 #test the basics of the recycler 
-# reusing select results 
-    recycle.setAdmPolicy(1);
-    recycle.setReusePolicy(1);
+#reusing select results 
+    mdb.list("user","qry");
     io.print("start");
     user.qry(1,10);
-    io.print("zoom in");
-    user.qry(1,5);
-    io.print("next step");
-    user.qry(2,3);
-    io.print("last");
-    user.qry(1,11);
+    io.print("reuse BAT");
+    user.qry(1,10);
     recycle.dump();
 end main;
+function sql.qry(low:int,hgh:int):void;
+    recycle.start();
+    m := sql.mvc();
+    x:bat[:oid,:oid]  := sql.tid(m,"sys","tbl");
+    b:bat[:oid,:int]  := sql.bind(m,"sys","tbl","col",0);
+    s := algebra.subselect(b,x,low,hgh,true,true,false);
+    io.print(s);
+    recycle.stop();
+end qry;
 [ "start" ]
-[ "zoom in" ]
-[ "next step" ]
-[ "last" ]
-#Recycler  catalog
-#retain= 1 time =0 sze= 0 alpha= 0.500
-#reuse= 1
-#rcache= 0
-#   0 lru= 0 cnt=   1 ticks=  80  vol=    0     _0 := 
user.bind("schema","table","column",0);
-#   1 lru= 0 cnt=   4 ticks=  57  vol=    0     _5 := 
algebra.select(<tmp_20>,1,10);
-#   2 lru= 0 cnt=   1 ticks=  22  vol=    0     _8 := 
algebra.select(<tmp_21>,1,5);
-#   3 lru= 0 cnt=   1 ticks=  16  vol=    0     _10 := 
algebra.select(<tmp_21>,2,3);
-#   4 lru= 0 cnt=   1 ticks=  18  vol=    0     _13 := 
algebra.select(<tmp_21>,1,11);
+#RECYCLE [  0]     X_0 := sql.mvc();
+#RECYCLE [  1]     X_1 := sql.tid(1,"sys","tbl");
+#RECYCLE [  2]     X_4 := sql.bind(1,"sys","tbl","col",0);
+#RECYCLE [  3]     X_7 := 
algebra.subselect(<tmp_1034>,<tmp_1033>,1,10,true,true,false);
+#--------------------------#
+# t    h  # name
+# void oid  # type
+#--------------------------#
+[ 0@0, 1@0  ]
+[ 1@0, 2@0  ]
+[ 2@0, 3@0  ]
+[ 3@0, 4@0  ]
+[ 4@0, 5@0  ]
+[ 5@0, 6@0  ]
+[ 6@0, 7@0  ]
+[ 7@0, 8@0  ]
+[ 8@0, 9@0  ]
+[ 9@0, 10@0  ]
+[ "reuse BAT" ]
+#REUSED  [  0]       m := sql.mvc();
+#REUSED  [  1]       x:bat[:oid,:oid]  := sql.tid(m,"sys","tbl");
+#REUSED  [  2]       b:bat[:oid,:int]  := sql.bind(m,"sys","tbl","col",0);
+#REUSED  [  3]       s := algebra.subselect(b,x,low,hgh,true,true,false);
+#--------------------------#
+# t    h  # name
+# void oid  # type
+#--------------------------#
+[ 0@0, 1@0  ]
+[ 1@0, 2@0  ]
+[ 2@0, 3@0  ]
+[ 3@0, 4@0  ]
+[ 4@0, 5@0  ]
+[ 5@0, 6@0  ]
+[ 6@0, 7@0  ]
+[ 7@0, 8@0  ]
+[ 8@0, 9@0  ]
+[ 9@0, 10@0  ]
+#RECYCLER  CATALOG admission ADM_ALL
+#CACHE= policy PROFIT limit= 20000 
+#RESOURCES hard stmt = 20000 hard var = 100000 hard mem=16741163008
+#recycled = 3 incache= 4 executed = 1536 memory(KB)= 144 PersBat memory=0
+#RPremoved = 0 RPactive= 4 RPmisses = 0
+#Cache search time= 0(usec)
+# CL      lru          cnt      ticks   rd      wr      Instr
+#        0     946139  2       47      0       0           X_0 := sql.mvc();
+#        1     946150  2       60      96      0           X_1 := 
sql.tid(1,"sys","tbl");
+#        2     946161  2       41      48      0           X_4 := 
sql.bind(1,"sys","tbl","col",0);
+#        3     946173  2       36      80      144         X_7 := 
algebra.subselect(<tmp_1034>,<tmp_1033>,1,10,true,true,false);
+#RECYCLE shutdown
+#[0]    _0 = 1 :int  constant 
+#[1]    _1 = <tmp_1033> :BAT  constant 
+#[2]    _2 = "sys" :str  constant 
+#[3]    _3 = "tbl" :str  constant 
+#[4]    _4 = <tmp_1034> :BAT  constant 
+#[5]    _5 = "col" :str  constant 
+#[6]    _6 = 0 :int  constant 
+#[7]    _7 = <tmpr_1036> :BAT  constant 
+#[8]    _8 = 10 :int  constant 
+#[9]    _9 = true :bit  constant 
+#[10]   _10 = false :bit  constant 
 
 # 12:49:07 >  
 # 12:49:07 >  Done.
diff --git a/monetdb5/mal/Tests/recycle02.stable.out 
b/monetdb5/mal/Tests/recycle02.stable.out
--- a/monetdb5/mal/Tests/recycle02.stable.out
+++ b/monetdb5/mal/Tests/recycle02.stable.out
@@ -8,29 +8,27 @@ stdout of test 'recycle02` in directory 
 # MonetDB server v5.5.0, based on kernel v1.23.0
 # Serving database 'mTests_src_mal'
 # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
-# Copyright (c) 1993-2008 CWI, all rights reserved
-# Visit http://monetdb.cwi.nl/ for further information
-# Listening for connection requests on mapi:monetdb://gio.ins.cwi.nl:33469/
-##test the basics of the recycler
-## re-use joins
-#
-#function user.bind(s:str,t:str,c:str,i:int):bat[:oid,:int];
-#      b:= bat.new(:oid,:int);
-#      bat.insert(b,0@0,0);
-#      bat.insert(b,1@0,1);
-#      bat.insert(b,2@0,2);
-#      bat.insert(b,3@0,3);
-#      bat.insert(b,4@0,4);
-#      bat.insert(b,5@0,5);
-#      bat.insert(b,6@0,6);
-#      bat.insert(b,7@0,7);
-#      bat.insert(b,8@0,8);
-#      bat.insert(b,9@0,9);
-#      bat.insert(b,10@0,10);
-#      bat.insert(b,11@0,11);
-#      return bind:=b;
-#end bind;
-function user.bind(s:str,t:str,c:str,i:int):bat[:oid,:int];
+# Found 15.591 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:30811/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-24776/.s.monetdb.30811
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+function sql.mvc():int;
+    return mvc := 1;
+end mvc;
+function sql.tid(mvc:int,s:str,t:str):bat[:oid,:oid];
+    b := bat.new(:oid,:oid);
+barrier i := 0@0:oid;
+    bat.append(b,i);
+    redo i := iterator.next(1@0:oid,12@0:oid);
+exit i;
+    return tid := b;
+end tid;
+function sql.bind(mvc:int,s:str,t:str,c:str,i:int):bat[:oid,:int];
     b := bat.new(:oid,:int);
     bat.insert(b,0@0,0);
     bat.insert(b,1@0,1);
@@ -46,22 +44,12 @@ function user.bind(s:str,t:str,c:str,i:i
     bat.insert(b,11@0,11);
     return bind := b;
 end bind;
-#
-#function qry(low:int, hgh:int);
-#      b:= user.bind("schema","table","column",0);
-#      s1:= algebra.select(b,low,hgh);
-#      m0:= algebra.markT(b, 0@0);
-#      mr:= bat.reverse(m0);
-#      j:= algebra.join(mr,s1);
-#      io.print(j);
-#end qry;
-function user.qry(low:int,hgh:int):void;
-    b := user.bind("schema","table","column",0);
-    s1 := algebra.select(b,low,hgh);
-    m0 := algebra.markT(s1,0@0);
-    mr := bat.reverse(m0);
-    j := algebra.join(mr,s1);
-    io.print(j);
+function sql.qry(low:int,hgh:int):void;
+    m := sql.mvc();
+    x:bat[:oid,:oid]  := sql.tid(m,"sys","tbl");
+    b:bat[:oid,:int]  := sql.bind(m,"sys","tbl","col",0);
+    s := algebra.subselect(b,x,low,hgh,true,true,false);
+    io.print(s);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to