Changeset: 8b654994777e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b654994777e
Modified Files:
        gdk/gdk_bbp.mx
Branch: default
Log Message:

Merge with Apr2011 branch.


diffs (200 lines):

diff --git a/gdk/gdk_bbp.mx b/gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx
+++ b/gdk/gdk_bbp.mx
@@ -902,8 +902,8 @@
                        if (BBPsize >= BBPlimit)
                                BBPextend(BATMARGIN, FALSE);
                }
-               if (src == 0)
-                       assert(BBP[bid].cache == NULL); /* no duplicates in 
BBP.dir */
+               if (src == 0 && BBP[bid].cache != NULL)
+                       GDKfatal("BBPinit: duplicate entry in BBP.dir.");
                bs = GDKzalloc(sizeof(BATstore));
                if (bs == NULL)
                        GDKfatal("BBPinit: cannot allocate memory for 
BATstore.");
@@ -1155,16 +1155,20 @@
 @-
 In a distributed version of MonetDB, it would be nice to easily share the BATs
 with other server instances. Although concurrency control issues should be 
handled
-with care, it can avoid excessive communiction costs. The BBPimportEntry 
creates
-a BATdescriptor using symbolic links to its source. Presummably this would lead
-to a transparant behavior.
+with care, it can avoid excessive communication costs. The BBPimportEntry 
creates
+a BATdescriptor using symbolic links to its source. Presumably this would lead
+to a transparent behavior.
 @= linkHeap
-       lstat(@3, &st);
+       if (lstat(@3, &st) < 0) {
+               GDKerror("BBPimportEntry: file '%s' does not exist.\n", @3);
+               BBPdestroy(bn);
+               return 0;
+       }
        GDKfilepath(path, BATDIR, BBP_physical(bn->batCacheid), "@4");
        GDKcreatedir(path);
        IODEBUG mnstr_printf(GDKerr, "#symlink %s ->%s\n", @3, path);
        if (symlink(@3, path) < 0) {
-               GDKerror("attach.bind:cannot link '%s' -> '%s'\n", path, @3);
+               GDKerror("BBPimportEntry: cannot link '%s' -> '%s'\n", path, 
@3);
                BBPdestroy(bn);
                return 0;
        }
@@ -1174,15 +1178,23 @@
                GDKfree(bn->@1->@2.filename);
                bn->@1->@2.filename = 0;
        }
-       HEAPload(&bn->@1->@2, BBP_physical(bn->batCacheid), "@4", TRUE);
+       if (HEAPload(&bn->@1->@2, BBP_physical(bn->batCacheid), "@4", TRUE) < 
0) {
+               GDKerror("BBPimportEntry: cannot read heap file '%s'\n", @3);
+               BBPdestroy(bn);
+               return 0;
+       }
 
 @= linkvHeap
-       lstat(@2, &st);
+       if (lstat(@2, &st) < 0) {
+               GDKerror("BBPimportEntry: file '%s' does not exist.\n", @2);
+               BBPdestroy(bn);
+               return 0;
+       }
        GDKfilepath(path, BATDIR, BBP_physical(bn->batCacheid), "@3");
        GDKcreatedir(path);
        IODEBUG mnstr_printf(GDKerr, "#symlink %s ->%s\n", @2, path);
        if (symlink(@2, path) < 0) {
-               GDKerror("attach.bind:cannot link '%s' -> '%s'\n", path, @2);
+               GDKerror("BBPimportEntry: cannot link '%s' -> '%s'\n", path, 
@2);
                BBPdestroy(bn);
                return 0;
        }
@@ -1195,7 +1207,11 @@
                GDKfree(bn->@1->vheap->filename);
                bn->@1->vheap->filename = 0;
        }
-       HEAPload(bn->@1->vheap, BBP_physical(bn->batCacheid), "@3", TRUE);
+       if (HEAPload(bn->@1->vheap, BBP_physical(bn->batCacheid), "@3", TRUE) < 
0) {
+               GDKerror("BBPimportEntry: cannot read heap file '%s'\n", @2);
+               BBPdestroy(bn);
+               return 0;
+       }
 
 @c
 bat
