List:Internals« Previous MessageNext Message »
From:mikael Date:May 5 2005 8:13am
Subject:bk commit into 5.1 tree (mronstrom:1.1804)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron 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.1804 05/05/05 10:13:00 mronstrom@stripped +8 -0
  WL 1354 Partitioning:
  After reivew fixes

  sql/table.cc
    1.180 05/05/05 10:12:49 mronstrom@stripped +5 -5
    After reivew fixes

  sql/sql_yacc.yy
    1.354 05/05/05 10:12:49 mronstrom@stripped +123 -125
    After reivew fixes

  sql/sql_table.cc
    1.223 05/05/05 10:12:49 mronstrom@stripped +7 -5
    Review fixes

  sql/share/errmsg.txt
    1.29 05/05/05 10:12:48 mronstrom@stripped +2 -0
    New error code

  sql/mysql_priv.h
    1.261 05/05/05 10:12:48 mronstrom@stripped +1 -1
    Fixed bug that table object wasn't available when method used

  sql/handler.h
    1.148 05/05/05 10:12:48 mronstrom@stripped +23 -38
    Fixed bug that table object wasn't available when method used
    After review fixes

  sql/ha_ndbcluster.h
    1.84 05/05/05 10:12:48 mronstrom@stripped +1 -1
    Fixed bug that table object wasn't available when method used

  sql/ha_ndbcluster.cc
    1.173 05/05/05 10:12:47 mronstrom@stripped +1 -2
    Fixed bug that table object wasn't available when method used

# 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:	mronstrom
# Host:	mikael-ronstr-ms-dator.local
# Root:	/Users/mikron/wl1354_new

--- 1.147/sql/handler.h	Tue Apr 26 14:31:00 2005
+++ 1.148/sql/handler.h	Thu May  5 10:12:48 2005
@@ -397,16 +397,12 @@
   uint part_min_rows;
   
   partition_element()
+  : partition_name(NULL), tablespace_name(NULL), range_expr(NULL),
+    nodegroup_id(UNDEF_NODEGROUP), part_comment(NULL), data_file_name(NULL),
+    index_file_name(NULL), part_max_rows(0), part_min_rows(0)
   {
-    part_comment= NULL;
-    data_file_name= NULL;
-    index_file_name= NULL;
-    part_max_rows= 0;
-    part_min_rows= 0;
-    partition_name= NULL;
-    tablespace_name= NULL;
-    range_expr= NULL;
-    nodegroup_id= UNDEF_NODEGROUP;
+    subpartitions.empty();
+    list_expr_list.empty();
   }
   ~partition_element() {}
 };
@@ -457,8 +453,8 @@
   char* part_info_string;
 
   uint part_info_len;
+  partition_element *curr_part_elem;
   partition_element *current_partition;
