MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:April 26 2006 2:42pm
Subject:bk commit into 5.1 tree (tomas:1.2364)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2364 06/04/26 16:42:07 tomas@stripped +16 -0
  Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0
  into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new

  storage/ndb/src/mgmsrv/Services.cpp
    1.62 06/04/26 16:42:01 tomas@stripped +2 -2
    manual merge

  sql/share/errmsg.txt
    1.95 06/04/26 16:42:01 tomas@stripped +3 -4
    manual merge

  sql/ha_ndbcluster.cc
    1.297 06/04/26 16:42:01 tomas@stripped +2 -0
    manual merge

  configure.in
    1.342 06/04/26 16:42:01 tomas@stripped +0 -2
    manual merge

  storage/ndb/src/mgmsrv/Services.hpp
    1.19 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.43 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.93 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.62 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.48 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.34 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  storage/ndb/include/mgmapi/mgmapi.h
    1.51 06/04/26 16:28:26 tomas@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.541 06/04/26 16:28:25 tomas@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.214 06/04/26 16:28:25 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.hpp
    1.13.4.2 06/04/26 16:28:24 tomas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.hpp -> storage/ndb/src/mgmsrv/Services.hpp

  storage/ndb/src/mgmsrv/Services.cpp
    1.45.16.3 06/04/26 16:28:24 tomas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.cpp -> storage/ndb/src/mgmsrv/Services.cpp

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.30.11.3 06/04/26 16:28:24 tomas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.hpp -> storage/ndb/src/mgmsrv/MgmtSrvr.hpp

  sql/item.h
    1.197 06/04/26 16:28:24 tomas@stripped +0 -0
    Auto merged

  sql/item.cc
    1.185 06/04/26 16:28:24 tomas@stripped +0 -0
    Auto merged

  mysql-test/r/view.result
    1.158 06/04/26 16:28:24 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.73.20.3 06/04/26 16:28:23 tomas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.44.16.2 06/04/26 16:28:23 tomas@stripped +0 -0
    Merge rename: ndb/src/mgmapi/mgmapi.cpp -> storage/ndb/src/mgmapi/mgmapi.cpp

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.39.6.2 06/04/26 16:28:23 tomas@stripped +0 -0
    Merge rename: ndb/src/kernel/vm/Configuration.cpp -> storage/ndb/src/kernel/vm/Configuration.cpp

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.24.9.2 06/04/26 16:28:23 tomas@stripped +0 -0
    Merge rename: ndb/src/common/mgmcommon/ConfigRetriever.cpp -> storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp

  storage/ndb/include/mgmapi/mgmapi.h
    1.42.7.2 06/04/26 16:28:23 tomas@stripped +0 -0
    Merge rename: ndb/include/mgmapi/mgmapi.h -> storage/ndb/include/mgmapi/mgmapi.h

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-new/RESYNC

--- 1.184/sql/item.cc	2006-04-23 02:00:03 +02:00
+++ 1.185/sql/item.cc	2006-04-26 16:28:24 +02:00
@@ -1998,6 +1998,16 @@
 }
 
 
+void Item_decimal::set_decimal_value(my_decimal *value_par)
+{
+  my_decimal2decimal(value_par, &decimal_value);
+  decimals= (uint8) decimal_value.frac;
+  unsigned_flag= !decimal_value.sign();
+  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
+                                             decimals, unsigned_flag);
+}
+
+
 String *Item_float::val_str(String *str)
 {
   // following assert is redundant, because fixed=1 assigned in constructor

--- 1.196/sql/item.h	2006-04-23 02:00:03 +02:00
+++ 1.197/sql/item.h	2006-04-26 16:28:24 +02:00
@@ -1486,6 +1486,7 @@
   }
   uint decimal_precision() const { return decimal_value.precision(); }
   bool eq(const Item *, bool binary_cmp) const;
+  void set_decimal_value(my_decimal *value_par);
 };
 
 

