List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:April 24 2006 10:17pm
Subject:bk commit into 5.1 tree (cmiller:1.2363)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cmiller. When cmiller 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.2363 06/04/24 16:17:50 cmiller@zippy.(none) +7 -0
  Merge zippy.(none):/home/cmiller/work/mysql/merge/jimw_merge
  into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.62 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Emulator.cpp
    1.23 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.49.9.2 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp ->
storage/ndb/src/mgmclient/CommandInterpreter.cpp

  storage/ndb/src/kernel/vm/Emulator.cpp
    1.15.5.2 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Merge rename: ndb/src/kernel/vm/Emulator.cpp ->
storage/ndb/src/kernel/vm/Emulator.cpp

  sql/item_strfunc.h
    1.107 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  sql/item_strfunc.cc
    1.268 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  mysql-test/t/mysql.test
    1.11 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  mysql-test/r/func_str.result
    1.113 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

  client/mysql.cc
    1.203 06/04/24 16:17:44 cmiller@zippy.(none) +0 -0
    Auto merged

# 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:	cmiller
# Host:	zippy.(none)
# Root:	/home/cmiller/work/mysql/merge/mysql-5.1-new/RESYNC

--- 1.202/client/mysql.cc	2006-04-18 11:13:49 -04:00
+++ 1.203/client/mysql.cc	2006-04-24 16:17:44 -04:00
@@ -2241,8 +2241,10 @@
   MYSQL_ROW	cur;
   MYSQL_FIELD	*field;
   bool		*num_flag;
+  bool		*not_null_flag;
 
   num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
+  not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
   if (info_flag)
   {
     print_field_types(result);
@@ -2260,7 +2262,7 @@
       length=max(length,field->max_length);
     if (length < 4 && !IS_NOT_NULL(field->flags))
       length=4;					// Room for "NULL"
-    field->max_length=length+1;
+    field->max_length=length;
     separator.fill(separator.length()+length+2,'-');
     separator.append('+');
   }
@@ -2272,10 +2274,11 @@
     (void) tee_fputs("|", PAGER);
     for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
     {
-      tee_fprintf(PAGER, " %-*s|",(int) min(field->max_length,
+      tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
                                             MAX_COLUMN_LENGTH),
 		  field->name);
       num_flag[off]= IS_NUM(field->type);
+      not_null_flag[off]= IS_NOT_NULL(field->flags);
     }
     (void) tee_fputs("\n", PAGER);
     tee_puts((char*) separator.ptr(), PAGER);
@@ -2295,7 +2298,8 @@
       uint visible_length;
       uint extra_padding;
 
-      if (lengths[off] == 0) 
+      /* If this column may have a null value, use "NULL" for empty.  */
+      if (! not_null_flag[off] && (lengths[off] == 0))
       {
         buffer= "NULL";
         data_length= 4;
@@ -2335,6 +2339,7 @@
   }
   tee_puts((char*) separator.ptr(), PAGER);
   my_afree((gptr) num_flag);
+  my_afree((gptr) not_null_flag);
 }
 
 
@@ -2349,11 +2354,8 @@
   unsigned int i;
   const char *p;
 
-  total_bytes_to_send -= 1;  
-  /* Off by one, perhaps mistakenly accounting for a terminating NUL. */
-
   if (right_justified) 
-    for (i= 0; i < (total_bytes_to_send - data_length); i++)
+    for (i= data_length; i < total_bytes_to_send; i++)
       tee_putc((int)' ', PAGER);
 
   for (i= 0, p= data; i < data_length; i+= 1, p+= 1)
@@ -2365,7 +2367,7 @@
   }
 
   if (! right_justified) 
-    for (i= 0; i < (total_bytes_to_send - data_length); i++)
+    for (i= data_length; i < total_bytes_to_send; i++)
       tee_putc((int)' ', PAGER);
 }
 

--- 1.267/sql/item_strfunc.cc	2006-03-29 09:03:56 -05:00
+++ 1.268/sql/item_strfunc.cc	2006-04-24 16:17:44 -04:00
@@ -80,6 +80,20 @@
 }
 
 