-  partition_element *current_subpartition;
   enum db_type default_engine_type;
   /*
     These key_map's are used for Partitioning to enable quick decisions
@@ -468,37 +464,26 @@
   key_map all_fields_in_PF, all_fields_in_PPF, all_fields_in_SPF;
   key_map some_fields_in_PF;
 
-  partition_info() {
-    default_table_space_name= NULL;
-    defined_max_value= FALSE;
-    list_of_part_fields= FALSE;
-    list_of_subpart_fields= FALSE;
-    no_list_values= 0;
-    list_array= NULL;
-    part_field_array= NULL;
-    subpart_field_array= NULL;
-    full_part_field_array= NULL;
-    no_part_fields=0;
-    no_subpart_fields=0;
-    no_full_part_fields=0;
-    part_expr= NULL;
-    subpart_expr= NULL;
-    part_type= NOT_A_PARTITION;
-    subpart_type= NOT_A_PARTITION;
-    no_parts= 0;
-    no_subparts= 0;
-    count_curr_parts= 0;
-    count_curr_subparts= 0;
-    part_error_code= 0;
-    part_info_string= NULL;
-    part_info_len= 0;
-    current_partition= NULL;
-    current_subpartition= NULL;
-    default_engine_type= DB_TYPE_DEFAULT;
+  partition_info()
+  : default_table_space_name(NULL), defined_max_value(FALSE),
+    no_list_values(0), part_field_array(NULL), subpart_field_array(NULL),
+    full_part_field_array(NULL),
+    no_part_fields(0), no_subpart_fields(0), no_full_part_fields(0),
+    part_expr(NULL), subpart_expr(NULL), item_free_list(NULL),
+    part_result_type(INT_RESULT),list_array(NULL),part_type(NOT_A_PARTITION),
+    subpart_type(NOT_A_PARTITION), no_full_parts(0), no_parts(0),
+    no_subparts(0), count_curr_parts(0), count_curr_subparts(0),
+    part_error_code(0), part_info_string(NULL), part_info_len(0),
+    curr_part_elem(NULL), current_partition(NULL),
+    default_engine_type(DB_TYPE_UNKNOWN)
+  {
     all_fields_in_PF.clear_all();
     all_fields_in_PPF.clear_all();
     all_fields_in_SPF.clear_all();
     some_fields_in_PF.clear_all();
+    partitions.empty();
+    part_field_list.empty();
+    subpart_field_list.empty();
   }
   ~partition_info() {}
 };
@@ -871,7 +856,7 @@
   virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
   virtual int create_handler_files(const char *name) { return FALSE;}
 #ifdef HAVE_PARTITION_DB
-  virtual int get_default_no_partitions() { return 0;}
+  virtual int get_default_no_partitions(ulonglong max_rows) { return 0;}
 #endif
   /*
      lock_count() can be more than one if the table is a MERGE or

--- 1.260/sql/mysql_priv.h	Tue Apr 26 14:31:01 2005
+++ 1.261/sql/mysql_priv.h	Thu May  5 10:12:48 2005
@@ -598,7 +598,7 @@
                    byte *key, uint key_len, uint find_flag,
                    uint *start_part, uint *end_part, bool *use_bit_array);
 bool check_partition_info(partition_info *part_info,enum db_type eng_type,
-                          handler *file);
+                          handler *file, ulonglong max_rows);
 uint get_tot_partitions(partition_info *part_info);
 bool is_sub_partitioned(partition_info *part_info);
 

--- 1.222/sql/sql_table.cc	Tue Apr 26 14:31:05 2005
+++ 1.223/sql/sql_table.cc	Thu May  5 10:12:49 2005
@@ -1502,12 +1502,14 @@
     this information in the default_db_type variable, it is either
     DB_TYPE_DEFAULT or the engine set in the ALTER TABLE command.
     */
-    enum db_type part_engine_type;
-    if (create_info->db_type == DB_TYPE_PARTITION_DB)
+    enum db_type part_engine_type= create_info->db_type;
+    if (part_engine_type == DB_TYPE_PARTITION_DB)
+    {
+      /* This only happens at ALTER TABLE */
       part_engine_type= ha_checktype(part_info->default_engine_type);
-    else
-      part_engine_type= create_info->db_type;
-    if (check_partition_info(part_info, part_engine_type, file))
+    }
+    if (check_partition_info(part_info, part_engine_type,
+                             file, create_info->max_rows))
       DBUG_RETURN(TRUE);
     if ((!(file->partition_flags() & HA_CAN_PARTITION)) ||
         create_info->db_type == DB_TYPE_PARTITION_DB)

--- 1.353/sql/sql_yacc.yy	Tue Apr 26 14:31:06 2005
+++ 1.354/sql/sql_yacc.yy	Thu May  5 10:12:49 2005
@@ -31,9 +31,6 @@
 #define Lex (YYTHD->lex)
 #define Select Lex->current_select
 
-#define curr_partition Lex->part_info->current_partition
-#define curr_subpartition Lex->part_info->current_subpartition
-
 #include "mysql_priv.h"
 #include "slave.h"
 #include "lex_symbol.h"
@@ -730,7 +727,7 @@
 	simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
 	bool_term bool_factor bool_test bool_pri 
 	predicate bit_expr bit_term bit_factor value_expr term factor
-	table_wild simple_expr udf_expr
+	table_wild simple_expr udf_expr part_bit_expr part_func_expr
 	using_list expr_or_default set_expr_or_default interval_expr
 	param_marker singlerow_subselect singlerow_subselect_init
 	exists_subselect exists_subselect_init geometry_function
