List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:October 15 2012 2:28pm
Subject:bzr push into mysql-trunk branch (alexander.barkov:4730 to 4731)
View as plain text  
 4731 Alexander Barkov	2012-10-15 [merge]
      Merging from 5.6

    modified:
      sql/gcalc_slicescan.cc
      sql/gcalc_slicescan.h
      sql/gcalc_tools.cc
      sql/gcalc_tools.h
 4730 Norvald H. Ryeng	2012-10-15 [merge]
      Merge 5.6->trunk.

    modified:
      sql/item.cc
=== modified file 'sql/gcalc_slicescan.cc'
--- a/sql/gcalc_slicescan.cc	2012-09-27 14:23:32 +0000
+++ b/sql/gcalc_slicescan.cc	2012-10-15 14:27:28 +0000
@@ -39,6 +39,9 @@ typedef int (*sc_compare_func)(const voi
 
 
 Gcalc_dyn_list::Gcalc_dyn_list(size_t blk_size, size_t sizeof_item):
+#ifndef DBUG_OFF
+  m_last_item_id(0),
+#endif
   m_blk_size(blk_size - ALLOC_ROOT_MIN_BLOCK_SIZE),
   m_sizeof_item(ALIGN_SIZE(sizeof_item)),
   m_points_per_blk((m_blk_size - PH_DATA_OFFSET) / m_sizeof_item),

=== modified file 'sql/gcalc_slicescan.h'
--- a/sql/gcalc_slicescan.h	2012-07-02 11:13:50 +0000
+++ b/sql/gcalc_slicescan.h	2012-10-15 14:15:49 +0000
@@ -30,9 +30,18 @@
 
 class Gcalc_dyn_list
 {
+#ifndef DBUG_OFF
+  uint m_last_item_id;
+#endif
 public:
   class Item
   {
+#ifndef DBUG_OFF
+    uint m_item_id;
+  public:
+    uint item_id() const { return m_item_id; }
+    void set_item_id(uint id) { m_item_id= id; }
+#endif
   public:
     Item *next;
   };
@@ -49,6 +58,9 @@ public:
     result= m_free;
     m_free= m_free->next;
 
+#ifndef DBUG_OFF
+    result->set_item_id(++m_last_item_id);
+#endif
     result->next= NULL;
     return result;
   }

=== modified file 'sql/gcalc_tools.cc'
--- a/sql/gcalc_tools.cc	2012-09-27 14:23:32 +0000
+++ b/sql/gcalc_tools.cc	2012-10-15 14:27:28 +0000
@@ -584,16 +584,13 @@ inline int Gcalc_operation_reducer::cont
 						const Gcalc_heap::Info *p)
 {
   DBUG_ENTER("Gcalc_operation_reducer::continue_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
   DBUG_ASSERT(t->result_range);
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_point(p);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= NULL;
   rp->down= t->rp;
   t->rp->up= rp;
-  rp->intersection_point= false;
-  rp->pi= p;
   t->rp= rp;
   DBUG_RETURN(0);
 }
@@ -604,18 +601,13 @@ inline int Gcalc_operation_reducer::cont
 						  double x, double y)
 {
   DBUG_ENTER("Gcalc_operation_reducer::continue_i_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u) xy=(%g,%g)", p->x, p->y, p->shape, x, y));
   DBUG_ASSERT(t->result_range);
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_i_point(p, x, y);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= NULL;
   rp->down= t->rp;
   t->rp->up= rp;
-  rp->intersection_point= true;
-  rp->x= x;
-  rp->pi= p;
-  rp->y= y;
   t->rp= rp;
   DBUG_RETURN(0);
 }