--- 1.213/sql/opt_range.cc	2006-04-21 02:00:22 +02:00
+++ 1.214/sql/opt_range.cc	2006-04-26 16:28:25 +02:00
@@ -4695,17 +4695,92 @@
 
     if (inv)
     {
-      tree= get_ne_mm_tree(param, cond_func, field,
-                           func->arguments()[1], func->arguments()[1],
-                           cmp_type);
-      if (tree)
+      /*
+        We get here for conditions like "t.keypart NOT IN (....)".
+        
+        If the IN-list contains only constants (and func->array is an ordered
+        array of them), we construct the appropriate SEL_ARG tree manually, 
+        because constructing it using the range analyzer (as 
+        AND_i( t.keypart != c_i)) will cause lots of memory to be consumed
+        (see BUG#15872). 
+      */
+      if (func->array && func->cmp_type != ROW_RESULT)
       {
-        Item **arg, **end;
-        for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
-             arg < end ; arg++)
+        /* 
+          Create one Item_type constant object. We'll need it as
+          get_mm_parts only accepts constant values wrapped in Item_Type
+          objects.
+          We create the Item on param->mem_root which points to
+          per-statement mem_root (while thd->mem_root is currently pointing
+          to mem_root local to range optimizer).
+        */
+        MEM_ROOT *tmp_root= param->mem_root;
+        param->thd->mem_root= param->old_root;
+        Item *value_item= func->array->create_item();
+        param->thd->mem_root= tmp_root;
+
+        if (!value_item)
+          break;
+        
+        /* Get a SEL_TREE for "-inf < X < c_0" interval */
+        func->array->value_to_item(0, value_item);
+        tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
+                           value_item, cmp_type);
+        if (!tree)
+          break;
+#define NOT_IN_IGNORE_THRESHOLD 1000        
+        SEL_TREE *tree2;
+        if (func->array->count < NOT_IN_IGNORE_THRESHOLD)
         {
-          tree=  tree_and(param, tree, get_ne_mm_tree(param, cond_func, field, 
-                                                      *arg, *arg, cmp_type));
+          for (uint i=1; i < func->array->count; i++)
+          {
+            if (func->array->compare_elems(i, i-1))
+            {
+              /* Get a SEL_TREE for "-inf < X < c_i" interval */
+              func->array->value_to_item(i, value_item);
+              tree2= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
+                                  value_item, cmp_type);
+              
+              /* Change all intervals to be "c_{i-1} < X < c_i" */
+              for (uint idx= 0; idx < param->keys; idx++)
+              {
+                SEL_ARG *new_interval;
+                if ((new_interval=  tree2->keys[idx]))
+                {
+                  SEL_ARG *last_val= tree->keys[idx]->last();
+                  new_interval->min_value= last_val->max_value;
+                  new_interval->min_flag= NEAR_MIN;
+                }
+              }
+              tree= tree_or(param, tree, tree2);
+            }
+          }
+        }
+        else
+          func->array->value_to_item(func->array->count - 1, value_item);
+
+        /* 
+          Get the SEL_TREE for the last "c_last < X < +inf" interval 
+          (value_item cotains c_last already)
+        */
+        tree2= get_mm_parts(param, cond_func, field, Item_func::GT_FUNC,
+                            value_item, cmp_type);
+        tree= tree_or(param, tree, tree2);
+      }
+      else
+      {
+        tree= get_ne_mm_tree(param, cond_func, field,
+                             func->arguments()[1], func->arguments()[1],
+                             cmp_type);
+        if (tree)
+        {
+          Item **arg, **end;
+          for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
+               arg < end ; arg++)
+          {
+            tree=  tree_and(param, tree, get_ne_mm_tree(param, cond_func, field, 
+                                                        *arg, *arg, cmp_type));
+          }
         }
       }
     }

--- 1.540/sql/sql_parse.cc	2006-04-25 10:57:27 +02:00
+++ 1.541/sql/sql_parse.cc	2006-04-26 16:28:25 +02:00
@@ -1022,13 +1022,20 @@
     *passwd++ : strlen(passwd);
   db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
     db + passwd_len + 1 : 0;