+my_decimal *Item_str_func::val_decimal(my_decimal *decimal_value)
+{
+  DBUG_ASSERT(fixed == 1);
+  char buff[64];
+  String *res, tmp(buff,sizeof(buff), &my_charset_bin);
+  res= val_str(&tmp);
+  if (!res)
+    return 0;
+  (void)str2my_decimal(E_DEC_FATAL_ERROR, (char*) res->ptr(),
+                       res->length(), res->charset(), decimal_value);
+  return decimal_value;
+}
+
+
 double Item_str_func::val_real()
 {
   DBUG_ASSERT(fixed == 1);

--- 1.106/sql/item_strfunc.h	2006-03-07 14:00:42 -05:00
+++ 1.107/sql/item_strfunc.h	2006-04-24 16:17:44 -04:00
@@ -33,6 +33,7 @@
   Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
   longlong val_int();
   double val_real();
+  my_decimal *val_decimal(my_decimal *);
   enum Item_result result_type () const { return STRING_RESULT; }
   void left_right_max_length();
   String *check_well_formed_result(String *str);

--- 1.15.5.1/ndb/src/kernel/vm/Emulator.cpp	2006-04-18 03:39:00 -04:00
+++ 1.23/storage/ndb/src/kernel/vm/Emulator.cpp	2006-04-24 16:17:44 -04:00
@@ -28,6 +28,7 @@
 #include "SimBlockList.hpp"
 
 #include <NodeState.hpp>
+#include "ndbd_malloc_impl.hpp"
 
 #include <NdbMem.h>
 #include <NdbMutex.h>
@@ -77,6 +78,7 @@
   theSimBlockList  = 0;
   theShutdownMutex = 0;
   m_socket_server = 0;
+  m_mem_manager = 0;
 }
 
 void
@@ -93,6 +95,7 @@
   theThreadConfig  = new ThreadConfig();
   theSimBlockList  = new SimBlockList();
   m_socket_server  = new SocketServer();
+  m_mem_manager    = new Ndbd_mem_manager();
 
   theShutdownMutex = NdbMutex_Create();
 
@@ -112,6 +115,9 @@
   if(m_socket_server)
     delete m_socket_server; m_socket_server = 0;
   NdbMutex_Destroy(theShutdownMutex);
+  if (m_mem_manager)
+    delete m_mem_manager; m_mem_manager = 0;
+  
   NdbMem_Destroy();
 }
 

--- 1.49.9.1/ndb/src/mgmclient/CommandInterpreter.cpp	2006-04-19 03:14:30 -04:00
+++ 1.62/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2006-04-24 16:17:44 -04:00
@@ -16,14 +16,7 @@
 
 #include <ndb_global.h>
 #include <my_sys.h>
-
-//#define HAVE_GLOBAL_REPLICATION
-
 #include <Vector.hpp>
-#ifdef  HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
 #include <mgmapi.h>
 #include <util/BaseString.hpp>
 
@@ -166,11 +159,6 @@
   int m_verbose;
   int try_reconnect;
   int m_error;
-#ifdef HAVE_GLOBAL_REPLICATION  
-  NdbRepHandle m_repserver;
-  const char *rep_host;
-  bool rep_connected;
-#endif
   struct NdbThread* m_event_thread;
 };
 
@@ -228,10 +216,6 @@
 #include <NdbMem.h>
 #include <EventLogger.hpp>
 #include <signaldata/SetLogLevelOrd.hpp>
-#include <signaldata/GrepImpl.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-
-#endif // HAVE_GLOBAL_REPLICATION
 #include "MgmtErrorReporter.hpp"
 #include <Parser.hpp>
 #include <SocketServer.hpp>
@@ -259,9 +243,6 @@
 "---------------------------------------------------------------------------\n"
 "HELP                                   Print help text\n"
 "HELP SHOW                              Help for SHOW command\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"HELP REPLICATION                       Help for global replication\n"
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
 "HELP DEBUG                             Help for debug compiled version\n"
 #endif
@@ -285,9 +266,6 @@
 "EXIT SINGLE USER MODE                  Exit single user mode\n"
 "<id> STATUS                            Print status\n"
 "<id> CLUSTERLOG {<category>=<level>}+  Set log level for cluster
log\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"REP CONNECT <host:port>                Connect to REP server on host:port\n"
-#endif
 "PURGE STALE SESSIONS                   Reset reserved nodeid's in the mgmt server\n"
 "CONNECT [<connectstring>]              Connect to management server (reconnect if