@@ -1221,6 +1237,10 @@
        int BBPlimit;
 
        IODEBUG mnstr_printf(GDKerr,"#importEntry %s\n",nme);
+       if (strlen(nme) >= sizeof(bbpdir)) {
+               GDKerror("BBPimportEntry: file name too long\n");
+               return 0;
+       }
        strcpy(bbpdir,nme);
        s= strstr(bbpdir,BATDIR);
        if (s == 0)
diff --git a/sql/test/BugTracker-2011/Tests/All 
b/sql/test/BugTracker-2011/Tests/All
--- a/sql/test/BugTracker-2011/Tests/All
+++ b/sql/test/BugTracker-2011/Tests/All
@@ -1,3 +1,4 @@
+aggregate-in-subquery.Bug-2739
 correlated-update.Bug-2771
 double_erange.Bug-2774
 view_avg_incorrect_result.Bug-2790
diff --git a/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.sql 
b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.sql
@@ -0,0 +1,4 @@
+create table bug2739 (val int);
+insert into bug2739 values (1), (2);
+select avg(val - (select avg(val) from bug2739)) from bug2739;
+drop table bug2739;
diff --git 
a/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.err 
b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.err
@@ -0,0 +1,39 @@
+stderr of test 'aggregate-in-subquery.Bug-2739` in directory 
'test/BugTracker-2011` itself:
+
+
+# 16:20:36 >  
+# 16:20:36 >   mserver5  --debug=10 --set gdk_nr_threads=0  --set 
"gdk_dbfarm=/ufs/sjoerd/Monet-virgin-stable/var/MonetDB" --set mapi_open=true 
--set mapi_port=32406 --set monet_prompt= --trace --forcemito --set 
mal_listing=2  "--dbname=mTests_test_BugTracker-2011" --set mal_listing=0 ; 
echo ; echo Over..
+# 16:20:36 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = /ufs/sjoerd/Monet-virgin-stable/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  default_pipe = 
inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector
+# builtin opt  minimal_pipe = inline,remap,deadcode,multiplex,garbageCollector
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  gdk_dbfarm = /ufs/sjoerd/Monet-virgin-stable/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 32406
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_test_BugTracker-2011
+# cmdline opt  mal_listing = 0
+
+# 16:20:38 >  
+# 16:20:38 >  mclient -lsql -ftest -i -e --host=ottar --port=32406 
+# 16:20:38 >  
+
+
+# 16:20:39 >  
+# 16:20:39 >  Done.
+# 16:20:39 >  
+
diff --git 
a/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.out 
b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2011/Tests/aggregate-in-subquery.Bug-2739.stable.out
@@ -0,0 +1,43 @@
+stdout of test 'aggregate-in-subquery.Bug-2739` in directory 
'test/BugTracker-2011` itself:
+
+
+# 16:20:36 >  
+# 16:20:36 >   mserver5  --debug=10 --set gdk_nr_threads=0  --set 
"gdk_dbfarm=/ufs/sjoerd/Monet-virgin-stable/var/MonetDB" --set mapi_open=true 
--set mapi_port=32406 --set monet_prompt= --trace --forcemito --set 
mal_listing=2  "--dbname=mTests_test_BugTracker-2011" --set mal_listing=0 ; 
echo ; echo Over..
+# 16:20:36 >  
+
+# MonetDB 5 server v11.3.4
+# This is an unreleased version
+# Serving database 'mTests_test_BugTracker-2011', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 7.749 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
+# Visit http://monetdb.cwi.nl/ for further information
+# Listening for connection requests on mapi:monetdb://ottar.ins.cwi.nl:32406/
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+
+Over..
+
+# 16:20:38 >  
+# 16:20:38 >  mclient -lsql -ftest -i -e --host=ottar --port=32406 
+# 16:20:38 >  
+
+#create table bug2739 (val int);
+#insert into bug2739 values (1), (2);
+[ 2    ]
+#select avg(val - (select avg(val) from bug2739)) from bug2739;
+% sys. # table_name
+% L7 # name
+% double # type
+% 22 # length
+[ 0    ]
+#drop table bug2739;
+
+# 16:20:39 >  
+# 16:20:39 >  Done.
+# 16:20:39 >  
+
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to