+  uint db_len= db ? strlen(db) : 0;
+
+  if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
+  {
+    inc_host_errors(&thd->remote.sin_addr);
+    return ER_HANDSHAKE_ERROR;
+  }
 
   /* Since 4.1 all database names are stored in utf8 */
   if (db)
   {
     db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
                              system_charset_info,
-                             db, strlen(db),
+                             db, db_len,
                              thd->charset(), &dummy_errors)]= 0;
     db= db_buff;
   }
@@ -1606,7 +1613,17 @@
   {
     char *db, *tbl_name;
     uint db_len= *(uchar*) packet;
+    if (db_len >= packet_length || db_len > NAME_LEN)
+    {
+      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+      break;
+    }
     uint tbl_len= *(uchar*) (packet + db_len + 1);
+    if (db_len+tbl_len+2 > packet_length || tbl_len > NAME_LEN)
+    {
+      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+      break;
+    }
 
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     thd->enable_slow_log= opt_log_slow_admin_statements;

--- 1.94/sql/share/errmsg.txt	2006-04-24 12:32:03 +02:00
+++ 1.95/sql/share/errmsg.txt	2006-04-26 16:42:01 +02:00
@@ -5818,6 +5818,10 @@
         eng  "The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead."
 ER_SP_NO_AGGREGATE 42000
 	eng "AGGREGATE is not supported for stored functions"
+ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
+        eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
+ER_VIEW_RECURSIVE
+        eng "`%-.64s`.`%-.64s` contains view recursion"
 ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
 	eng "Cannot switch out of the row-based binary log format when the session has open temporary tables"
 ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
@@ -5834,7 +5838,3 @@
 ER_WRONG_PARTITION_NAME
         eng "Incorrect partition name"
         swe "Felaktigt partitionsnamn"
-ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
-        eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
-ER_VIEW_RECURSIVE
-        eng "`%-.64s`.`%-.64s` contain view recursion"

--- 1.157/mysql-test/r/view.result	2006-04-25 16:09:26 +02:00
+++ 1.158/mysql-test/r/view.result	2006-04-26 16:28:24 +02:00
@@ -2606,7 +2606,7 @@
 drop table t1;
 rename table v2 to t1;
 select * from v1;
-ERROR HY000: `test`.`v1` contain view recursion
+ERROR HY000: `test`.`v1` contains view recursion
 drop view t1, v1;
 create table t1 (a int);
 create function f1() returns int

--- 1.42.7.1/ndb/include/mgmapi/mgmapi.h	2006-04-26 15:55:24 +02:00
+++ 1.51/storage/ndb/include/mgmapi/mgmapi.h	2006-04-26 16:28:26 +02:00
@@ -171,7 +171,6 @@
     = NODE_TYPE_MGM
 #endif
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
-    ,NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP  /** A replication node */
     ,NDB_MGM_NODE_TYPE_MIN     = 0          /** Min valid value*/
     ,NDB_MGM_NODE_TYPE_MAX     = 3          /** Max valid value*/
 #endif

--- 1.24.9.1/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-04-26 15:55:24 +02:00
+++ 1.34/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-04-26 16:28:26 +02:00
@@ -63,7 +63,10 @@
 
   if (ndb_mgm_set_connectstring(m_handle, _connect_string))
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     DBUG_VOID_RETURN;
   }
   resetError();
@@ -150,7 +153,10 @@
   ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
   if(conf == 0)
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     return 0;
   }
   return conf;
@@ -361,7 +367,10 @@
       no_retries--;
       NdbSleep_SecSleep(retry_delay_in_seconds);
     }
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
   } else
     setError(CR_ERROR, "management server handle not initialized");    
   return 0;

--- 1.39.6.1/ndb/src/kernel/vm/Configuration.cpp	2006-04-26 15:55:24 +02:00
+++ 1.48/storage/ndb/src/kernel/vm/Configuration.cpp	2006-04-26 16:28:26 +02:00
@@ -657,13 +657,9 @@
     case NODE_TYPE_API:
       noOfAPINodes++; // No of API processes
       break;
