#At file:///home/msvensson/mysql/7.0/ based on revid:magnus.blaudd@stripped
3878 Magnus Blåudd 2010-10-20
ndb
- revert addition of MAX_NO_* to enums in MySQL Server
- implement ha_ndbcluster_cond with the MAX_NO_* constants locally,
if someone adds a new type(which seesm to be rare) it will be detected by
DBUG_ASSERT in bitmap_set_bit
- since the size of expect_* bitmaks are known at compile time, make them
statically defined, avoiding the need for three additional malloc and free
modified:
include/mysql.h.pp
include/mysql_com.h
sql/ha_ndbcluster_cond.h
sql/item.h
sql/rpl_utility.cc
=== modified file 'include/mysql.h.pp'
--- a/include/mysql.h.pp 2010-10-18 13:46:27 +0000
+++ b/include/mysql.h.pp 2010-10-20 08:03:19 +0000
@@ -58,8 +58,7 @@ enum enum_field_types { MYSQL_TYPE_DECIM
MYSQL_TYPE_BLOB=252,
MYSQL_TYPE_VAR_STRING=253,
MYSQL_TYPE_STRING=254,
- MYSQL_TYPE_GEOMETRY=255,
- MAX_NO_FIELD_TYPES
+ MYSQL_TYPE_GEOMETRY=255
};
enum mysql_enum_shutdown_level {
SHUTDOWN_DEFAULT = 0,
@@ -103,9 +102,7 @@ struct rand_struct {
double max_value_dbl;
};
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
- DECIMAL_RESULT,
- MAX_NO_ITEM_RESULTS
-};
+ DECIMAL_RESULT};
typedef struct st_udf_args
{
unsigned int arg_count;
=== modified file 'include/mysql_com.h'
--- a/include/mysql_com.h 2010-10-12 14:53:28 +0000
+++ b/include/mysql_com.h 2010-10-20 08:03:19 +0000
@@ -315,8 +315,7 @@ enum enum_field_types { MYSQL_TYPE_DECIM
MYSQL_TYPE_BLOB=252,
MYSQL_TYPE_VAR_STRING=253,
MYSQL_TYPE_STRING=254,
- MYSQL_TYPE_GEOMETRY=255,
- MAX_NO_FIELD_TYPES /* Should always be last */
+ MYSQL_TYPE_GEOMETRY=255
};
/* For backward compatibility */
@@ -444,9 +443,7 @@ struct rand_struct {
/* The following is for user defined functions */
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
- DECIMAL_RESULT,
- MAX_NO_ITEM_RESULTS /* Should always be last */
-};
+ DECIMAL_RESULT};
typedef struct st_udf_args
{
=== modified file 'sql/ha_ndbcluster_cond.h'
--- a/sql/ha_ndbcluster_cond.h 2009-12-15 14:21:01 +0000
+++ b/sql/ha_ndbcluster_cond.h 2010-10-20 08:03:19 +0000
@@ -25,8 +25,6 @@
#pragma interface /* gcc class implementation */
#endif
-#define round_up_byte(size) ((size + 7) >> 3) << 3
-
typedef enum ndb_item_type {
NDB_VALUE = 0, // Qualified more with Item::Type
NDB_FIELD = 1, // Qualified from table definition
@@ -333,22 +331,22 @@ class Ndb_cond_stack : public Sql_alloc
*/
class Ndb_expect_stack : public Sql_alloc
{
+ static const uint MAX_NO_ITEMS = Item::VIEW_FIXER_ITEM + 1;
+ static const uint MAX_NO_FIELD_TYPES = MYSQL_TYPE_GEOMETRY + 1;
+ static const uint MAX_NO_ITEM_RESULTS = DECIMAL_RESULT + 1;
public:
Ndb_expect_stack(): collation(NULL), length(0), max_length(0), next(NULL)
{
- // Allocate type checking bitmaps
- bitmap_init(&expect_mask,
- 0, round_up_byte(Item::MAX_NO_ITEMS), FALSE);
- bitmap_init(&expect_field_type_mask,
- 0, round_up_byte(MAX_NO_FIELD_TYPES), FALSE);
- bitmap_init(&expect_field_result_mask,
- 0, round_up_byte(MAX_NO_ITEM_RESULTS), FALSE);
+ // Allocate type checking bitmaps
+ bitmap_init(&expect_mask, m_expect_buf,
+ MAX_NO_ITEMS, FALSE);
+ bitmap_init(&expect_field_type_mask, m_expect_field_type_buf,
+ MAX_NO_FIELD_TYPES, FALSE);
+ bitmap_init(&expect_field_result_mask, m_expect_field_result_buf,
+ MAX_NO_ITEM_RESULTS, FALSE);
};
~Ndb_expect_stack()
{
- bitmap_free(&expect_mask);
- bitmap_free(&expect_field_type_mask);
- bitmap_free(&expect_field_result_mask);
if (next)
delete next;
next= NULL;
@@ -485,8 +483,11 @@ Ndb_expect_stack(): collation(NULL), len
private:
MY_BITMAP expect_mask;
+ my_bitmap_map m_expect_buf[bitmap_buffer_size(MAX_NO_ITEMS)];
MY_BITMAP expect_field_type_mask;
+ my_bitmap_map m_expect_field_type_buf[bitmap_buffer_size(MAX_NO_FIELD_TYPES)];
MY_BITMAP expect_field_result_mask;
+ my_bitmap_map m_expect_field_result_buf[bitmap_buffer_size(MAX_NO_ITEMS)];
CHARSET_INFO* collation;
Uint32 length;
Uint32 max_length;
=== modified file 'sql/item.h'
--- a/sql/item.h 2010-10-06 10:06:47 +0000
+++ b/sql/item.h 2010-10-20 08:03:19 +0000
@@ -490,10 +490,7 @@ public:
SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER,
PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM,
XPATH_NODESET, XPATH_NODESET_CMP,
- VIEW_FIXER_ITEM,
- /* Add new item types here */
- MAX_NO_ITEMS /* Should always be last */
- };
+ VIEW_FIXER_ITEM};
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc 2010-06-16 12:04:53 +0000
+++ b/sql/rpl_utility.cc 2010-10-20 08:03:19 +0000
@@ -736,8 +736,6 @@ can_convert_field_to(Field *field,
case MYSQL_TYPE_NULL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
-
- case MAX_NO_FIELD_TYPES:
DBUG_RETURN(false);
}
DBUG_RETURN(false); // To keep GCC happy
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20101020080319-2q7zqyqaezg0go6p.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3878) | Magnus Blåudd | 20 Oct |