Changeset: 906ce28bddcf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/906ce28bddcf
Modified Files:
        monetdb5/mal/mal_client.c
        monetdb5/optimizer/opt_mitosis.c
Branch: default
Log Message:

Dead code.


diffs (146 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -372,6 +372,7 @@ MCinitClientThread(Client c)
 Client
 MCforkClient(Client father)
 {
+       /* TO BE REMOVED: this function is not used anywhere */
        Client son = NULL;
        str prompt;
 
@@ -571,27 +572,10 @@ MCactiveClients(void)
 size_t
 MCmemoryClaim(void)
 {
-       size_t claim = 0;
-       int active = 1;
-
-       Client cntxt = mal_clients;
-
-       MT_lock_set(&mal_contextLock);
-       for(cntxt = mal_clients;  cntxt<mal_clients+MAL_MAXCLIENTS; cntxt++) {
-               if( cntxt->idle == 0 && cntxt->mode == RUNCLIENT){
-                       if(cntxt->memorylimit){
-                               claim += cntxt->memorylimit;
-                               active ++;
-                       } else {
-                               MT_lock_unset(&mal_contextLock);
-                               return GDK_mem_maxsize;
-                       }
-               }
-       }
-       MT_lock_unset(&mal_contextLock);
-       if(active == 0 ||  claim  * LL_CONSTANT(1048576) >= GDK_mem_maxsize)
-               return GDK_mem_maxsize;
-       return claim * LL_CONSTANT(1048576);
+       /* TO BE REMOVED */
+       /* this function used to be more complex, but in the end it always
+        * returned GDK_mem_maxsize, so that's what we do now */
+       return GDK_mem_maxsize;
 }
 
 str
diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -25,7 +25,7 @@ OPTmitosisImplementation(Client cntxt, M
        str schema = 0, table = 0;
        BUN r = 0, rowcnt = 0;  /* table should be sizeable to consider 
parallel execution*/
        InstrPtr p, q, *old, target = 0;
-       size_t argsize = 6 * sizeof(lng), m = 0, memclaim;
+       size_t argsize = 6 * sizeof(lng), m = 0;
        /*       estimate size per operator estimate:   4 args + 2 res*/
        int threads = GDKnr_threads ? GDKnr_threads : 1, maxparts = MAXSLICES;
        str msg = MAL_SUCCEED;
@@ -156,56 +156,42 @@ OPTmitosisImplementation(Client cntxt, M
        cntxt->idle = 0; // this one is definitely not idle
        MT_lock_unset(&mal_contextLock);
 
-/* This code was used to experiment with block sizes, mis-using the 
memorylimit  variable
-       if (cntxt->memorylimit){
-               // the new mitosis scheme uses a maximum chunck size in MB from 
the client context
-               m = (((size_t) cntxt->memorylimit) * 1048576) / (size_t) 
row_size;
-               pieces = (int) (rowcnt / m + (rowcnt - m * pieces > 0));
+       /* improve memory usage estimation */
+       if (nr_cols > 1 || nr_aggrs > 1 || nr_maps > 1)
+               argsize = (nr_cols + nr_aggrs + nr_maps) * sizeof(lng);
+       /* We haven't assigned the number of pieces.
+        * Determine the memory available for this client
+        */
+
+       /* respect the memory limit size set for the user
+       * and determine the column part size
+       */
+       if( cntxt->memorylimit)
+               m = (((size_t) cntxt->memorylimit) * 1048576) / argsize;
+       else {
+               m = GDK_mem_maxsize / (size_t) MCactiveClients() / argsize;
        }
-       if (cntxt->memorylimit == 0 || pieces <= 1){
-*/
-       if (pieces <= 1){
-               /* improve memory usage estimation */
-               if (nr_cols > 1 || nr_aggrs > 1 || nr_maps > 1)
-                       argsize = (nr_cols + nr_aggrs + nr_maps) * sizeof(lng);
-               /* We haven't assigned the number of pieces.
-                * Determine the memory available for this client
-                */
 
-               /* respect the memory limit size set for the user
-               * and determine the column part size
-               */
-               if( cntxt->memorylimit)
-                       m = (((size_t) cntxt->memorylimit) * 1048576) / argsize;
-               else {
-                       memclaim= MCmemoryClaim();
-                       if(memclaim == GDK_mem_maxsize){
-                               m = GDK_mem_maxsize / (size_t) 
MCactiveClients()  / argsize;
-                       } else
-                               m = (GDK_mem_maxsize - memclaim) / argsize;
-               }
-
-               /* if data exceeds memory size,
-                * i.e., (rowcnt*argsize > GDK_mem_maxsize),
-                * i.e., (rowcnt > GDK_mem_maxsize/argsize = m) */
-               if (rowcnt > m && m / threads > 0) {
-                       /* create |pieces| > |threads| partitions such that
-                        * |threads| partitions at a time fit in memory,
-                        * i.e., (threads*(rowcnt/pieces) <= m),
-                        * i.e., (rowcnt/pieces <= m/threads),
-                        * i.e., (pieces => rowcnt/(m/threads))
-                        * (assuming that (m > threads*MIN_PART_SIZE)) */
-                       /* the number of pieces affects SF-100, going beyond 8x 
increases
-                        * the optimizer costs beyond the execution time
-                        */
-                       pieces = ((int) ceil((double)rowcnt / (m / threads)));
-                       if (pieces <= threads)
-                               pieces = threads;
-               } else if (rowcnt > MIN_PART_SIZE) {
-               /* exploit parallelism, but ensure minimal partition size to
-                * limit overhead */
-                       pieces = MIN((int) ceil((double)rowcnt / 
MIN_PART_SIZE), MAX_PARTS2THREADS_RATIO * threads);
-               }
+       /* if data exceeds memory size,
+        * i.e., (rowcnt*argsize > GDK_mem_maxsize),
+        * i.e., (rowcnt > GDK_mem_maxsize/argsize = m) */
+       if (rowcnt > m && m / threads > 0) {
+               /* create |pieces| > |threads| partitions such that
+                * |threads| partitions at a time fit in memory,
+                * i.e., (threads*(rowcnt/pieces) <= m),
+                * i.e., (rowcnt/pieces <= m/threads),
+                * i.e., (pieces => rowcnt/(m/threads))
+                * (assuming that (m > threads*MIN_PART_SIZE)) */
+               /* the number of pieces affects SF-100, going beyond 8x 
increases
+                * the optimizer costs beyond the execution time
+                */
+               pieces = ((int) ceil((double)rowcnt / (m / threads)));
+               if (pieces <= threads)
+                       pieces = threads;
+       } else if (rowcnt > MIN_PART_SIZE) {
+       /* exploit parallelism, but ensure minimal partition size to
+        * limit overhead */
+               pieces = MIN((int) ceil((double)rowcnt / MIN_PART_SIZE), 
MAX_PARTS2THREADS_RATIO * threads);
        }
 
        /* when testing, always aim for full parallelism, but avoid
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to