-    case NODE_TYPE_REP:
-      break;
     case NODE_TYPE_MGM:
       noOfMGMNodes++; // No of MGM processes
       break;
-    case NODE_TYPE_EXT_REP:
-      break;
     default:
       BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
       ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
@@ -728,14 +724,14 @@
      */
     // Can keep 65536 pages (= 0.5 GByte)
     cfg.put(CFG_ACC_DIR_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
     
     cfg.put(CFG_ACC_DIR_ARRAY,
 	    (noOfIndexPages >> 8) + 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     /*-----------------------------------------------------------------------*/
     // The extra operation records added are used by the scan and node 
@@ -751,14 +747,11 @@
     
     cfg.put(CFG_ACC_OVERFLOW_RECS,
 	    noOfIndexPages + 
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_PAGE8, 
 	    noOfIndexPages + 32);
     
-    cfg.put(CFG_ACC_ROOT_FRAG, 
-	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
-    
     cfg.put(CFG_ACC_TABLE, noOfAccTables);
     
     cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
@@ -841,7 +834,7 @@
      * Tup Size Alt values
      */
     cfg.put(CFG_TUP_FRAG, 
-	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_OP_RECS, 
 	    noOfLocalOperations + 50);
@@ -850,14 +843,14 @@
 	    noOfDataPages);
     
     cfg.put(CFG_TUP_PAGE_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_TABLE, 
 	    noOfMetaTables);
     
     cfg.put(CFG_TUP_TABLE_DESC, 
-	    2 * 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
-	    2 * 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
+	    6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
+	    10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
     
     cfg.put(CFG_TUP_STORED_PROC,
 	    noOfLocalScanRecords);
@@ -871,7 +864,7 @@
 	    noOfMetaTables /*noOfOrderedIndexes*/);
     
     cfg.put(CFG_TUX_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
     
     cfg.put(CFG_TUX_ATTRIBUTE, 
 	    noOfOrderedIndexes * 4);

--- 1.44.16.1/ndb/src/mgmapi/mgmapi.cpp	2006-04-26 15:55:24 +02:00
+++ 1.62/storage/ndb/src/mgmapi/mgmapi.cpp	2006-04-26 16:28:26 +02:00
@@ -138,6 +138,12 @@
     return ret; \
   }
 
+#define DBUG_CHECK_REPLY(reply, ret) \
+  if (reply == NULL) { \
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, ""); \
+    DBUG_RETURN(ret);                                    \
+  }
+
 /*****************************************************************************
  * Handles
  *****************************************************************************/
@@ -194,7 +200,7 @@
     handle->cfg.~LocalConfig();
     new (&(handle->cfg)) LocalConfig;
     handle->cfg.init(0, 0); /* reset the LocalConfig */
-    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, mgmsrv ? mgmsrv : "");
     DBUG_RETURN(-1);
   }
   handle->cfg_i= -1;