already connected)\n"
 "QUIT                                   Quit management client\n"
@@ -305,39 +283,6 @@
 #endif
 ;
 
-#ifdef HAVE_GLOBAL_REPLICATION
-static const char* helpTextRep =
-"---------------------------------------------------------------------------\n"
-" NDB Cluster -- Management Client -- Help for Global Replication\n"
-"---------------------------------------------------------------------------\n"
-"Commands should be executed on the standby NDB Cluster\n"
-"These features are in an experimental release state.\n"
-"\n"
-"Simple Commands:\n"
-"REP START              Start Global Replication\n" 
-"REP START REQUESTOR    Start Global Replication Requestor\n" 
-"REP STATUS             Show Global Replication status\n" 
-"REP STOP               Stop Global Replication\n"
-"REP STOP REQUESTOR     Stop Global Replication Requestor\n"
-"\n" 
-"Advanced Commands:\n"
-"REP START <protocol>   Starts protocol\n"
-"REP STOP <protocol>    Stops protocol\n"
-"<protocol> = TRANSFER | APPLY | DELETE\n"
-"\n"
-#ifdef VM_TRACE // DEBUG ONLY
-"Debugging commands:\n"
-"REP DELETE             Removes epochs stored in primary and standy systems\n"
-"REP DROP <tableid>     Drop a table in SS identified by table id\n"
-"REP SLOWSTOP           Stop Replication (Tries to synchonize with primary)\n" 
-"REP FASTSTOP           Stop Replication (Stops in consistent state)\n" 
-"<component> = SUBSCRIPTION\n"
-"              METALOG | METASCAN | DATALOG | DATASCAN\n"
-"              REQUESTOR | TRANSFER | APPLY | DELETE\n"
-#endif
-;
-#endif // HAVE_GLOBAL_REPLICATION
-
 #ifdef VM_TRACE // DEBUG ONLY
 static const char* helpTextDebug =
 "---------------------------------------------------------------------------\n"
@@ -409,11 +354,6 @@
   m_connected= false;
   m_event_thread= 0;
   try_reconnect = 0;