@@ -2575,8 +2572,9 @@
 partitioning:
         PARTITION_SYM
         {
-          Lex->part_info= new partition_info();
-          Lex->part_info->part_info_string= (char*)Lex->tok_start;
+          LEX *lex= Lex;
+          lex->part_info= new partition_info();
+          lex->part_info->part_info_string= (char*)Lex->tok_start;
         }
         partition
         {
@@ -2605,21 +2603,14 @@
         partition {};
 
 partition:
-        BY
-        {
-          Lex->part_info->partitions.empty();
-          Lex->part_info->part_field_list.empty();
-          Lex->part_info->subpart_field_list.empty();
-        }
-        part_type_def opt_no_parts {}
-        opt_sub_part {}
-        part_defs {};
+        BY part_type_def opt_no_parts {} opt_sub_part {} part_defs;
 
 part_type_def:
         KEY_SYM '(' part_field_list ')'
         {
-          Lex->part_info->list_of_part_fields= TRUE;
-          Lex->part_info->part_type= HASH_PARTITION;
+          LEX *lex= Lex;
+          lex->part_info->list_of_part_fields= TRUE;
+          lex->part_info->part_type= HASH_PARTITION;
         }
         | HASH_SYM
         { Lex->part_info->part_type= HASH_PARTITION; }
@@ -2640,24 +2631,25 @@
         { Lex->part_info->part_field_list.push_back($1.str); };
 
 part_func:
-        '(' bit_expr ')' 
+        '(' part_func_expr ')' 
         {
-          bool not_corr_func;
-          not_corr_func= !Lex->safe_to_cache_query;
-          Lex->safe_to_cache_query= 1;
-          if (not_corr_func)
-          {
-            yyerror(ER(ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR));
-            YYABORT;
-          }
-          Lex->part_info->list_of_part_fields= FALSE;
-          Lex->part_info->part_expr= $2;
+          LEX *lex= Lex;
+          lex->part_info->list_of_part_fields= FALSE;
+          lex->part_info->part_expr= $2;
         };
 
 opt_no_parts:
         /* empty */ {}
         | PARTITIONS_SYM ulong_num 
-        { Lex->part_info->no_parts= $2; };
+        { 
+          uint no_parts= $2;
+          if (no_parts == 0)
+          {
+            my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
+            YYABORT;
+          }
+          Lex->part_info->no_parts= no_parts;
+        };
 
 opt_sub_part:
         /* empty */ {}
@@ -2666,8 +2658,9 @@
         opt_no_subparts {}
         | SUBPARTITION_SYM BY KEY_SYM '(' sub_part_field_list ')'
         {
-          Lex->part_info->subpart_type= HASH_PARTITION;
-          Lex->part_info->list_of_subpart_fields= TRUE;
+          LEX *lex= Lex;
+          lex->part_info->subpart_type= HASH_PARTITION;
+          lex->part_info->list_of_subpart_fields= TRUE;
         }
         opt_no_subparts {};
 
@@ -2680,24 +2673,40 @@
         { Lex->part_info->subpart_field_list.push_back($1.str); };
 
 sub_part_func:
-        '(' bit_expr ')' 
+        '(' part_func_expr ')' 
+        {
+          LEX *lex= Lex;
+          lex->part_info->subpart_expr= $2;
+          lex->part_info->list_of_subpart_fields= FALSE;
+        };
+
+part_func_expr:
+        bit_expr
         {
+          LEX *lex= Lex;
           bool not_corr_func;
-          not_corr_func= !Lex->safe_to_cache_query;
-          Lex->safe_to_cache_query= 1;
+          not_corr_func= !lex->safe_to_cache_query;
+          lex->safe_to_cache_query= 1;
           if (not_corr_func)
           {
             yyerror(ER(ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR));
             YYABORT;
           }
-          Lex->part_info->subpart_expr= $2;
-          Lex->part_info->list_of_subpart_fields= FALSE;
-        };
+          $$=$1;
+        }
 
 opt_no_subparts:
         /* empty */ {}
         | SUBPARTITIONS_SYM ulong_num
-        { Lex->part_info->no_subparts= $2; };
+        {
+          uint no_parts= $2;
+          if (no_parts == 0)
+          {
+            my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
+            YYABORT;
+          }
+          Lex->part_info->no_subparts= no_parts;
+        };
 
 part_defs:
         /* empty */