@@ -624,13 +616,10 @@ inline int Gcalc_operation_reducer::star
 					     const Gcalc_heap::Info *p)
 {
   DBUG_ENTER("Gcalc_operation_reducer::start_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_point(p);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->down= NULL;
-  rp->intersection_point= false;
-  rp->pi= p;
   t->result_range= 1;
   t->rp= rp;
   DBUG_RETURN(0);
@@ -641,15 +630,10 @@ inline int Gcalc_operation_reducer::star
 					       double x, double y)
 {
   DBUG_ENTER("Gcalc_operation_reducer::start_i_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u) xy=(%g,%g)", p->x, p->y, p->shape, x, y));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_i_point(p, x, y);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->down= NULL;
-  rp->intersection_point= true;
-  rp->x= x;
-  rp->y= y;
-  rp->pi= p;
   t->result_range= 1;
   t->rp= rp;
   DBUG_RETURN(0);
@@ -659,14 +643,11 @@ inline int Gcalc_operation_reducer::end_
 					   const Gcalc_heap::Info *p)
 {
   DBUG_ENTER("Gcalc_operation_reducer::end_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_point(p);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->up= NULL;
   rp->down= t->rp;
-  rp->intersection_point= false;
-  rp->pi= p;
   t->rp->up= rp;
   t->result_range= 0;
   DBUG_RETURN(0);
@@ -677,16 +658,11 @@ inline int Gcalc_operation_reducer::end_
 					     double x, double y)
 {
   DBUG_ENTER("Gcalc_operation_reducer::end_i_range");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u) xy=(%g,%g)", p->x, p->y, p->shape, x, y));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_i_point(p, x, y);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->up= NULL;
   rp->down= t->rp;
-  rp->intersection_point= true;
-  rp->x= x;
-  rp->pi= p;
-  rp->y= y;
   t->rp->up= rp;
   t->result_range= 0;
   DBUG_RETURN(0);
@@ -697,24 +673,22 @@ int Gcalc_operation_reducer::start_coupl
                                        const active_thread *prev_range)
 {
   DBUG_ENTER("Gcalc_operation_reducer::start_couple");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
   res_point *rp0, *rp1;
-  if (!(rp0= add_res_point()) || !(rp1= add_res_point()))
+  if (!(rp0= add_res_point(p)) || !(rp1= add_res_point(p)))
     DBUG_RETURN(1);
   rp0->glue= rp1;
   rp1->glue= rp0;
-  rp0->intersection_point= rp1->intersection_point= false;
   rp0->down= rp1->down= NULL;
-  rp0->pi= rp1->pi= p;
   t0->rp= rp0;
   t1->rp= rp1;
   if (prev_range)
   {
-    rp0->outer_poly= t1->thread_start= prev_range->thread_start;
+    rp0->set_outer_poly(prev_range->thread_start);
+    t1->thread_start= prev_range->thread_start;
   }
   else
   {
-    rp0->outer_poly= 0;
+    rp0->set_outer_poly(NULL);
     t0->thread_start= rp0;
   }
   DBUG_RETURN(0);
@@ -727,29 +701,23 @@ int Gcalc_operation_reducer::start_i_cou
                                          const active_thread *prev_range)
 {
   DBUG_ENTER("Gcalc_operation_reducer::start_i_couple");
-  DBUG_PRINT("info", ("p0=(%g,%g,#%u) p1=(%g,%g,#%u) xy=(%g,%g)",
-                      p0->x, p0->y, p0->shape, p1->x, p1->y, p1->shape, x, y));
   res_point *rp0, *rp1;
-  if (!(rp0= add_res_point()) || !(rp1= add_res_point()))
+  if (!(rp0= add_res_i_point(p0, x, y)) || !(rp1= add_res_i_point(p1, x, y)))
     DBUG_RETURN(1);
   rp0->glue= rp1;
   rp1->glue= rp0;
-  rp0->pi= p0;
-  rp1->pi= p1;
-  rp0->intersection_point= rp1->intersection_point= true;
   rp0->down= rp1->down= NULL;
-  rp0->x= rp1->x= x;
-  rp0->y= rp1->y= y;
   t0->result_range= t1->result_range= 1;
   t0->rp= rp0;
   t1->rp= rp1;
   if (prev_range)
   {
-    rp0->outer_poly= t1->thread_start= prev_range->thread_start;
+    rp0->set_outer_poly(prev_range->thread_start);
+    t1->thread_start= prev_range->thread_start;
   }
   else
   {
-    rp0->outer_poly= 0;
+    rp0->set_outer_poly(NULL);
     t0->thread_start= rp0;
   }
   DBUG_RETURN(0);
@@ -759,10 +727,9 @@ int Gcalc_operation_reducer::end_couple(
 				     const Gcalc_heap::Info *p)
 {
   DBUG_ENTER("Gcalc_operation_reducer::end_couple");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
   res_point *rp0, *rp1;
   DBUG_ASSERT(t1->result_range);
-  if (!(rp0= add_res_point()) || !(rp1= add_res_point()))
+  if (!(rp0= add_res_point(p)) || !(rp1= add_res_point(p)))
     DBUG_RETURN(1);
   rp0->down= t0->rp;
   rp1->down= t1->rp;
@@ -771,8 +738,6 @@ int Gcalc_operation_reducer::end_couple(
   rp0->up= rp1->up= NULL;
   t0->rp->up= rp0;
   t1->rp->up= rp1;
-  rp0->intersection_point= rp1->intersection_point= false;
-  rp0->pi= rp1->pi= p;
   t0->result_range= t1->result_range= 0;
   DBUG_RETURN(0);
 }
@@ -783,21 +748,14 @@ int Gcalc_operation_reducer::end_i_coupl
 				       double x, double y)
 {
   DBUG_ENTER("Gcalc_operation_reducer::end_i_couple");
-  DBUG_PRINT("info", ("p0=(%g,%g,#%u) p1=(%g,%g,#%u) xy=(%g,%g)",
-                      p0->x, p0->y, p0->shape, p1->x, p1->y, p1->shape, x, y));
   res_point *rp0, *rp1;
-  if (!(rp0= add_res_point()) || !(rp1= add_res_point()))
+  if (!(rp0= add_res_i_point(p0, x, y)) || !(rp1= add_res_i_point(p1, x, y)))
     DBUG_RETURN(1);
   rp0->down= t0->rp;
   rp1->down= t1->rp;
-  rp0->pi= p0;
-  rp1->pi= p1;
   rp1->glue= rp0;
   rp0->glue= rp1;
   rp0->up= rp1->up= NULL;
-  rp0->intersection_point= rp1->intersection_point= true;
-  rp0->x= rp1->x= x;
-  rp0->y= rp1->y= y;
   t0->result_range= t1->result_range= 0;
   t0->rp->up= rp0;
   t1->rp->up= rp1;
@@ -807,15 +765,10 @@ int Gcalc_operation_reducer::end_i_coupl
 int Gcalc_operation_reducer::add_single_point(const Gcalc_heap::Info *p)
 {
   DBUG_ENTER("Gcalc_operation_reducer::add_single_point");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u)", p->x, p->y, p->shape));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_single_point(p);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->up= rp->down= NULL;
-  rp->intersection_point= false;
-  rp->pi= p;
-  rp->x= p->x;
-  rp->y= p->y;
   DBUG_RETURN(0);
 }
 
@@ -823,15 +776,10 @@ int Gcalc_operation_reducer::add_i_singl
 					     double x, double y)
 {
   DBUG_ENTER("Gcalc_operation_reducer::add_i_single_point");
-  DBUG_PRINT("info", ("p=(%g,%g,#%u) xy=(%g,%g)", p->x, p->y, p->shape, x, y));
-  res_point *rp= add_res_point();
+  res_point *rp= add_res_i_point(p, x, y);
   if (!rp)
     DBUG_RETURN(1);
   rp->glue= rp->up= rp->down= NULL;
-  rp->intersection_point= true;
-  rp->x= x;
-  rp->pi= p;
-  rp->y= y;
   DBUG_RETURN(0);
 }
 
