Changeset: 81e8aefb8cc9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=81e8aefb8cc9
Modified Files:
MonetDB5/src/mal/Tests/All
MonetDB5/src/mal/Tests/tst036.mal
MonetDB5/src/mal/Tests/tst040.mal
MonetDB5/src/mal/Tests/tst274.mal
MonetDB5/src/mal/mal_resolve.mx
MonetDB5/src/modules/mal/Makefile.ag
MonetDB5/src/modules/mal/attach.mx
MonetDB5/src/modules/mal/mal_init.mx
MonetDB5/src/optimizer/Makefile.ag
MonetDB5/src/optimizer/opt_prelude.mx
MonetDB5/src/optimizer/opt_support.mx
MonetDB5/src/optimizer/opt_tarantula.mx
Branch: default
Log Message:
Merge results, attach, tarantula
The attach module provides a method to symbolically link BATs from
other servers in the same nfs domain.
The tarantula is a clone of octopus to use recursive break downs.
diffs (truncated from 1319 to 300 lines):
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/mal/Tests/All
--- a/MonetDB5/src/mal/Tests/All Sun Jul 18 19:44:40 2010 +0200
+++ b/MonetDB5/src/mal/Tests/All Wed Jul 21 08:29:21 2010 +0200
@@ -32,6 +32,7 @@
tst033
tst034
tst035
+tst036
HAVE_PCRE?tst037
tst038
tst039
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/mal/Tests/tst036.mal
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/mal/Tests/tst036.mal Wed Jul 21 08:29:21 2010 +0200
@@ -0,0 +1,8 @@
+# test for proper use of list assignments
+(z0,z1):= (1,"help");
+io.print(z0);
+io.print(z1);
+# all three are wrong
+ l1:= (1,2);
+(l2,l3):= 3;
+(l4,l5) := (4,5,6);
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/mal/Tests/tst040.mal
--- a/MonetDB5/src/mal/Tests/tst040.mal Sun Jul 18 19:44:40 2010 +0200
+++ b/MonetDB5/src/mal/Tests/tst040.mal Wed Jul 21 08:29:21 2010 +0200
@@ -20,4 +20,3 @@
x3 := 257:bte;
x4 := -1:bte;
x5 := -0:wrd;
-
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/mal/Tests/tst274.mal
--- a/MonetDB5/src/mal/Tests/tst274.mal Sun Jul 18 19:44:40 2010 +0200
+++ b/MonetDB5/src/mal/Tests/tst274.mal Wed Jul 21 08:29:21 2010 +0200
@@ -34,8 +34,3 @@
wrbytes:= profiler.getTrace("wbytes");
#io.print(wrbytes);
io.print(rdbytes,wrbytes);
-
-#on windows the output is not shown, lets do somewhat more
-k2:=algebra.slice(b,0:lng,5:lng);
-io.print(k2);
-
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/mal/mal_resolve.mx
--- a/MonetDB5/src/mal/mal_resolve.mx Sun Jul 18 19:44:40 2010 +0200
+++ b/MonetDB5/src/mal/mal_resolve.mx Wed Jul 21 08:29:21 2010 +0200
@@ -690,7 +690,7 @@
variables.
@c
if( getFunctionId(p) ) return;
- if( p->retc > 1 && p->argc>p->retc && p->argc!= 2 * p->retc){
+ if( p->retc >= 1 && p->argc > p->retc && p->argc != 2 * p->retc){
if ( !silent)
showScriptException( mb, getPC(mb,p), TYPE,
"Multiple assignment mismatch");
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/modules/mal/Makefile.ag
--- a/MonetDB5/src/modules/mal/Makefile.ag Sun Jul 18 19:44:40 2010 +0200
+++ b/MonetDB5/src/modules/mal/Makefile.ag Wed Jul 21 08:29:21 2010 +0200
@@ -28,7 +28,7 @@
SEP = _
SOURCES = \
chopper.mx constraints.mx language.mx box.mx \
- profiler.mx const.mx algebraExtensions.mx \
+ profiler.mx const.mx attach.mx algebraExtensions.mx \
inspect.mx manual.mx pqueue.mx mkey.mx \
factories.mx groupby.mx mdb.mx \
urlbox.mx mat.mx histogram.mx \
@@ -170,7 +170,7 @@
SOURCES = batExtensions.mx bpm.mx mal_mapi.mx mal_io.mx clients.mx \
pcre.mx bbp.mx tablet.mx transaction.mx statistics.mx \
chopper.mx constraints.mx language.mx box.mx \
- profiler.mx const.mx algebraExtensions.mx \
+ profiler.mx const.mx attach.mx algebraExtensions.mx \
inspect.mx manual.mx pqueue.mx mkey.mx \
factories.mx groupby.mx mdb.mx \
urlbox.mx mat.mx histogram.mx \
@@ -186,7 +186,7 @@
HEADERS = mal
DIR = libdir/MonetDB5
SOURCES = language.mx constraints.mx mal_init.mx box.mx bbp.mx \
- profiler.mx const.mx batExtensions.mx algebraExtensions.mx \
+ profiler.mx const.mx attach.mx batExtensions.mx
algebraExtensions.mx \
inspect.mx manual.mx mal_io.mx pqueue.mx mkey.mx \
chopper.mx clients.mx \
factories.mx groupby.mx mdb.mx pcre.mx tablet.mx mat.mx
histogram.mx \
diff -r aedf27fbb62a -r 81e8aefb8cc9 MonetDB5/src/modules/mal/attach.mx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/modules/mal/attach.mx Wed Jul 21 08:29:21 2010 +0200
@@ -0,0 +1,223 @@
+@/
+The contents of this file are subject to the MonetDB Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the MonetDB Database System.
+
+The Initial Developer of the Original Code is CWI.
+Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+Copyright August 2008-2010 MonetDB B.V.
+All Rights Reserved.
+@
+
+...@f attach
+...@a Martin Kersten
+...@v 0.1
+...@+ Attach
+The attach module provides a mechanism to easily share a (readonly)
+or exchanges BATs between two mservers.
+
+The module is intended to support cheap attachment of BATs identified
+using several protocols, but for the moment we assume a single Linux
+cluster with NSF.
+In this context the bind() creates a symbolic link.
+
+Beware that the argument to the patterns is the full path to
+the base of the BAT. Depending on their type we need to
+establish attachment to head,tail, hheap and theap.
+The count argument is needed, because it can not be derived from the
+file structure itself.
+
+...@mal
+module attach;
+
+pattern bind(nme:str,cnt:lng):bat[:any_1,:any_2]
+address ATTbind
+comment "Find a cheap way to make the BAT nme accessible locally";
+
+command location(b:bat[:any_1,:any_2]):str
+address ATTlocation
+comment "Locate the base of a particulat BAT in the dbfarm";
+...@{
+...@-
+...@+ Implementation
+...@h
+#ifndef _ATTACH_H
+#define _ATTACH_H
+#include "mal.h"
+#include "mal_client.h"
+#include "mal_interpreter.h"
+
+#ifdef WIN32
+#ifndef LIBATTACH
+#define attach_export extern __declspec(dllimport)
+#else
+#define attach_export extern __declspec(dllexport)
+#endif
+#else
+#define attach_export extern
+#endif
+
+attach_export str ATTbind(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
+attach_export str ATTlocation(str *ret, int *bid);
+#endif /* _ATTACH_H */
+...@- Module initializaton
+...@c
+#include "mal_config.h"
+#include "attach.h"
+
+...@- Operator implementation
+
+...@= linkHeap
+ lstat(@2,&st);
+ GDKfilepath(path, BATDIR, bn->@1->heap.filename, "new");
+ GDKcreatedir(path);
+ printf("symlink %s ->%s\n",@2,path);
+ if (symlink(@2, path) < 0) {
+ msg = createException(MAL,"attach.bind","cannot link '%s' ->
'@2' heapfile %s\n",path);
+ HEAPfree(&bn->@1->heap);
+ GDKfree(bs);
+ return msg;
+ }
+ bn->@1->heap.size = (size_t) st.st_size;
+ bn->@1->heap.storage = (bn->@1->heap.size < REMAP_PAGE_MAXSIZE) ?
STORE_MEM : STORE_MMAP;
+ HEAPload(&bn->@1->heap, BBP_physical(bn->batCacheid), "@3", TRUE);
+
+...@= linkvHeap
+ lstat(@2,&st);
+ GDKfilepath(path, BATDIR, bn->@1->vheap->filename, "new");
+ GDKcreatedir(path);
+ if (symlink(@2, path) < 0) {
+ msg = createException(MAL,"attach.bind","cannot link '%s' ->
'@2' heapfile %s\n",path);
+ HEAPfree(bn->@1->vheap);
+ GDKfree(bs);
+ return msg;
+ }
+ bn->@1->vheap->size = (size_t) st.st_size;
+ bn->@1->vheap->storage = (bn->@1->vheap->size < REMAP_PAGE_MAXSIZE) ?
STORE_MEM : STORE_MMAP;
+ HEAPload(bn->@1->vheap, BBP_physical(bn->batCacheid), "@3", TRUE);
+
+...@c
+str
+ATTbind(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+#ifdef WIN32
+ (void) cntxt;
+ (void) mb;
+ (void) stk;
+ (void) pcil
+ throw(MAL, "attach.bind", "Not available on Windows");
+#else
+ int *ret = (int*) getArgReference(stk, pci, 0);
+ str nme = *(str*) getArgReference(stk, pci, 1);
+ BUN cap = 0, cnt = (BUN) *(lng*) getArgReference(stk, pci, 2);
+ char bufhead[BUFSIZ];
+ char buftail[BUFSIZ];
+ char bufhheap[BUFSIZ];
+ char buftheap[BUFSIZ];
+ char path[BUFSIZ];
+ int ht,tt;
+ BAT *bn = 0;
+ BATstore *bs;
+ struct stat st;
+ str msg= MAL_SUCCEED;
+
+ (void) cntxt;
+ /* more protocols for the future */
+ if ( strncmp(nme,"file:/",6) ) {
+ // throw(MAL, "attach.bind", "Protocol unknown");
+ } else nme += 6;
+
+ ht = getHeadType(getArgType(mb,pci,0));
+ tt = getTailType(getArgType(mb,pci,0));
+
+ snprintf(bufhead,BUFSIZ,"%s.head", nme);
+ if (ht != TYPE_void && lstat(bufhead, &st) < 0) {
+ if ( ht == TYPE_oid){
+ ht= TYPE_void;
+ } else
+ throw(MAL,"attach.bind","head heap not found");
+ }
+
+ snprintf(buftail,BUFSIZ,"%s.tail", nme);
+ if (tt != TYPE_void && lstat(buftail, &st) < 0){
+ if ( ht == TYPE_oid){
+ tt= TYPE_void;
+ } else
+ throw(MAL,"attach.bind","tail heap not found");
+ }
+
+ bs = BATcreatedesc(ht, tt, 1);
+ if (bs == NULL)
+ throw(MAL,"attach.bind",MAL_MALLOC_FAIL);
+ bn = &bs->B;
+ BATsetdims(bn);
+ bn->hsorted = 0;
+ bn->tsorted = 0;
+
+ snprintf(bufhheap,BUFSIZ,"%s.hheap", nme);
+ if (ht != TYPE_void && bn->hvarsized && lstat(bufhheap, &st) < 0)
+ throw(MAL,"attach.bind","hhead heap not found");
+
+ snprintf(buftheap,BUFSIZ,"%s.theap", nme);
+ if (tt != TYPE_void && bn->tvarsized && lstat(buftheap, &st) < 0)
+ throw(MAL,"attach.bind","theap heap not found");
+
+ if (ht != TYPE_void ) {
+ @:linkHeap(H,bufhead,head)@
+ cap = (BUN) (st.st_size / ATOMsize(ht));
+ if ( bn->tvarsized){
+ @:linkvHeap(T,bufhheap,hheap)@
+ }
+ } else {
+ bn->hseqbase = 0;
+ BATkey(bn, TRUE);
+ }
+ if (tt != TYPE_void ) {
+ @:linkHeap(T,buftail,tail)@
+ cap = (BUN) (st.st_size / ATOMsize(tt));
+ if ( bn->tvarsized){
+ @:linkvHeap(T,buftheap,theap)@
+ }
+ } else {
+ bn->tseqbase = 0;
+ BATkey(BATmirror(bn), TRUE);
+ }
+ assert(cap);
+ BBPcacheit(bs);
+ BATsetcapacity(bn, cap);
+ BATsetcount(bn, cnt);
+ BATsetaccess(bn, BAT_READ);
+ if (cap > 1) {
+ BATpropcheck(bn, BATPROPS_ALL);
+ BATpropcheck(BATmirror(bn), BATPROPS_ALL);
+ }
+
+ BBPkeepref(*ret= bn->batCacheid);
+ return MAL_SUCCEED;
+#endif
+}
+str ATTlocation(str *ret, int *bid)
+{
+ BAT *b = BBPquickdesc(*bid, FALSE);
+ char path[BUFSIZ], *s;
+
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list