@@ -2710,21 +2719,23 @@
         }
         | '(' part_def_list ')'
         {
-          if (Lex->part_info->no_parts != 0)
+          LEX *lex= Lex;
+          partition_info *part_info= lex->part_info;
+          if (part_info->no_parts != 0)
           {
-            if (Lex->part_info->no_parts !=
-                Lex->part_info->count_curr_parts)
+            if (part_info->no_parts !=
+                part_info->count_curr_parts)
             {
               yyerror(ER(ER_PARTITION_WRONG_NO_PART_ERROR));
               YYABORT;
             }
           }
-          else if (Lex->part_info->count_curr_parts > 0)
+          else if (part_info->count_curr_parts > 0)
           {
-            Lex->part_info->no_parts= Lex->part_info->count_curr_parts;
+            part_info->no_parts= part_info->count_curr_parts;
           }
-          Lex->part_info->count_curr_subparts= 0;
-          Lex->part_info->count_curr_parts= 0;
+          part_info->count_curr_subparts= 0;
+          part_info->count_curr_parts= 0;
         };
 
 part_def_list:
@@ -2734,12 +2745,19 @@
 part_definition:
         PARTITION_SYM
         {
-          Lex->part_info->current_partition= new partition_element();
-          Lex->part_info->partitions.push_back(curr_partition);
-          curr_partition->engine_type= DB_TYPE_UNKNOWN; 
-          curr_partition->subpartitions.empty();
-          curr_partition->list_expr_list.empty();
-          Lex->part_info->count_curr_parts++;
+          LEX *lex= Lex;
+          partition_info *part_info;
+          partition_element *p_elem= new partition_element();
+          if (!p_elem)
+          {
+            my_error(ER_OUTOFMEMORY, MYF(0), sizeof(partition_element));
+            YYABORT;
+          }
+          part_info->curr_part_elem= p_elem;
+          part_info->current_partition= p_elem;
+          part_info->partitions.push_back(p_elem);
+          p_elem->engine_type= DB_TYPE_UNKNOWN; 
+          part_info->count_curr_parts++;
         }
         part_name {}
         opt_part_values {}
@@ -2748,18 +2766,19 @@
 
 part_name:
         ident_or_text
-        { curr_partition->partition_name= $1.str; };
+        { Lex->part_info->curr_part_elem->partition_name= $1.str; };
 
 opt_part_values:
         /* empty */