@@ -1336,9 +1284,9 @@ int Gcalc_operation_reducer::get_result(
     if (shape == Gcalc_function::shape_polygon)
     {
       polygons_found= true;
-      if (m_result->outer_poly) // Inner ring (hole)
+      if (m_result->get_outer_poly()) // Inner ring (hole)
       {
-        chunk.first_point= m_result->outer_poly;
+        chunk.first_point= m_result->get_outer_poly();
         chunk.is_poly_hole= true;
         shape= Gcalc_function::shape_hole;
       }

=== modified file 'sql/gcalc_tools.h'
--- a/sql/gcalc_tools.h	2012-07-21 06:56:07 +0000
+++ b/sql/gcalc_tools.h	2012-10-15 14:15:49 +0000
@@ -249,6 +249,7 @@ public:
 
   class res_point : public Gcalc_dyn_list::Item
   {
+    res_point *m_outer_poly;
   public:
     bool intersection_point;
     double x,y;
@@ -260,9 +261,16 @@ public:
       const Gcalc_heap::Info *pi; // is valid before get_result_thread()
       res_point *first_poly_node; // is valid after get_result_thread()
     };
-    res_point *outer_poly;
     Gcalc_dyn_list::Item **prev_hook;
     res_point *get_next() { return (res_point *)next; }
+    void set_outer_poly(res_point *p)
+    {
+      m_outer_poly= p;
+      DBUG_PRINT("info", ("setting outer_poly of #%u to #%u",
+                          item_id(),
+                          m_outer_poly ? m_outer_poly->item_id() : 0));
+    }
+    res_point *get_outer_poly() { return m_outer_poly; }
   };
 
   class active_thread : public Gcalc_dyn_list::Item
@@ -288,13 +296,38 @@ protected:
   res_point *result_heap;
   active_thread *m_first_active_thread;
 
-  res_point *add_res_point()
+  res_point *add_res_point(const Gcalc_heap::Info *pi)
   {
-    res_point *result= (res_point *)new_item();
-    *m_res_hook= result;
-    result->prev_hook= m_res_hook;
-    m_res_hook= &result->next;
-    return result;
+    res_point *rp= new_res_point(pi, false);
+    if (!rp)
+      return NULL;
+    DBUG_PRINT("info", ("add_res_point #%u: pi=(%g,%g,#%u)",
+                        rp->item_id(), pi->x, pi->y, pi->shape));
+    return rp;
+  }
+
+  res_point *add_res_i_point(const Gcalc_heap::Info *pi, double x, double y)
+  {
+    res_point *rp= new_res_point(pi, true);
+    if (!rp)
+      return NULL;
+    DBUG_PRINT("info", ("add_res_i_point #%u: pi=(%g,%g,#%u) xy=(%g,%g)",
+                        rp->item_id(), pi->x, pi->y, pi->shape, x, y));
+    rp->x= x;
+    rp->y= y;
+    return rp;
+  }
+
+  res_point *add_res_single_point(const Gcalc_heap::Info *pi)
+  {
+    res_point *rp= new_res_point(pi, false);
+    if (!rp)
+      return NULL;
+    DBUG_PRINT("info", ("add_res_single_point #%u: pi=(%g,%g,#%u)",
+                        rp->item_id(), pi->x, pi->y, pi->shape));
+    rp->x= pi->x;
+    rp->y= pi->y;
+    return rp;
   }
 
   active_thread *new_active_thread()
@@ -306,6 +339,19 @@ protected:
   }
 
 private:
+
+  res_point *new_res_point(const Gcalc_heap::Info *pi,
+                           bool intersection_point)
+  {
+    res_point *result= (res_point *) new_item();
+    *m_res_hook= result;
+    result->prev_hook= m_res_hook;
+    m_res_hook= &result->next;
+    result->pi= pi;
+    result->intersection_point= intersection_point;
+    return result;
+  }
+
   int continue_range(active_thread *t, const Gcalc_heap::Info *p);
   int continue_i_range(active_thread *t, const Gcalc_heap::Info *p,
 		       double x, double y);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:4730 to 4731) Alexander Barkov15 Oct