@@ -2176,9 +2182,9 @@
 				     int param,
 				     int value,
 				     struct ndb_mgm_reply* mgmreply){
-  DBUG_ENTER("ndb_mgm_set_connection_int_parameter");
   CHECK_HANDLE(handle, 0);
   CHECK_CONNECTED(handle, 0);
+  DBUG_ENTER("ndb_mgm_set_connection_int_parameter");
   
   Properties args;
   args.put("node1", node1);
@@ -2195,7 +2201,7 @@
   
   const Properties *prop;
   prop= ndb_mgm_call(handle, reply, "set connection parameter", &args);
-  CHECK_REPLY(prop, -1);
+  DBUG_CHECK_REPLY(prop, -1);
 
   int res= -1;
   do {
@@ -2219,9 +2225,9 @@
 				     int param,
 				     int *value,
 				     struct ndb_mgm_reply* mgmreply){
-  DBUG_ENTER("ndb_mgm_get_connection_int_parameter");
   CHECK_HANDLE(handle, -1);
   CHECK_CONNECTED(handle, -2);
+  DBUG_ENTER("ndb_mgm_get_connection_int_parameter");
   
   Properties args;
   args.put("node1", node1);
@@ -2237,7 +2243,7 @@
   
   const Properties *prop;
   prop = ndb_mgm_call(handle, reply, "get connection parameter", &args);
-  CHECK_REPLY(prop, -3);
+  DBUG_CHECK_REPLY(prop, -3);
 
   int res= -1;
   do {
@@ -2285,9 +2291,9 @@
 {
   Uint32 nodeid=0;
 
-  DBUG_ENTER("ndb_mgm_get_mgmd_nodeid");
   CHECK_HANDLE(handle, 0);
   CHECK_CONNECTED(handle, 0);
+  DBUG_ENTER("ndb_mgm_get_mgmd_nodeid");
   
   Properties args;
 
@@ -2299,7 +2305,7 @@
   
   const Properties *prop;
   prop = ndb_mgm_call(handle, reply, "get mgmd nodeid", &args);
-  CHECK_REPLY(prop, 0);
+  DBUG_CHECK_REPLY(prop, 0);
 
   if(!prop->get("nodeid",&nodeid)){
     fprintf(handle->errstream, "Unable to get value\n");
@@ -2313,9 +2319,9 @@
 extern "C"
 int ndb_mgm_report_event(NdbMgmHandle handle, Uint32 *data, Uint32 length)
 {
-  DBUG_ENTER("ndb_mgm_report_event");
   CHECK_HANDLE(handle, 0);
   CHECK_CONNECTED(handle, 0);
+  DBUG_ENTER("ndb_mgm_report_event");
 
   Properties args;
   args.put("length", length);
@@ -2334,7 +2340,7 @@
   
   const Properties *prop;
   prop = ndb_mgm_call(handle, reply, "report event", &args);
-  CHECK_REPLY(prop, -1);
+  DBUG_CHECK_REPLY(prop, -1);
 
   DBUG_RETURN(0);
 }
@@ -2342,9 +2348,9 @@
 extern "C"
 int ndb_mgm_end_session(NdbMgmHandle handle)
 {
-  DBUG_ENTER("ndb_mgm_end_session");
   CHECK_HANDLE(handle, 0);
   CHECK_CONNECTED(handle, 0);
+  DBUG_ENTER("ndb_mgm_end_session");
 
   SocketOutputStream s_output(handle->socket);
   s_output.println("end session");

--- 1.73.20.2/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-04-26 15:55:24 +02:00
+++ 1.93/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-04-26 16:28:26 +02:00
@@ -37,10 +37,10 @@
 #include <signaldata/EventReport.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
 #include <signaldata/ManagementServer.hpp>
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
 #include <NdbSleep.h>
 #include <EventLogger.hpp>
 #include <DebuggerNames.hpp>
@@ -485,10 +485,6 @@
       case NODE_TYPE_MGM:
 	nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
 	break;
-      case NODE_TYPE_REP:
-	nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
-	break;
-      case NODE_TYPE_EXT_REP:
       default:
 	break;
       }
@@ -571,8 +567,7 @@
       DBUG_RETURN(false);
     }
   }
-  theFacade= TransporterFacade::theFacadeInstance
-    = new TransporterFacade();
+  theFacade= new TransporterFacade();
   
   if(theFacade == 0) {
     DEBUG("MgmtSrvr.cpp: theFacade is NULL.");
@@ -1819,9 +1814,6 @@
     break;
   case GSN_EVENT_REP:
   {
-    EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend());
-    if (rep->getNodeId() == 0)
-      rep->setNodeId(refToNode(signal->theSendersBlockRef));
     eventReport(signal->getDataPtr());
     break;
   }
@@ -1862,7 +1854,6 @@
       DBUG_VOID_RETURN;
     }
   }
-  
   rep->setNodeId(_ownNodeId);
   eventReport(theData);
   DBUG_VOID_RETURN;
@@ -1935,6 +1926,88 @@
   }
 }
 