-#ifdef HAVE_GLOBAL_REPLICATION
-  rep_host = NULL;
-  m_repserver = NULL;
-  rep_connected = false;
-#endif
 }
 
 /*
@@ -713,13 +653,6 @@
     executePurge(allAfterFirstToken);
     DBUG_RETURN(true);
   } 
-#ifdef HAVE_GLOBAL_REPLICATION
-  else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
-	  strcasecmp(firstToken, "REP") == 0) {
-    executeRep(allAfterFirstToken);
-    DBUG_RETURN(true);
-  }
-#endif // HAVE_GLOBAL_REPLICATION
   else if(strcasecmp(firstToken, "ENTER") == 0 &&
 	  allAfterFirstToken != NULL &&
 	  strncasecmp(allAfterFirstToken, "SINGLE USER MODE ", 
@@ -1026,11 +959,6 @@
     ndbout << endl;
   } else if (strcasecmp(parameters, "SHOW") == 0) {
     ndbout << helpTextShow;
-#ifdef HAVE_GLOBAL_REPLICATION
-  } else if (strcasecmp(parameters, "REPLICATION") == 0 ||
-	     strcasecmp(parameters, "REP") == 0) {
-    ndbout << helpTextRep;
-#endif // HAVE_GLOBAL_REPLICATION
 #ifdef VM_TRACE // DEBUG ONLY
   } else if (strcasecmp(parameters, "DEBUG") == 0) {
     ndbout << helpTextDebug;
@@ -1275,8 +1203,6 @@
       case NDB_MGM_NODE_TYPE_UNKNOWN:
         ndbout << "Error: Unknown Node Type" << endl;
         return;
-      case NDB_MGM_NODE_TYPE_REP:
-	abort();
       }
     }
 
@@ -2216,226 +2142,5 @@
   ndbout << "Invalid arguments: expected <BackupId>" << endl;
   return;
 }
-
-#ifdef HAVE_GLOBAL_REPLICATION
-/*****************************************************************************
- * Global Replication
- *
- * For information about the different commands, see
- * GrepReq::Request in file signaldata/grepImpl.cpp.
- *
- * Below are commands as of 2003-07-05 (may change!):
- * START = 0,            ///< Start Global Replication (all phases)
- * START_METALOG = 1,    ///< Start Global Replication (all phases)
- * START_METASCAN = 2,   ///< Start Global Replication (all phases)
- * START_DATALOG = 3,    ///< Start Global Replication (all phases)
- * START_DATASCAN = 4,   ///< Start Global Replication (all phases)
- * START_REQUESTOR = 5,  ///< Start Global Replication (all phases)
- * ABORT = 6,            ///< Immediate stop (removes subscription)
- * SLOW_STOP = 7,        ///< Stop after finishing applying current GCI epoch
- * FAST_STOP = 8,        ///< Stop after finishing applying all PS GCI epochs
- * START_TRANSFER = 9,   ///< Start SS-PS transfer
- * STOP_TRANSFER = 10,   ///< Stop SS-PS transfer
- * START_APPLY = 11,     ///< Start applying GCI epochs in SS
- * STOP_APPLY = 12,      ///< Stop applying GCI epochs in SS
- * STATUS = 13,           ///< Status
- * START_SUBSCR = 14,
- * REMOVE_BUFFERS = 15,
- * DROP_TABLE = 16
-
- *****************************************************************************/
-
-void
-CommandInterpreter::executeRep(char* parameters) 
-{
-  if (emptyString(parameters)) {
-    ndbout << helpTextRep;
-    return;
-  }
-
-  char * line = my_strdup(parameters,MYF(MY_WME));
-  My_auto_ptr<char> ap1((char*)line);
-  char * firstToken = strtok(line, " ");
-  
-  struct ndb_rep_reply  reply;
-  unsigned int          repId;
-
-
-  if (!strcasecmp(firstToken, "CONNECT")) {
-    char * host = strtok(NULL, "\0");
-    for (unsigned int i = 0; i < strlen(host); ++i) {
-      host[i] = tolower(host[i]);
-    }
-    
-    if(host == NULL)
-    {
-      ndbout_c("host:port must be specified.");
-      return;
-    }
-    
-    if(rep_connected) {
-      if(m_repserver != NULL) {
-	ndb_rep_disconnect(m_repserver);
-	rep_connected = false;
-      }       
-    }
-          
-    if(m_repserver == NULL)
-      m_repserver = ndb_rep_create_handle();
-    if(ndb_rep_connect(m_repserver, host) < 0)
-      ndbout_c("Failed to connect to %s", host); 
-    else
-      rep_connected=true;
-    return;
-    
-    if(!rep_connected) {
-      ndbout_c("Not connected to REP server");
-    }
-  }
-    
-  /********
-   * START 
-   ********/
-  if (!strcasecmp(firstToken, "START")) {
-    
-    unsigned int          req;
-    char *startType = strtok(NULL, "\0");
-    
-    if (startType == NULL) {                
-      req = GrepReq::START;
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::START_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::START_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::START_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::START_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::START_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::START_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::START_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::START_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::START_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION START'");
-      return;
-    }
-
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-    
-    if (result != 0) {
-      ndbout << "Start of Global Replication failed" << endl;
-    } else {
-      ndbout << "Start of Global Replication ordered" << endl;
-    }
-    return;
-  }
-
-  /********
-   * STOP
-   ********/
-  if (!strcasecmp(firstToken, "STOP")) {    
-    unsigned int          req;
-    char *startType = strtok(NULL, " ");
-    unsigned int epoch = 0;
-    
-    if (startType == NULL) {                 
-      /**
-       * Stop immediately
-       */
-      req = GrepReq::STOP;
-    } else if (!strcasecmp(startType, "EPOCH")) {  
-      char *strEpoch = strtok(NULL, "\0");
-      if(strEpoch == NULL) {
-	ndbout_c("Epoch expected!");
-	return;
-      }
-      req = GrepReq::STOP;
-      epoch=atoi(strEpoch);      
-    } else if (!strcasecmp(startType, "SUBSCRIPTION")) {  
-      req = GrepReq::STOP_SUBSCR;
-    } else if (!strcasecmp(startType, "METALOG")) { 
-      req = GrepReq::STOP_METALOG;
-    } else if (!strcasecmp(startType, "METASCAN")) {
-      req = GrepReq::STOP_METASCAN;
-    } else if (!strcasecmp(startType, "DATALOG")) {
-      req = GrepReq::STOP_DATALOG;
-    } else if (!strcasecmp(startType, "DATASCAN")) {
-      req = GrepReq::STOP_DATASCAN;
-    } else if (!strcasecmp(startType, "REQUESTOR")) {
-      req = GrepReq::STOP_REQUESTOR;
-    } else if (!strcasecmp(startType, "TRANSFER")) {
-      req = GrepReq::STOP_TRANSFER;
-    } else if (!strcasecmp(startType, "APPLY")) {
-      req = GrepReq::STOP_APPLY;
-    } else if (!strcasecmp(startType, "DELETE")) {
-      req = GrepReq::STOP_DELETE;
-    } else {
-      ndbout_c("Illegal argument to command 'REPLICATION STOP'");
-      return;
-    }
-    int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-    
-    if (result != 0) {
-      ndbout << "Stop command failed" << endl;
-    } else {
-      ndbout << "Stop ordered" << endl;
-    }
-    return;
-  }
-
-  /*********
-   * STATUS
-   *********/
-  if (!strcasecmp(firstToken, "STATUS")) {
-    struct rep_state repstate;
-    int result = 
-      ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Status request of Global Replication failed" << endl;
-    } else {
-      ndbout << "Status request of Global Replication ordered" << endl;
-      ndbout << "See printout at one of the DB nodes" << endl;
-      ndbout << "(Better status report is under development.)" << endl;
-      ndbout << " SubscriptionId " << repstate.subid 
-	     << " SubscriptionKey " << repstate.subkey << endl;
-    }
-    return;
-  }
-
-  /*********
-   * QUERY (see repapi.h for querable counters)
-   *********/
-  if (!strcasecmp(firstToken, "QUERY")) {
-    char *query = strtok(NULL, "\0");
-    int queryCounter=-1;
-    if(query != NULL) {
-      queryCounter = atoi(query);
-    }
-    struct rep_state repstate;
-    unsigned repId = 0;
-    int result = ndb_rep_query(m_repserver, (QueryCounter)queryCounter,
-			       &repId, &reply, &repstate);
-    
-    if (result != 0) {
-      ndbout << "Query repserver failed" << endl;
-    } else {
-      ndbout << "Query repserver sucessful" << endl;
-      ndbout_c("repstate : QueryCounter %d, f=%d l=%d"
-	       " nodegroups %d" , 
-	       repstate.queryCounter,
-	       repstate.first[0], repstate.last[0],
-	       repstate.no_of_nodegroups );
-    }
-    return;
-  }
-}
-#endif // HAVE_GLOBAL_REPLICATION
 
 template class Vector<char const*>;