-        { 
-          if (Lex->part_info->part_type == RANGE_PARTITION)
+        {
+          LEX *lex= Lex;
+          if (lex->part_info->part_type == RANGE_PARTITION)
           {
             my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
             "RANGE", "LESS THAN");
             YYABORT;
           }
-          if (Lex->part_info->part_type == LIST_PARTITION)
+          if (lex->part_info->part_type == LIST_PARTITION)
           {
             my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
             "LIST", "IN");
@@ -2787,13 +2806,14 @@
 
 part_func_max:
         MAX_VALUE_SYM
-        { 
-          if (Lex->part_info->defined_max_value)
+        {
+          LEX *lex= Lex;
+          if (lex->part_info->defined_max_value)
           {
             yyerror(ER(ER_PARTITION_MAXVALUE_ERROR));
             YYABORT;
           }
-          Lex->part_info->defined_max_value= TRUE;
+          lex->part_info->defined_max_value= TRUE;
         }
         | part_range_func
         {
@@ -2805,18 +2825,9 @@
         };
 
 part_range_func:
-        '(' bit_expr ')' 
+        '(' part_bit_expr ')' 
         {
-          bool not_corr_func;
-          $2->fix_fields(YYTHD, (TABLE_LIST*)0, (Item**)0);
-          not_corr_func= !$2->const_item() || !Lex->safe_to_cache_query;
-          Lex->safe_to_cache_query= 1;
-          if (not_corr_func)
-          {
-            yyerror(ER(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR));
-            YYABORT;
-          }
-          curr_partition->range_expr= $2;
+          Lex->part_info->curr_part_elem->range_expr= $2;
         };
 
 part_list_func:
@@ -2824,6 +2835,12 @@
         | part_list_func ',' part_list_item {};
 
 part_list_item:
+        part_bit_expr
+        {
+          Lex->part_info->curr_part_elem->list_expr_list.push_back($1);
+        };
+
+part_bit_expr:
         bit_expr
         {
           bool not_corr_func;
@@ -2835,53 +2852,29 @@
             yyerror(ER(ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR));
             YYABORT;
           }
-          curr_partition->list_expr_list.push_back($1);
-        };
-
-opt_part_options:
-       /* empty */ {}
-       | opt_part_option_list {};
-
-opt_part_option_list:
-       opt_part_option_list ',' opt_part_option {}
-       | opt_part_option {};
-
-opt_part_option:
-        TABLESPACE ident_or_text
-        { curr_partition->tablespace_name= $2.str; }
-        | opt_storage ENGINE_SYM opt_equal storage_engines
-        { curr_partition->engine_type= $4; }
-        | NODEGROUP_SYM ulong_num
-        { curr_partition->nodegroup_id= $2; }
-        | MAX_ROWS opt_equal ulonglong_num
-        { curr_partition->part_max_rows= $3; }
-        | MIN_ROWS opt_equal ulonglong_num
-        { curr_partition->part_min_rows= $3; }
-        | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
-        { curr_partition->data_file_name= $4.str; }
-        | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
-        { curr_partition->index_file_name= $4.str; }
-        | COMMENT_SYM opt_equal TEXT_STRING_sys
-        { curr_partition->part_comment= $3.str; };
+          $$= $1; 
+        }
 
 opt_sub_partition:
         /* empty */ {}
         | '(' sub_part_list ')'
         {
-          if (Lex->part_info->no_subparts != 0)
+          LEX *lex= Lex;
+          partition_info *part_info= lex->part_info;
+          if (part_info->no_subparts != 0)
           {
-            if (Lex->part_info->no_subparts !=
-                Lex->part_info->count_curr_subparts)
+            if (part_info->no_subparts !=
+                part_info->count_curr_subparts)
             {
               yyerror(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
               YYABORT;
             }
           }
-          else if (Lex->part_info->count_curr_subparts > 0)
+          else if (part_info->count_curr_subparts > 0)
           {
-            Lex->part_info->no_subparts= Lex->part_info->count_curr_subparts;
+            part_info->no_subparts= part_info->count_curr_subparts;
           }
-          Lex->part_info->count_curr_subparts= 0;
+          part_info->count_curr_subparts= 0;
         };
 
 sub_part_list:
@@ -2891,44 +2884,49 @@
 sub_part_definition:
         SUBPARTITION_SYM
         {
-          Lex->part_info->current_subpartition= new partition_element();
-          curr_partition->subpartitions.push_back(curr_subpartition);
-          curr_subpartition->engine_type= DB_TYPE_UNKNOWN;
-          curr_subpartition->subpartitions.empty();
-          Lex->part_info->count_curr_subparts++;
+          LEX *lex= Lex;
+          partition_info *part_info= lex->part_info;
+          partition_element *p_elem= new partition_element();
+          if (!p_elem)
+          {
+            my_error(ER_OUTOFMEMORY, MYF(0), sizeof(partition_element));
+            YYABORT;
+          }
+          part_info->curr_part_elem= p_elem;
+          part_info->current_partition->subpartitions.push_back(p_elem);
+          part_info->count_curr_subparts++;
         }
-        sub_name
-        opt_sub_part_options {};
+        sub_name opt_part_options {};
 
 sub_name:
         ident_or_text
-        { curr_subpartition->partition_name= $1.str; };
+        { Lex->part_info->curr_part_elem->partition_name= $1.str; };
 
-opt_sub_part_options:
+opt_part_options:
        /* empty */ {}
-       | opt_sub_part_option_list {};
+       | opt_part_option_list {};
 
-opt_sub_part_option_list:
-       opt_sub_part_option_list ',' opt_sub_part_option {}
-       | opt_sub_part_option {};
+opt_part_option_list:
+       opt_part_option_list ',' opt_part_option {}
+       | opt_part_option {};
 
-opt_sub_part_option:
+opt_part_option:
         TABLESPACE ident_or_text
-        { curr_subpartition->tablespace_name= $2.str; }
+        { Lex->part_info->curr_part_elem->tablespace_name= $2.str; }
         | opt_storage ENGINE_SYM opt_equal storage_engines
-        { curr_subpartition->engine_type= $4; }
+        { Lex->part_info->curr_part_elem->engine_type= $4; }
         | NODEGROUP_SYM ulong_num
-        { curr_subpartition->nodegroup_id= $2; }
+        { Lex->part_info->curr_part_elem->nodegroup_id= $2; }
         | MAX_ROWS opt_equal ulonglong_num
-        { curr_subpartition->part_max_rows= $3; }
+        { Lex->part_info->curr_part_elem->part_max_rows= $3; }
         | MIN_ROWS opt_equal ulonglong_num
-        { curr_subpartition->part_min_rows= $3; }
+        { Lex->part_info->curr_part_elem->part_min_rows= $3; }
         | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
-        { curr_subpartition->data_file_name= $4.str; }
+        { Lex->part_info->curr_part_elem->data_file_name= $4.str; }
         | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
-        { curr_subpartition->index_file_name= $4.str; }
+        { Lex->part_info->curr_part_elem->index_file_name= $4.str; }
         | COMMENT_SYM opt_equal TEXT_STRING_sys
-        { curr_subpartition->part_comment= $3.str; };
+        { Lex->part_info->curr_part_elem->part_comment= $3.str; };
 
 /*
  End of partition parser part

--- 1.179/sql/table.cc	Tue Apr 26 14:31:06 2005
+++ 1.180/sql/table.cc	Thu May  5 10:12:49 2005
@@ -97,7 +97,7 @@
 }
 
 bool check_partition_info(partition_info *part_info,enum db_type eng_type,
-                          handler *file)
+                          handler *file, ulonglong max_rows)
 {
   DBUG_ENTER("check_partition_info");
   u_char *engine_array;
@@ -108,7 +108,7 @@
 
   if (part_info->no_parts == 0 &&
       (is_sub_partitioned(part_info) ||
-      (!(part_info->no_parts= file->get_default_no_partitions()))))
+      (!(part_info->no_parts= file->get_default_no_partitions(max_rows)))))
   {
     /*
       No partitions were defined and we were not using subpartitions and
@@ -125,10 +125,10 @@
     DBUG_RETURN(TRUE);
   }
   if (is_sub_partitioned(part_info) &&
-      (!(part_info->part_type == RANGE_PARTITION &&
-         part_info->part_type == LIST_PARTITION)) &&
-      (part_info->subpart_type != HASH_PARTITION))
+      (!(part_info->part_type == RANGE_PARTITION ||
+         part_info->part_type == LIST_PARTITION)))
   {
+    /* Only RANGE and LIST partitioning can be subpartitioned */
     my_error(ER_SUBPARTITION_ERROR, MYF(0));
     DBUG_RETURN(TRUE);
   }