+int
+MgmtSrvr::alloc_node_id_req(Uint32 free_node_id)
+{
+  SignalSender ss(theFacade);
+  ss.lock(); // lock will be released on exit
+
+  SimpleSignal ssig;
+  AllocNodeIdReq* req = CAST_PTR(AllocNodeIdReq, ssig.getDataPtrSend());
+  ssig.set(ss, TestOrd::TraceAPI, QMGR, GSN_ALLOC_NODEID_REQ,
+	   AllocNodeIdReq::SignalLength);
+  
+  req->senderRef = ss.getOwnRef();
+  req->senderData = 19;
+  req->nodeId = free_node_id;
+
+  int do_send = 1;
+  NodeId nodeId = 0;
+  while (1)
+  {
+    if (nodeId == 0)
+    {
+      bool next;
+      while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+            theFacade->get_node_alive(nodeId) == false);
+      if (!next)
+        return NO_CONTACT_WITH_DB_NODES;
+      do_send = 1;
+    }
+    if (do_send)
+    {
+      if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
+        return SEND_OR_RECEIVE_FAILED;
+      }
+      do_send = 0;
+    }
+    
+    SimpleSignal *signal = ss.waitFor();
+
+    int gsn = signal->readSignalNumber();
+    switch (gsn) {
+    case GSN_ALLOC_NODEID_CONF:
+    {
+      const AllocNodeIdConf * const conf =
+        CAST_CONSTPTR(AllocNodeIdConf, signal->getDataPtr());
+      return 0;
+    }
+    case GSN_ALLOC_NODEID_REF:
+    {
+      const AllocNodeIdRef * const ref =
+        CAST_CONSTPTR(AllocNodeIdRef, signal->getDataPtr());
+      if (ref->errorCode == AllocNodeIdRef::NotMaster ||
+          ref->errorCode == AllocNodeIdRef::Busy)
+      {
+        do_send = 1;
+        nodeId = refToNode(ref->masterRef);
+        continue;
+      }
+      return ref->errorCode;
+    }
+    case GSN_NF_COMPLETEREP:
+    {
+      const NFCompleteRep * const rep =
+        CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr());
+#ifdef VM_TRACE
+      ndbout_c("Node %d fail completed", rep->failedNodeId);
+#endif
+      if (rep->failedNodeId == nodeId)
+        nodeId = 0;
+      continue;
+    }
+    case GSN_NODE_FAILREP:{
+      // ignore NF_COMPLETEREP will come
+      continue;
+    }
+    default:
+      report_unknown_signal(signal);
+      return SEND_OR_RECEIVE_FAILED;
+    }
+  }
+  return 0;
+}
+
 bool
 MgmtSrvr::alloc_node_id(NodeId * nodeId, 
 			enum ndb_mgm_node_type type,
@@ -2065,6 +2138,39 @@
   }
   NdbMutex_Unlock(m_configMutex);
 
+  if (id_found && client_addr != 0)
+  {
+    int res = alloc_node_id_req(id_found);
+    unsigned save_id_found = id_found;
+    switch (res)
+    {
+    case 0:
+      // ok continue
+      break;
+    case NO_CONTACT_WITH_DB_NODES:
+      // ok continue
+      break;
+    default:
+      // something wrong
+      id_found = 0;
+      break;
+
+    }
+    if (id_found == 0)
+    {
+      char buf[128];
+      ndb_error_string(res, buf, sizeof(buf));
+      error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
+			  save_id_found, res, buf);
+      g_eventLogger.warning("Cluster refused allocation of id %d. "
+                            "Connection from ip %s. "
+                            "Returned error string \"%s\"", save_id_found,
+                            inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr),
+                            error_string.c_str());
+      DBUG_RETURN(false);
+    }
+  }
+
   if (id_found)
   {
     *nodeId= id_found;
@@ -2431,17 +2537,6 @@
   return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : SEND_OR_RECEIVE_FAILED;
 }
 
