Changeset: c5a4c98a6480 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5a4c98a6480
Modified Files:
        MonetDB5/src/mal/Tests/tst058.mal
        MonetDB5/src/optimizer/opt_mitosis.mx
Branch: Oct2010
Log Message:

Protect against non-set GDKnr_threads
The SQL embedded version does/did not set the number of threads,
which may cause a division by zero in mitosis.


diffs (34 lines):

diff -r ce5cb835816b -r c5a4c98a6480 MonetDB5/src/mal/Tests/tst058.mal
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/MonetDB5/src/mal/Tests/tst058.mal Fri Nov 26 21:21:46 2010 +0100
@@ -0,0 +1,3 @@
+-- some typos
+i:= 1 + 1 + 1;
+j:= 1 + + 1;
diff -r ce5cb835816b -r c5a4c98a6480 MonetDB5/src/optimizer/opt_mitosis.mx
--- a/MonetDB5/src/optimizer/opt_mitosis.mx     Fri Nov 26 20:59:41 2010 +0100
+++ b/MonetDB5/src/optimizer/opt_mitosis.mx     Fri Nov 26 21:21:46 2010 +0100
@@ -145,9 +145,9 @@
                pieces = i;
        else {
                /* ensure that GDKnr_threads partitions fit into main memory */
-               r = (BUN) (monet_memory / typewidth / GDKnr_threads);
+               r = (BUN) (monet_memory / typewidth / (GDKnr_threads ? 
GDKnr_threads: 1) );
                if (rowcnt > r)
-                       pieces = MAX ( (int)(rowcnt / r + 1) , GDKnr_threads );
+                       pieces = MAX ( (int)(rowcnt / r + 1) , (GDKnr_threads ? 
GDKnr_threads: 1)  );
                else
                /* exploit parallelism, but ensure minimal partition size to 
limit overhead */
                if (rowcnt > MINPARTCNT)
@@ -160,9 +160,9 @@
                if (pieces > MAXSLICES)
                        pieces = MAXSLICES;
 
-               if (pieces <= 1)
-                       return 0;
        }
+       if (pieces <= 1)
+               return 0;
        OPTDEBUGmitosis
                mnstr_printf(cntxt->fdout,"#opt_mitosis: target is %s.%s "
                        " with " BUNFMT " rows into " BUNFMT " rows/piece %d 
threads %d pieces\n",
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to