--- 1.28/sql/share/errmsg.txt	Tue Apr 26 14:31:07 2005
+++ 1.29/sql/share/errmsg.txt	Thu May  5 10:12:48 2005
@@ -5378,6 +5378,8 @@
         eng "A Nullable field in partition function is not allowed"
 ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
         eng "A %s need to include all fields in the partition function"
+ER_NO_PARTS_ERROR
+        eng "Number of %s 0 is not an allowed value"
 ER_STARTUP
 	eng "%s: ready for connections.\nVersion: '%s'  socket: '%s'  port: %d  %s"
 ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR

--- 1.172/sql/ha_ndbcluster.cc	Tue Apr 26 14:30:59 2005
+++ 1.173/sql/ha_ndbcluster.cc	Thu May  5 10:12:47 2005
@@ -3814,11 +3814,10 @@
 }
 
 #ifdef HAVE_PARTITION_DB
-int ha_ndbcluster::get_default_no_partitions()
+int ha_ndbcluster::get_default_no_partitions(ulonglong max_rows)
 {
   uint acc_row_size= 25 + /*safety margin*/ 2;
   ulonglong acc_fragment_size= 512*1024*1024;
-  ulonglong max_rows= table->s->max_rows;
   ulong no_fragments= (max_rows*acc_row_size)/acc_fragment_size+1;
   uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
   if (no_fragments > no_nodes)

--- 1.83/sql/ha_ndbcluster.h	Tue Apr 26 14:31:00 2005
+++ 1.84/sql/ha_ndbcluster.h	Thu May  5 10:12:48 2005
@@ -447,7 +447,7 @@
   int delete_table(const char *name);
   int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
 #ifdef HAVE_PARTITION_DB
-  int get_default_no_partitions();
+  int get_default_no_partitions(ulonglong max_rows);
 #endif
   THR_LOCK_DATA **store_lock(THD *thd,
                              THR_LOCK_DATA **to,
Thread
bk commit into 5.1 tree (mronstrom:1.1804)mikael5 May