--- 1.112/mysql-test/r/func_str.result	2006-02-22 04:09:49 -05:00
+++ 1.113/mysql-test/r/func_str.result	2006-04-24 16:17:44 -04:00
@@ -1030,3 +1030,13 @@
 y,abc	abc
 y,abc	abc
 drop table t1;
+select cast(rtrim('  20.06 ') as decimal(19,2));
+cast(rtrim('  20.06 ') as decimal(19,2))
+20.06
+select cast(ltrim('  20.06 ') as decimal(19,2));
+cast(ltrim('  20.06 ') as decimal(19,2))
+20.06
+select cast(rtrim(ltrim('  20.06 ')) as decimal(19,2));
+cast(rtrim(ltrim('  20.06 ')) as decimal(19,2))
+20.06
+End of 5.0 tests

--- 1.10/mysql-test/t/mysql.test	2006-04-14 13:32:57 -04:00
+++ 1.11/mysql-test/t/mysql.test	2006-04-24 16:17:44 -04:00
@@ -67,3 +67,8 @@
 #
 --exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k
char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values
('<----------------------->'); insert into t1 (k) values ('<-----'); insert into
t1 (k) values ('Τη γλώσσα'); insert into t1 (k)
values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
 
+#
+# "DESCRIBE" commands may return strange NULLness flags.
+#
+--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not
null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop
table t1;"
+
Thread
bk commit into 5.1 tree (cmiller:1.2363)Chad MILLER24 Apr