-
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
-  require(false);
-  return 0;
-}
 
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)

--- 1.30.11.2/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-04-26 15:55:24 +02:00
+++ 1.43/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-04-26 16:28:26 +02:00
@@ -343,11 +343,6 @@
   int abortBackup(Uint32 backupId);
   int performBackup(Uint32* backupId);
 
-  /**
-   * Global Replication
-   */
-  int repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted = false);
-  
   //**************************************************************************
   // Description: Set event report level for a DB process
   // Parameters:
@@ -524,7 +519,8 @@
    *   @return  -1 if block not found, otherwise block number
    */
   int getBlockNumber(const BaseString &blockName);
-  
+
+  int alloc_node_id_req(Uint32 free_node_id);
   //**************************************************************************
   
   int _blockNumber;

--- 1.45.16.2/ndb/src/mgmsrv/Services.cpp	2006-04-26 15:55:24 +02:00
+++ 1.62/storage/ndb/src/mgmsrv/Services.cpp	2006-04-26 16:42:01 +02:00
@@ -468,9 +468,9 @@
     return;
   }
 
-  struct sockaddr addr;
+  struct sockaddr_in addr;
   SOCKET_SIZE_TYPE addrlen= sizeof(addr);
-  int r = getpeername(m_socket, &addr, &addrlen);
+  int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen);
   if (r != 0 ) {
     m_output->println(cmd);
     m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r);
@@ -485,7 +485,8 @@
     NDB_TICKS tick= 0;
     /* only report error on second attempt as not to clog the cluster log */
     while (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, 
-                                   &addr, &addrlen, error_code, error_string,
+                                   (struct sockaddr*)&addr, &addrlen,
+                                   error_code, error_string,
                                    tick == 0 ? 0 : log_event))
     {
       /* NDB_MGM_ALLOCID_CONFIG_MISMATCH is a non retriable error */

--- 1.296/sql/ha_ndbcluster.cc	2006-04-25 12:42:14 +02:00
+++ 1.297/sql/ha_ndbcluster.cc	2006-04-26 16:42:01 +02:00
@@ -7267,11 +7267,24 @@
 {
   DBUG_ENTER("ndb_get_table_statistics");
   DBUG_PRINT("enter", ("table: %s", table));
-  NdbTransaction* pTrans= ndb->startTransaction();
-  if (pTrans == NULL)
-    ERR_RETURN(ndb->getNdbError());
-  do 
+  NdbTransaction* pTrans;
+  int retries= 10;
+  int retry_sleep= 30 * 1000; /* 30 milliseconds */
+
+  do
   {
+    pTrans= ndb->startTransaction();
+    if (pTrans == NULL)
+    {
+      if (ndb->getNdbError().status == NdbError::TemporaryError &&
+          retries--)
+      {
+        my_sleep(retry_sleep);
+        continue;
+      }
+      ERR_RETURN(ndb->getNdbError());
+    }
+
     NdbScanOperation* pOp= pTrans->getNdbScanOperation(table);
     if (pOp == NULL)
       break;
@@ -7294,8 +7307,18 @@
                            NdbTransaction::AbortOnError,
                            TRUE);
     if (check == -1)
+    {
+      if (pTrans->getNdbError().status == NdbError::TemporaryError &&
+          retries--)
+      {
+        ndb->closeTransaction(pTrans);
+        pTrans= 0;
+        my_sleep(retry_sleep);
+        continue;
+      }
       break;
-    
+    }
+
     Uint32 count= 0;
     Uint64 sum_rows= 0;
     Uint64 sum_commits= 0;
@@ -7329,7 +7352,7 @@
                         sum_mem, count));
 
     DBUG_RETURN(0);
-  } while (0);
+  } while(1);
 
   if (pTrans)
     ndb->closeTransaction(pTrans);
Thread
bk commit into 5.1 tree (tomas:1.2364)tomas26 Apr