Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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.1947 05/07/25 10:50:27 joreland@stripped +46 -0
Merge mysql.com:/home/jonas/src/mysql-5.1-push
into mysql.com:/home/jonas/src/mysql-5.1-ndb-dd
storage/ndb/test/src/UtilTransactions.cpp
1.22 05/07/25 10:50:22 joreland@stripped +0 -55
merge
storage/ndb/src/ndbapi/ndberror.c
1.47 05/07/25 10:50:22 joreland@stripped +6 -6
merge
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
1.23 05/07/25 10:50:22 joreland@stripped +0 -1
merge
sql/sql_yacc.yy
1.371 05/07/25 10:50:22 joreland@stripped +0 -0
merge
sql/ha_ndbcluster.cc
1.145 05/07/25 10:50:22 joreland@stripped +27 -29
merge
storage/ndb/tools/restore/Restore.cpp
1.29 05/07/25 10:30:30 joreland@stripped +0 -0
Auto merged
storage/ndb/tools/listTables.cpp
1.21 05/07/25 10:30:29 joreland@stripped +0 -0
Auto merged
storage/ndb/test/src/HugoOperations.cpp
1.28 05/07/25 10:30:29 joreland@stripped +0 -1
Auto merged
storage/ndb/test/run-test/ndb-autotest.sh
1.15 05/07/25 10:30:29 joreland@stripped +0 -0
Auto merged
storage/ndb/test/ndbapi/testPartitioning.cpp
1.9 05/07/25 10:30:29 joreland@stripped +0 -0
Auto merged
storage/ndb/test/ndbapi/testBlobs.cpp
1.27 05/07/25 10:30:29 joreland@stripped +0 -0
Auto merged
storage/ndb/test/include/UtilTransactions.hpp
1.10 05/07/25 10:30:29 joreland@stripped +0 -0
Auto merged
storage/ndb/src/ndbapi/TransporterFacade.cpp
1.35 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
1.91 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/ndbapi/ClusterMgr.hpp
1.8 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/ndbapi/ClusterMgr.cpp
1.22 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/mgmapi/mgmapi.cpp
1.50 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
1.27 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
1.10 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
1.27 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
1.90 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
1.33 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
1.36 05/07/25 10:30:28 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
1.89 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
1.59 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.hpp
1.17 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.cpp
1.46 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/ndb/include/ndbapi/NdbDictionary.hpp
1.47 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
1.27 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
storage/myisam/rt_split.c
1.17 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
sql/share/errmsg.txt
1.33 05/07/25 10:30:27 joreland@stripped +0 -0
Auto merged
sql/sql_table.cc
1.228 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/sql_lex.h
1.182 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/sql_class.h
1.233 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/mysqld.cc
1.453 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.297 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/lock.cc
1.71 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/handler.h
1.142 05/07/25 10:30:26 joreland@stripped +0 -0
Auto merged
sql/handler.cc
1.151 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
sql/ha_ndbcluster.h
1.76 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
sql/ha_myisammrg.cc
1.67 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
sql/ha_myisam.cc
1.153 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
sql/ha_innodb.cc
1.213 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
libmysqld/Makefile.am
1.63 05/07/25 10:30:25 joreland@stripped +0 -0
Auto merged
configure.in
1.268 05/07/25 10:30:25 joreland@stripped +1 -2
Auto merged
BitKeeper/etc/config
1.14 05/07/25 10:30:25 joreland@stripped +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: joreland
# Host: eel.(none)
# Root: /home/jonas/src/mysql-5.1-ndb-dd/RESYNC
--- 1.267/configure.in 2005-07-21 15:33:37 +02:00
+++ 1.268/configure.in 2005-07-25 10:30:25 +02:00
@@ -7,7 +7,7 @@
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# Don't forget to also update the NDB lines below.
-AM_INIT_AUTOMAKE(mysql, 5.1.0-alpha)
+AM_INIT_AUTOMAKE(mysql, 5.1.1-alpha)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@@ -18,7 +18,7 @@
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=1
-NDB_VERSION_BUILD=0
+NDB_VERSION_BUILD=1
NDB_VERSION_STATUS="alpha"
# Set all version vars based on $VERSION. How do we do this more elegant ?
--- 1.152/sql/ha_myisam.cc 2005-07-21 15:33:38 +02:00
+++ 1.153/sql/ha_myisam.cc 2005-07-25 10:30:25 +02:00
@@ -1697,3 +1697,25 @@
return (uint)file->s->state.checksum;
}
+
+bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes)
+{
+ uint options= table->s->db_options_in_use;
+
+ if (info->auto_increment_value != auto_increment_value ||
+ info->raid_type != raid_type ||
+ info->raid_chunks != raid_chunks ||
+ info->raid_chunksize != raid_chunksize ||
+ info->data_file_name != data_file_name ||
+ info->index_file_name != index_file_name ||
+ table_changes == IS_EQUAL_NO)
+ return COMPATIBLE_DATA_NO;
+
+ if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
+ HA_OPTION_DELAY_KEY_WRITE)) !=
+ (info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
+ HA_OPTION_DELAY_KEY_WRITE)))
+ return COMPATIBLE_DATA_NO;
+ return COMPATIBLE_DATA_YES;
+}
--- 1.66/sql/ha_myisammrg.cc 2005-07-21 15:33:38 +02:00
+++ 1.67/sql/ha_myisammrg.cc 2005-07-25 10:30:25 +02:00
@@ -515,3 +515,14 @@
}
packet->append(')');
}
+
+
+bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes)
+{
+ /*
+ For myisammrg, we should always re-generate the mapping file as this
+ is trivial to do
+ */
+ return COMPATIBLE_DATA_NO;
+}
--- 1.141/sql/handler.h 2005-07-21 15:33:38 +02:00
+++ 1.142/sql/handler.h 2005-07-25 10:30:26 +02:00
@@ -226,6 +226,9 @@
#define MAXGTRIDSIZE 64
#define MAXBQUALSIZE 64
+#define COMPATIBLE_DATA_YES 0
+#define COMPATIBLE_DATA_NO 1
+
struct xid_t {
long formatID;
long gtrid_length;
@@ -402,12 +405,12 @@
class partition_element :public Sql_alloc {
public:
List<partition_element> subpartitions;
- List<Item> list_expr_list;
+ List<longlong> list_val_list;
ulonglong part_max_rows;
ulonglong part_min_rows;
char *partition_name;
char *tablespace_name;
- Item* range_expr;
+ longlong range_value;
char* part_comment;
char* data_file_name;
char* index_file_name;
@@ -416,12 +419,12 @@
partition_element()
: part_max_rows(0), part_min_rows(0), partition_name(NULL),
- tablespace_name(NULL), range_expr(NULL), part_comment(NULL),
+ tablespace_name(NULL), range_value(0), part_comment(NULL),
data_file_name(NULL), index_file_name(NULL),
engine_type(DB_TYPE_UNKNOWN), nodegroup_id(UNDEF_NODEGROUP)
{
subpartitions.empty();
- list_expr_list.empty();
+ list_val_list.empty();
}
~partition_element() {}
};
@@ -1328,6 +1331,9 @@
Pops the top if condition stack, if stack is not empty
*/
virtual void cond_pop() { return; };
+ virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
+ uint table_changes)
+ { return COMPATIBLE_DATA_NO; }
};
/* Some extern variables used with handlers */
--- 1.296/sql/mysql_priv.h 2005-07-21 15:33:39 +02:00
+++ 1.297/sql/mysql_priv.h 2005-07-25 10:30:26 +02:00
@@ -392,6 +392,13 @@
#define STRING_BUFFER_USUAL_SIZE 80
+/*
+ Some defines for exit codes for ::is_equal class functions.
+*/
+#define IS_EQUAL_NO 0
+#define IS_EQUAL_YES 1
+#define IS_EQUAL_PACK_LENGTH 2
+
enum enum_parsing_place
{
NO_MATTER,
--- 1.452/sql/mysqld.cc 2005-07-21 15:33:41 +02:00
+++ 1.453/sql/mysqld.cc 2005-07-25 10:30:26 +02:00
@@ -4341,6 +4341,7 @@
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
+ OPT_OLD_ALTER_TABLE,
OPT_EXPIRE_LOGS_DAYS,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
@@ -4877,6 +4878,11 @@
(gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
+ {"old-alter-table", OPT_OLD_ALTER_TABLE,
+ "Use old, non-optimized alter table.",
+ (gptr*) &global_system_variables.old_alter_table,
+ (gptr*) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for
4.0 and older clients).",
(gptr*) &global_system_variables.old_passwords,
(gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
@@ -6069,6 +6075,7 @@
global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
global_system_variables.old_passwords= 0;
+ global_system_variables.old_alter_table= 0;
/* Variables that depends on compile options */
#ifndef DBUG_OFF
--- 1.232/sql/sql_class.h 2005-07-21 15:33:42 +02:00
+++ 1.233/sql/sql_class.h 2005-07-25 10:30:26 +02:00
@@ -564,6 +564,7 @@
my_bool ndb_use_exact_count;
my_bool ndb_use_transactions;
#endif /* HAVE_NDBCLUSTER_DB */
+ my_bool old_alter_table;
my_bool old_passwords;
/* Only charset part of these variables is sensible */
--- 1.181/sql/sql_lex.h 2005-07-21 16:15:15 +02:00
+++ 1.182/sql/sql_lex.h 2005-07-25 10:30:26 +02:00
@@ -651,6 +651,7 @@
#define ALTER_KEYS_ONOFF 512
#define ALTER_CONVERT 1024
#define ALTER_FORCE 2048
+#define ALTER_RECREATE 4096
typedef struct st_alter_info
{
--- 1.227/sql/sql_table.cc 2005-07-21 15:33:43 +02:00
+++ 1.228/sql/sql_table.cc 2005-07-25 10:30:26 +02:00
@@ -1348,6 +1348,34 @@
/*
+ Set table default charset, if not set
+
+ SYNOPSIS
+ set_table_default_charset()
+ create_info Table create information
+
+ DESCRIPTION
+ If the table character set was not given explicitely,
+ let's fetch the database default character set and
+ apply it to the table.
+*/
+
+static void set_table_default_charset(THD *thd,
+ HA_CREATE_INFO *create_info, char *db)
+{
+ if (!create_info->default_table_charset)
+ {
+ HA_CREATE_INFO db_info;
+ char path[FN_REFLEN];
+ /* Abuse build_table_path() to build the path to the db.opt file */
+ build_table_path(path, sizeof(path), db, MY_DB_OPT_FILE, "");
+ load_db_opt(thd, path, &db_info);
+ create_info->default_table_charset= db_info.default_table_charset;
+ }
+}
+
+
+/*
Extend long VARCHAR fields to blob & prepare field if it's a blob
SYNOPSIS
@@ -1581,20 +1609,7 @@
}
#endif
- /*
- If the table character set was not given explicitely,
- let's fetch the database default character set and
- apply it to the table.
- */
- if (!create_info->default_table_charset)
- {
- HA_CREATE_INFO db_info;
- char path[FN_REFLEN];
- /* Abuse build_table_path() to build the path to the db.opt file */
- build_table_path(path, sizeof(path), db, MY_DB_OPT_FILE, "");
- load_db_opt(thd, path, &db_info);
- create_info->default_table_charset= db_info.default_table_charset;
- }
+ set_table_default_charset(thd, create_info, (char*) db);
if (mysql_prepare_table(thd, create_info, &fields,
&keys, internal_tmp_table, &db_options, file,
@@ -3090,6 +3105,166 @@
#endif /* NOT_USED */
+
+#define ALTER_TABLE_DATA_CHANGED 1
+#define ALTER_TABLE_INDEX_CHANGED 2
+
+/*
+ SYNOPSIS
+ compare tables()
+ table original table
+ create_list fields in new table
+ key_list keys in new table
+ create_info create options in new table
+
+ DESCRIPTION
+ 'table' (first argument) contains information of the original
+ table, which includes all corresponding parts that the new
+ table has in arguments create_list, key_list and create_info.
+
+ By comparing the changes between the original and new table
+ we can determine how much it has changed after ALTER TABLE
+ and whether we need to make a copy of the table, or just change
+ the .frm file.
+
+ RETURN VALUES
+ 0 No copy needed
+ 1 Data changes, copy needed
+ 2 Index changes, copy needed
+*/
+
+uint compare_tables(TABLE *table, List<create_field> *create_list,
+ List<Key> *key_list, HA_CREATE_INFO *create_info,
+ ALTER_INFO *alter_info, uint order_num)
+{
+ Field **f_ptr, *field;
+ uint changes= 0, tmp;
+ List_iterator_fast<create_field> new_field_it(*create_list);
+ create_field *new_field;
+
+ /*
+ Some very basic checks. If number of fields changes, or the
+ handler, we need to run full ALTER TABLE. In the future
+ new fields can be added and old dropped without copy, but
+ not yet.
+
+ Test also that engine was not given during ALTER TABLE, or
+ we are force to run regular alter table (copy).
+ E.g. ALTER TABLE tbl_name ENGINE=MyISAM.
+
+ For the following ones we also want to run regular alter table:
+ ALTER TABLE tbl_name ORDER BY ..
+ ALTER TABLE tbl_name CONVERT TO CHARACTER SET ..
+
+ At the moment we can't handle altering temporary tables without a copy.
+ We also test if OPTIMIZE TABLE was given and was mapped to alter table.
+ In that case we always do full copy.
+ */
+ if (table->s->fields != create_list->elements ||
+ table->s->db_type != create_info->db_type ||
+ table->s->tmp_table ||
+ create_info->used_fields & HA_CREATE_USED_ENGINE ||
+ create_info->used_fields & HA_CREATE_USED_CHARSET ||
+ create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET ||
+ (alter_info->flags & ALTER_RECREATE) ||
+ order_num)
+ return ALTER_TABLE_DATA_CHANGED;
+
+ /*
+ Go through fields and check if the original ones are compatible
+ with new table.
+ */
+ for (f_ptr= table->field, new_field= new_field_it++;
+ (field= *f_ptr); f_ptr++, new_field= new_field_it++)
+ {
+ /* Make sure we have at least the default charset in use. */
+ if (!new_field->charset)
+ new_field->charset= create_info->default_table_charset;
+
+ /* Check that NULL behavior is same for old and new fields */
+ if ((new_field->flags & NOT_NULL_FLAG) !=
+ (uint) (field->flags & NOT_NULL_FLAG))
+ return ALTER_TABLE_DATA_CHANGED;
+
+ /* Don't pack rows in old tables if the user has requested this. */
+ if (create_info->row_type == ROW_TYPE_DYNAMIC ||
+ (new_field->flags & BLOB_FLAG) ||
+ new_field->sql_type == MYSQL_TYPE_VARCHAR &&
+ create_info->row_type != ROW_TYPE_FIXED)
+ create_info->table_options|= HA_OPTION_PACK_RECORD;
+
+ /* Evaluate changes bitmap and send to check_if_incompatible_data() */
+ if (!(tmp= field->is_equal(new_field)))
+ return ALTER_TABLE_DATA_CHANGED;
+
+ changes|= tmp;
+ }
+ /* Check if changes are compatible with current handler without a copy */
+ if (table->file->check_if_incompatible_data(create_info, changes))
+ return ALTER_TABLE_DATA_CHANGED;
+
+ /*
+ Go through keys and check if the original ones are compatible
+ with new table.
+ */
+ KEY *table_key_info= table->key_info;
+ List_iterator_fast<Key> key_it(*key_list);
+ Key *key= key_it++;
+
+ /* Check if the number of key elements has changed */
+ if (table->s->keys != key_list->elements)
+ return ALTER_TABLE_INDEX_CHANGED;
+
+ for (uint i= 0; i < table->s->keys; i++, table_key_info++, key= key_it++)
+ {
+ /*
+ Check that the key types are compatible between old and new tables.
+ */
+ if (table_key_info->algorithm != key->algorithm ||
+ ((key->type == Key::PRIMARY || key->type == Key::UNIQUE) &&
+ !(table_key_info->flags & HA_NOSAME)) ||
+ (!(key->type == Key::PRIMARY || key->type == Key::UNIQUE) &&
+ (table_key_info->flags & HA_NOSAME)) ||
+ ((key->type == Key::SPATIAL) &&
+ !(table_key_info->flags & HA_SPATIAL)) ||
+ (!(key->type == Key::SPATIAL) &&
+ (table_key_info->flags & HA_SPATIAL)) ||
+ ((key->type == Key::FULLTEXT) &&
+ !(table_key_info->flags & HA_FULLTEXT)) ||
+ (!(key->type == Key::FULLTEXT) &&
+ (table_key_info->flags & HA_FULLTEXT)))
+ return ALTER_TABLE_INDEX_CHANGED;
+
+ if (table_key_info->key_parts != key->columns.elements)
+ return ALTER_TABLE_INDEX_CHANGED;
+
+ /*
+ Check that the key parts remain compatible between the old and
+ new tables.
+ */
+ KEY_PART_INFO *table_key_part= table_key_info->key_part;
+ List_iterator_fast<key_part_spec> key_part_it(key->columns);
+ key_part_spec *key_part= key_part_it++;
+ for (uint j= 0; j < table_key_info->key_parts; j++,
+ table_key_part++, key_part= key_part_it++)
+ {
+ /*
+ Key definition has changed if we are using a different field or
+ if the used key length is different
+ (If key_part->length == 0 it means we are using the whole field)
+ */
+ if (strcmp(key_part->field_name, table_key_part->field->field_name) ||
+ (key_part->length && key_part->length != table_key_part->length) ||
+ (key_part->length == 0 && table_key_part->length !=
+ table_key_part->field->pack_length()))
+ return ALTER_TABLE_INDEX_CHANGED;
+ }
+ }
+
+ return 0; // Tables are compatible
+}
+
+
/*
Alter table
*/
@@ -3111,7 +3286,7 @@
ulonglong next_insert_id;
uint db_create_options, used_fields;
enum db_type old_db_type,new_db_type;
- bool need_copy_table;
+ uint need_copy_table= 0;
DBUG_ENTER("mysql_alter_table");
thd->proc_info="init";
@@ -3389,8 +3564,8 @@
def_it.remove();
}
}
- else
- { // Use old field value
+ else // This field was not dropped and not changed, add it to the list
+ { // for the new table.
create_list.push_back(def=new create_field(field,field));
alter_it.rewind(); // Change default if ALTER
Alter_column *alter;
@@ -3603,17 +3778,22 @@
if (table->s->tmp_table)
create_info->options|=HA_LEX_CREATE_TMP_TABLE;
+ set_table_default_charset(thd, create_info, db);
+
+ if (thd->variables.old_alter_table)
+ need_copy_table= 1;
+ else
+ need_copy_table= compare_tables(table, &create_list, &key_list,
+ create_info, alter_info, order_num);
+
/*
better have a negative test here, instead of positive, like
alter_info->flags & ALTER_ADD_COLUMN|ALTER_ADD_INDEX|...
so that ALTER TABLE won't break when somebody will add new flag
*/
- need_copy_table= (alter_info->flags &
- ~(ALTER_CHANGE_COLUMN_DEFAULT|ALTER_OPTIONS) ||
- (create_info->used_fields &
- ~(HA_CREATE_USED_COMMENT|HA_CREATE_USED_PASSWORD)) ||
- table->s->tmp_table);
- create_info->frm_only= !need_copy_table;
+
+ if (!need_copy_table)
+ create_info->frm_only= 1;
/*
Handling of symlinked tables:
@@ -3920,7 +4100,7 @@
err:
DBUG_RETURN(TRUE);
}
-
+/* mysql_alter_table */
static int
copy_data_between_tables(TABLE *from,TABLE *to,
@@ -4132,7 +4312,7 @@
create_info.row_type=ROW_TYPE_NOT_USED;
create_info.default_table_charset=default_charset_info;
/* Force alter table to recreate table */
- lex->alter_info.flags= ALTER_CHANGE_COLUMN;
+ lex->alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
table_list, lex->create_list,
lex->key_list, 0, (ORDER *) 0,
--- 1.370/sql/sql_yacc.yy 2005-07-21 16:15:15 +02:00
+++ 1.371/sql/sql_yacc.yy 2005-07-25 10:50:22 +02:00
@@ -73,6 +73,7 @@
int num;
ulong ulong_num;
ulonglong ulonglong_number;
+ longlong longlong_number;
LEX_STRING lex_str;
LEX_STRING *lex_str_ptr;
LEX_SYMBOL symbol;
@@ -733,6 +734,9 @@
%type <ulonglong_number>
ulonglong_num size_number
+%type <longlong_number>
+ part_bit_expr
+
%type <lock_type>
replace_lock_option opt_low_priority insert_lock_option load_data_lock
@@ -749,7 +753,7 @@
sp_opt_default
simple_ident_nospvar simple_ident_q
field_or_var limit_option
- part_bit_expr part_func_expr
+ part_func_expr
%type <item_num>
NUM_literal
@@ -3249,6 +3253,7 @@
YYABORT;
}
lex->part_info->defined_max_value= TRUE;
+ lex->part_info->curr_part_elem->range_value= LONGLONG_MAX;
}
| part_range_func
{
@@ -3262,7 +3267,7 @@
part_range_func:
'(' part_bit_expr ')'
{
- Lex->part_info->curr_part_elem->range_expr= $2;
+ Lex->part_info->curr_part_elem->range_value= $2;
};
part_list_func:
@@ -3272,7 +3277,14 @@
part_list_item:
part_bit_expr
{
- Lex->part_info->curr_part_elem->list_expr_list.push_back($1);
+ longlong *value_ptr;
+ if (!(value_ptr= (longlong*)sql_alloc(sizeof(longlong))))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), sizeof(longlong));
+ YYABORT;
+ }
+ *value_ptr= $1;
+ Lex->part_info->curr_part_elem->list_val_list.push_back(value_ptr);
};
part_bit_expr:
@@ -3281,6 +3293,7 @@
Item *part_expr= $1;
bool not_corr_func;
LEX *lex= Lex;
+ longlong item_value;
Name_resolution_context *context= &lex->current_select->context;
TABLE_LIST *save_list= context->table_list;
@@ -3289,13 +3302,18 @@
context->table_list= save_list;
not_corr_func= !part_expr->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;
}
- $$= part_expr;
+ if (part_expr->result_type() != INT_RESULT)
+ {
+ yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR));
+ YYABORT;
+ }
+ item_value= part_expr->val_int();
+ $$= item_value;
}
opt_sub_partition:
--- 1.32/sql/share/errmsg.txt 2005-07-21 16:15:15 +02:00
+++ 1.33/sql/share/errmsg.txt 2005-07-25 10:30:27 +02:00
@@ -4094,20 +4094,20 @@
swe "Fick fel %d vid CHECKPOINT"
ukr "ïÔÒÉÍÁÎÏ ÐÏÍÉÌËÕ %d Ð¦Ä ÞÁÓ CHECKPOINT"
ER_NEW_ABORTING_CONNECTION 08S01
- cze "Spojen-Bí %ld do databáze: '%-.64s' u¾ivatel: '%-.32s' stroj: `%-.64s'
(%-.64s) bylo pøeru¹eno"
- dan "Afbrød forbindelsen %ld til databasen '%-.64s' bruger: '%-.32s' vært: `%-.64s'
(%-.64s)"
- nla "Afgebroken verbinding %ld naar db: '%-.64s' gebruiker: '%-.32s' host: `%-.64s'
(%-.64s)"
- eng "Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)"
- est "Ühendus katkestatud %ld andmebaas: '%-.64s' kasutaja: '%-.32s' masin: `%-.64s'
(%-.64s)"
- fre "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: `%-.64s'
(%-.64s)"
- ger "Verbindungsabbruch %ld zur Datenbank '%-.64s'. Benutzer: '%-.32s', Host: `%-.64s'
(%-.64s)"
+ cze "Spojen-Bí %ld do databáze: '%-.64s' u¾ivatel: '%-.32s' stroj: '%-.64s'
(%-.64s) bylo pøeru¹eno"
+ dan "Afbrød forbindelsen %ld til databasen '%-.64s' bruger: '%-.32s' vært: '%-.64s'
(%-.64s)"
+ nla "Afgebroken verbinding %ld naar db: '%-.64s' gebruiker: '%-.32s' host: '%-.64s'
(%-.64s)"
+ eng "Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: '%-.64s' (%-.64s)"
+ est "Ühendus katkestatud %ld andmebaas: '%-.64s' kasutaja: '%-.32s' masin: '%-.64s'
(%-.64s)"
+ fre "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: '%-.64s'
(%-.64s)"
+ ger "Verbindungsabbruch %ld zur Datenbank '%-.64s'. Benutzer: '%-.32s', Host: '%-.64s'
(%-.64s)"
ita "Interrotta la connessione %ld al db: ''%-.64s' utente: '%-.32s' host: '%-.64s'
(%-.64s)"
- por "Conexão %ld abortada para banco de dados '%-.64s' - usuário '%-.32s' - 'host'
`%-.64s' ('%-.64s')"
- rus "ðÒÅÒ×ÁÎÏ ÓÏÅÄÉÎÅÎÉÅ %ld Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' Ó ÈÏÓÔÁ
`%-.64s' (%-.64s)"
- serbian "Prekinuta konekcija broj %ld ka bazi: '%-.64s' korisnik je bio: '%-.32s' a
host: `%-.64s' (%-.64s)"
- spa "Abortada conexión %ld para db: '%-.64s' usuario: '%-.32s' servidor: `%-.64s'
(%-.64s)"
+ por "Conexão %ld abortada para banco de dados '%-.64s' - usuário '%-.32s' - 'host'
'%-.64s' ('%-.64s')"
+ rus "ðÒÅÒ×ÁÎÏ ÓÏÅÄÉÎÅÎÉÅ %ld Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' Ó ÈÏÓÔÁ
'%-.64s' (%-.64s)"
+ serbian "Prekinuta konekcija broj %ld ka bazi: '%-.64s' korisnik je bio: '%-.32s' a
host: '%-.64s' (%-.64s)"
+ spa "Abortada conexión %ld para db: '%-.64s' usuario: '%-.32s' servidor: '%-.64s'
(%-.64s)"
swe "Avbröt länken för tråd %ld till db '%-.64s', användare '%-.32s', host '%-.64s'
(%-.64s)"
- ukr "ðÅÒÅÒ×ÁÎÏ Ú'¤ÄÎÁÎÎÑ %ld ÄÏ ÂÁÚÉ ÄÁÎÎÉÈ: '%-.64s' ËÏÒÉÓÔÕ×ÁÞ: '%-.32s' ÈÏÓÔ:
`%-.64s' (%-.64s)"
+ ukr "ðÅÒÅÒ×ÁÎÏ Ú'¤ÄÎÁÎÎÑ %ld ÄÏ ÂÁÚÉ ÄÁÎÎÉÈ: '%-.64s' ËÏÒÉÓÔÕ×ÁÞ: '%-.32s' ÈÏÓÔ:
'%-.64s' (%-.64s)"
ER_DUMP_NOT_IMPLEMENTED
cze "Handler tabulky nepodporuje bin-Bární dump"
dan "Denne tabeltype unserstøtter ikke binært tabeldump"
@@ -5427,8 +5427,8 @@
eng "VALUES LESS THAN value must be strictly increasing for each partition"
swe "Värden i VALUES LESS THAN måste vara strikt växande för varje partition"
ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
- eng "VALUES %s value must be of same type as partition function"
- swe "Värden i VALUES %s måste vara av samma typ som partitioneringsfunktionen"
+ eng "VALUES value must be of same type as partition function"
+ swe "Värden i VALUES måste vara av samma typ som partitioneringsfunktionen"
ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
eng "Multiple definition of same constant in list partitioning"
swe "Multipel definition av samma konstant i list partitionering"
--- 1.13/BitKeeper/etc/config 2005-07-21 15:33:37 +02:00
+++ 1.14/BitKeeper/etc/config 2005-07-25 10:30:25 +02:00
@@ -73,3 +73,8 @@
[nick:]checkout:get
checkout:edit
eoln:unix
+
+license:
+licsign1:
+licsign2:
+licsign3:
--- 1.8/storage/ndb/test/ndbapi/testPartitioning.cpp 2005-04-29 16:30:30 +02:00
+++ 1.9/storage/ndb/test/ndbapi/testPartitioning.cpp 2005-07-25 10:30:29 +02:00
@@ -94,6 +94,15 @@
}
}
}
+
+ Uint32 linear_hash_ind = rand() & 1;
+ NdbDictionary::Table::FragmentType ftype;
+ if (linear_hash_ind)
+ ftype = NdbDictionary::Table::DistrKeyLin;
+ else
+ ftype = NdbDictionary::Table::DistrKeyHash;
+ tab.setFragmentType(ftype);
+
ndbout << (NDBT_Table&)tab << endl;
return 0;
--- 1.45/storage/ndb/src/kernel/blocks/backup/Backup.cpp 2005-07-21 15:33:44 +02:00
+++ 1.46/storage/ndb/src/kernel/blocks/backup/Backup.cpp 2005-07-25 10:30:27 +02:00
@@ -2942,8 +2942,6 @@
/**
* Initialize table object
*/
- tabPtr.p->frag_mask = RNIL;
-
tabPtr.p->schemaVersion = tmpTab.TableVersion;
tabPtr.p->noOfAttributes = tmpTab.NoOfAttributes;
tabPtr.p->noOfNull = 0;
@@ -3053,7 +3051,6 @@
ndbrequire(findTable(ptr, tabPtr, tableId));
ndbrequire(tabPtr.p->fragments.seize(fragCount) != false);
- tabPtr.p->frag_mask = calculate_frag_mask(fragCount);
for(Uint32 i = 0; i<fragCount; i++) {
jam();
FragmentPtr fragPtr;
@@ -3877,15 +3874,6 @@
* Slave functionallity: Perform logging
*
****************************************************************************/
-Uint32
-Backup::calculate_frag_mask(Uint32 count)
-{
- Uint32 mask = 1;
- while (mask < count) mask <<= 1;
- mask -= 1;
- return mask;
-}
-
void
Backup::execBACKUP_TRIG_REQ(Signal* signal)
{
@@ -3902,14 +3890,6 @@
jamEntry();
c_triggerPool.getPtr(trigPtr, trigger_id);
c_tablePool.getPtr(tabPtr, trigPtr.p->tab_ptr_i);
- frag_id = frag_id & tabPtr.p->frag_mask;
- /*
- At the moment the fragment identity known by TUP is the
- actual fragment id but with possibly an extra bit set.
- This is due to that ACC splits the fragment. Thus fragment id 5 can
- here be either 5 or 13. Thus masking with 2 ** n - 1 where number of
- fragments <= 2 ** n will always provide a correct fragment id.
- */
tabPtr.p->fragments.getPtr(fragPtr, frag_id);
if (fragPtr.p->node != getOwnNodeId()) {
jam();
--- 1.16/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2005-04-29 16:30:22 +02:00
+++ 1.17/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2005-07-25 10:30:27 +02:00
@@ -208,7 +208,6 @@
Uint32 tableId;
Uint32 schemaVersion;
- Uint32 frag_mask;
Uint32 tableType;
Uint32 noOfNull;
Uint32 noOfAttributes;
@@ -542,8 +541,6 @@
ArrayPool<Fragment> c_fragmentPool;
ArrayPool<Node> c_nodePool;
ArrayPool<TriggerRecord> c_triggerPool;
-
- Uint32 calculate_frag_mask(Uint32);
void checkFile(Signal*, BackupFilePtr);
void checkScan(Signal*, BackupFilePtr);
--- 1.28/storage/ndb/tools/restore/Restore.cpp 2005-07-21 15:33:46 +02:00
+++ 1.29/storage/ndb/tools/restore/Restore.cpp 2005-07-25 10:30:30 +02:00
@@ -664,7 +664,7 @@
}
info << "_____________________________________________________" << endl
- << "Restoring data in table: " << m_currentTable->getTableName()
+ << "Processing data in table: " << m_currentTable->getTableName()
<< "(" << Header.TableId << ") fragment "
<< Header.FragmentNo << endl;
--- 1.58/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2005-07-21 15:33:44 +02:00
+++ 1.59/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2005-07-25 10:30:27 +02:00
@@ -4166,16 +4166,16 @@
else if(operationRecPtr.p->operation == ZWRITE)
{
jam();
- operationRecPtr.p->operation = ZINSERT;
+ operationRecPtr.p->operation = ZUPDATE;
if (operationRecPtr.p->prevParallelQue != RNIL) {
OperationrecPtr prevOpPtr;
jam();
prevOpPtr.i = operationRecPtr.p->prevParallelQue;
ptrCheckGuard(prevOpPtr, coprecsize, operationrec);
- if (prevOpPtr.p->operation != ZDELETE)
+ if (prevOpPtr.p->operation == ZDELETE)
{
jam();
- operationRecPtr.p->operation = ZUPDATE;
+ operationRecPtr.p->operation = ZINSERT;
}
}
}
--- 1.88/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-07-22 08:57:46 +02:00
+++ 1.89/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-07-25 10:30:27 +02:00
@@ -3424,8 +3424,6 @@
break;
}
- createTabPtr.p->key = ++c_opRecordSequence;
- c_opCreateTable.add(createTabPtr);
createTabPtr.p->m_errorCode = 0;
createTabPtr.p->m_senderRef = senderRef;
createTabPtr.p->m_senderData = senderData;
@@ -3434,11 +3432,12 @@
createTabPtr.p->m_fragmentsPtrI = RNIL;
createTabPtr.p->m_dihAddFragPtr = RNIL;
+ Uint32 key = c_opRecordSequence + 1;
Uint32 *theData = signal->getDataPtrSend(), i;
Uint16 *node_group= (Uint16*)&signal->theData[25];
CreateFragmentationReq * const req = (CreateFragmentationReq*)theData;
req->senderRef = reference();
- req->senderData = createTabPtr.p->key;
+ req->senderData = key;
req->primaryTableId = parseRecord.tablePtr.p->primaryTableId;
req->noOfFragments = parseRecord.tablePtr.p->ngLen >> 1;
req->fragmentationType = parseRecord.tablePtr.p->fragmentType;
@@ -3478,9 +3477,13 @@
{
jam();
parseRecord.errorCode= signal->theData[0];
+ c_opCreateTable.release(createTabPtr);
+ releaseTableObject(parseRecord.tablePtr.i, true);
break;
}
-
+ createTabPtr.p->key = key;
+ c_opRecordSequence++;
+ c_opCreateTable.add(createTabPtr);
c_blockState = BS_CREATE_TAB;
return;
} while(0);
@@ -3488,8 +3491,8 @@
/**
* Something went wrong
*/
- releaseSections(signal);
+ releaseSections(signal);
CreateTableRef * ref = (CreateTableRef*)signal->getDataPtrSend();
ref->senderData = senderData;
ref->senderRef = reference();
--- 1.32/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2005-07-21 15:33:44 +02:00
+++ 1.33/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2005-07-25 10:30:28 +02:00
@@ -6226,6 +6226,17 @@
noOfFragments = 1;
set_default_node_groups(signal, noOfFragments);
break;
+ case DictTabInfo::DistrKeyHash:
+ jam();
+ case DictTabInfo::DistrKeyLin:
+ jam();
+ if (noOfFragments == 0)
+ {
+ jam();
+ noOfFragments = csystemnodes;
+ set_default_node_groups(signal, noOfFragments);
+ }
+ break;
default:
jam();
if (noOfFragments == 0)
--- 1.49/storage/ndb/src/mgmapi/mgmapi.cpp 2005-07-21 15:33:45 +02:00
+++ 1.50/storage/ndb/src/mgmapi/mgmapi.cpp 2005-07-25 10:30:28 +02:00
@@ -101,6 +101,7 @@
#ifdef MGMAPI_LOG
FILE* logfile;
#endif
+ FILE *errstream;
};
#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
@@ -154,6 +155,7 @@
h->read_timeout = 50000;
h->write_timeout = 100;
h->cfg_i = -1;
+ h->errstream = stdout;
strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);
@@ -219,6 +221,13 @@
DBUG_VOID_RETURN;
}
+extern "C"
+void
+ndb_mgm_set_error_stream(NdbMgmHandle handle, FILE * file)
+{
+ handle->errstream = file;
+}
+
/*****************************************************************************
* Error handling
*****************************************************************************/
@@ -329,11 +338,9 @@
/**
* Print some info about why the parser returns NULL
*/
- ndbout << "Error in mgm protocol parser. "
- << "cmd: '" << cmd
- << "' status=" << (Uint32)ctx.m_status
- << ", curr=" << ctx.m_currentToken
- << endl;
+ fprintf(handle->errstream,
+ "Error in mgm protocol parser. cmd: >%s< status: %d curr: %d\n",
+ cmd, (Uint32)ctx.m_status, ctx.m_currentToken);
DBUG_PRINT("info",("ctx.status: %d, ctx.m_currentToken: %s",
ctx.m_status, ctx.m_currentToken));
}
@@ -409,8 +416,8 @@
#endif
if (verbose > 0) {
char buf[1024];
- ndbout_c("Unable to connect with connect string: %s",
- cfg.makeConnectString(buf,sizeof(buf)));
+ fprintf(handle->errstream, "Unable to connect with connect string: %s\n",
+ cfg.makeConnectString(buf,sizeof(buf)));
verbose= -1;
}
if (no_retries == 0) {
@@ -419,32 +426,35 @@
"Unable to connect with connect string: %s",
cfg.makeConnectString(buf,sizeof(buf)));
if (verbose == -2)
- ndbout << ", failed." << endl;
+ fprintf(handle->errstream, ", failed.\n");
DBUG_RETURN(-1);
}
if (verbose == -1) {
- ndbout << "Retrying every " << retry_delay_in_seconds << "
seconds";
+ fprintf(handle->errstream, "Retrying every %d seconds",
+ retry_delay_in_seconds);
if (no_retries > 0)
- ndbout << ". Attempts left:";
+ fprintf(handle->errstream, ". Attempts left:");
else
- ndbout << ", until connected.";;
- ndbout << flush;
+ fprintf(handle->errstream, ", until connected.");
+ fflush(handle->errstream);
verbose= -2;
}
if (no_retries > 0) {
if (verbose == -2) {
- ndbout << " " << no_retries;
- ndbout << flush;
+ fprintf(handle->errstream, " %d", no_retries);
+ fflush(handle->errstream);
}
no_retries--;
}
NdbSleep_SecSleep(retry_delay_in_seconds);
}
if (verbose == -2)
- ndbout << endl;
-
+ {
+ fprintf(handle->errstream, "\n");
+ fflush(handle->errstream);
+ }
handle->cfg_i = i;
-
+
handle->socket = sockfd;
handle->connected = 1;
@@ -496,7 +506,9 @@
for(int i = 0; i<no_of_type_values; i++)
if(strcmp(type, type_values[i].str) == 0)
return type_values[i].value;
-
+ else if(strcmp(type, type_values[i].alias) == 0)
+ return type_values[i].value;
+
return NDB_MGM_NODE_TYPE_UNKNOWN;
}
@@ -1705,28 +1717,28 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n\n", buf);
break;
}
buf = "<Unspecified>";
if(!prop->get("Content-Type", &buf) ||
strcmp(buf, "ndbconfig/octet-stream") != 0){
- ndbout_c("Unhandled response type: %s", buf);
+ fprintf(handle->errstream, "Unhandled response type: %s\n", buf);
break;
}
buf = "<Unspecified>";
if(!prop->get("Content-Transfer-Encoding", &buf)
|| strcmp(buf, "base64") != 0){
- ndbout_c("Unhandled encoding: %s", buf);
+ fprintf(handle->errstream, "Unhandled encoding: %s\n", buf);
break;
}
buf = "<Content-Length Unspecified>";
Uint32 len = 0;
if(!prop->get("Content-Length", &len)){
- ndbout_c("Invalid response: %s\n", buf);
+ fprintf(handle->errstream, "Invalid response: %s\n\n", buf);
break;
}
@@ -1751,14 +1763,14 @@
const int res = base64_decode(buf64, len-1, tmp);
delete[] buf64;
if(res != 0){
- ndbout_c("Failed to decode buffer");
+ fprintf(handle->errstream, "Failed to decode buffer\n");
break;
}
ConfigValuesFactory cvf;
const int res2 = cvf.unpack(tmp);
if(!res2){
- ndbout_c("Failed to unpack buffer");
+ fprintf(handle->errstream, "Failed to unpack buffer\n");
break;
}
@@ -1868,7 +1880,7 @@
}
Uint32 _nodeid;
if(!prop->get("nodeid", &_nodeid) != 0){
- ndbout_c("ERROR Message: <nodeid Unspecified>\n");
+ fprintf(handle->errstream, "ERROR Message: <nodeid Unspecified>\n");
break;
}
nodeid= _nodeid;
@@ -1944,7 +1956,7 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
res= 0;
@@ -1987,7 +1999,7 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
res= 0;
@@ -2030,7 +2042,7 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
res= 0;
@@ -2067,7 +2079,7 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
if (purged) {
@@ -2149,7 +2161,7 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
res= 0;
@@ -2191,14 +2203,14 @@
do {
const char * buf;
if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
- ndbout_c("ERROR Message: %s\n", buf);
+ fprintf(handle->errstream, "ERROR Message: %s\n", buf);
break;
}
res= 0;
} while(0);
if(!prop->get("value",(Uint32*)value)){
- ndbout_c("Unable to get value");
+ fprintf(handle->errstream, "Unable to get value\n");
res = -4;
}
@@ -2250,7 +2262,7 @@
CHECK_REPLY(prop, 0);
if(!prop->get("nodeid",&nodeid)){
- ndbout_c("Unable to get value");
+ fprintf(handle->errstream, "Unable to get value\n");
return 0;
}
--- 1.21/storage/ndb/src/ndbapi/ClusterMgr.cpp 2005-07-21 15:33:45 +02:00
+++ 1.22/storage/ndb/src/ndbapi/ClusterMgr.cpp 2005-07-25 10:30:28 +02:00
@@ -214,7 +214,7 @@
* It is now time to send a new Heartbeat
*/
if (theNode.hbCounter >= theNode.hbFrequency) {
- theNode.hbSent++;
+ theNode.m_info.m_heartbeat_cnt++;
theNode.hbCounter = 0;
}
@@ -231,7 +231,7 @@
theFacade.sendSignalUnCond(&signal, nodeId);
}//if
- if (theNode.hbSent == 4 && theNode.hbFrequency > 0){
+ if (theNode.m_info.m_heartbeat_cnt == 4 && theNode.hbFrequency > 0){
reportNodeFailed(i);
}//if
}
@@ -337,7 +337,7 @@
node.compatible = ndbCompatible_api_ndb(NDB_VERSION,
node.m_info.m_version);
}
-
+
node.m_state = apiRegConf->nodeState;
if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED ||
node.m_state.startLevel == NodeState::SL_SINGLEUSER)){
@@ -345,7 +345,7 @@
} else {
set_node_alive(node, false);
}//if
- node.hbSent = 0;
+ node.m_info.m_heartbeat_cnt = 0;
node.hbCounter = 0;
if (node.m_info.m_type != NodeInfo::REP) {
node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
@@ -414,7 +414,7 @@
Node & theNode = theNodes[nodeId];
theNode.connected = true;
- theNode.hbSent = 0;
+ theNode.m_info.m_heartbeat_cnt = 0;
theNode.hbCounter = 0;
/**
--- 1.7/storage/ndb/src/ndbapi/ClusterMgr.hpp 2005-05-24 17:31:00 +02:00
+++ 1.8/storage/ndb/src/ndbapi/ClusterMgr.hpp 2005-07-25 10:30:28 +02:00
@@ -73,12 +73,12 @@
*/
Uint32 hbFrequency; // Heartbeat frequence
Uint32 hbCounter; // # milliseconds passed since last hb sent
- Uint32 hbSent; // # heartbeats sent (without answer)
};
const Node & getNodeInfo(NodeId) const;
Uint32 getNoOfConnectedNodes() const;
-
+ void hb_received(NodeId);
+
private:
Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes;
@@ -126,6 +126,12 @@
Uint32
ClusterMgr::getNoOfConnectedNodes() const {
return noOfConnectedNodes;
+}
+
+inline
+void
+ClusterMgr::hb_received(NodeId nodeId) {
+ theNodes[nodeId].m_info.m_heartbeat_cnt= 0;
}
/*****************************************************************************/
--- 1.90/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-07-21 16:15:16 +02:00
+++ 1.91/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-07-25 10:30:28 +02:00
@@ -595,19 +595,35 @@
Uint32
NdbTableImpl::get_nodes(Uint32 hashValue, const Uint16 ** nodes) const
{
- if(m_replicaCount > 0)
+ Uint32 fragmentId;
+ if(m_replicaCount == 0)
+ return 0;
+ switch (m_fragmentType)
{
- Uint32 fragmentId = hashValue & m_hashValueMask;
- if(fragmentId < m_hashpointerValue)
+ case NdbDictionary::Object::FragAllSmall:
+ case NdbDictionary::Object::FragAllMedium:
+ case NdbDictionary::Object::FragAllLarge:
+ case NdbDictionary::Object::FragSingle:
+ case NdbDictionary::Object::DistrKeyLin:
{
- fragmentId = hashValue & ((m_hashValueMask << 1) + 1);
+ fragmentId = hashValue & m_hashValueMask;
+ if(fragmentId < m_hashpointerValue)
+ fragmentId = hashValue & ((m_hashValueMask << 1) + 1);
+ break;
}
- Uint32 pos = fragmentId * m_replicaCount;
- if(pos + m_replicaCount <= m_fragments.size())
+ case NdbDictionary::Object::DistrKeyHash:
{
- * nodes = m_fragments.getBase()+pos;
- return m_replicaCount;
+ fragmentId = hashValue % m_fragmentCount;
+ break;
}
+ default:
+ return 0;
+ }
+ Uint32 pos = fragmentId * m_replicaCount;
+ if (pos + m_replicaCount <= m_fragments.size())
+ {
+ *nodes = m_fragments.getBase()+pos;
+ return m_replicaCount;
}
return 0;
}
--- 1.34/storage/ndb/src/ndbapi/TransporterFacade.cpp 2005-07-21 16:15:16 +02:00
+++ 1.35/storage/ndb/src/ndbapi/TransporterFacade.cpp 2005-07-25 10:30:28 +02:00
@@ -126,6 +126,10 @@
//TransporterFacade::instance()->reportDisconnected(nodeId);
}
+void
+transporter_recv_from(void * callbackObj, NodeId nodeId){
+ ((TransporterFacade*)(callbackObj))->hb_received(nodeId);
+}
/****************************************************************************
*
--- 1.9/storage/ndb/test/include/UtilTransactions.hpp 2005-04-29 16:30:30 +02:00
+++ 1.10/storage/ndb/test/include/UtilTransactions.hpp 2005-07-25 10:30:29 +02:00
@@ -28,6 +28,8 @@
UtilTransactions(Ndb* ndb,
const char * tableName, const char * indexName = 0);
+ int closeTransaction(Ndb*);
+
int clearTable(Ndb*,
int records = 0,
int parallelism = 0);
--- 1.27/storage/ndb/test/src/HugoOperations.cpp 2005-07-21 15:33:46 +02:00
+++ 1.28/storage/ndb/test/src/HugoOperations.cpp 2005-07-25 10:30:29 +02:00
@@ -263,6 +263,37 @@
return NDBT_OK;
}
+int HugoOperations::pkWritePartialRecord(Ndb* pNdb,
+ int recordNo,
+ int numRecords){
+
+ int a, check;
+ for(int r=0; r < numRecords; r++){
+ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ check = pOp->writeTuple();
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ // Define primary keys
+ for(a = 0; a<tab.getNoOfColumns(); a++){
+ if (tab.getColumn(a)->getPrimaryKey() == true){
+ if(equalForAttr(pOp, a, r+recordNo) != 0){
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+ }
+ return NDBT_OK;
+}
+
int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int recordNo,
int numRecords){
@@ -415,7 +446,14 @@
{
assert(pCon == pTrans);
m_async_reply= 1;
- m_async_return= res;
+ if(res)
+ {
+ m_async_return = pCon->getNdbError().code;
+ }
+ else
+ {
+ m_async_return = 0;
+ }
}
int
@@ -440,6 +478,8 @@
if(m_async_reply)
{
+ if(m_async_return)
+ ndbout << "ERROR: " << pNdb->getNdbError(m_async_return) <<
endl;
return m_async_return;
}
ndbout_c("wait returned nothing...");
--- 1.21/storage/ndb/test/src/UtilTransactions.cpp 2005-04-29 16:30:31 +02:00
+++ 1.22/storage/ndb/test/src/UtilTransactions.cpp 2005-07-25 10:50:22 +02:00
@@ -1303,6 +1303,16 @@
#include <HugoOperations.hpp>
+int
+UtilTransactions::closeTransaction(Ndb* pNdb)
+{
+ if (pTrans != NULL){
+ pNdb->closeTransaction(pTrans);
+ pTrans = NULL;
+ }
+ return 0;
+}
+
int
UtilTransactions::compare(Ndb* pNdb, const char* tab_name2, int flags){
--- 1.144/sql/ha_ndbcluster.cc 2005-07-21 16:15:15 +02:00
+++ 1.145/sql/ha_ndbcluster.cc 2005-07-25 10:50:22 +02:00
@@ -7708,4 +7708,31 @@
tab.setNodeGroupIds(&node_group, no_fragments);
DBUG_VOID_RETURN;
}
+
+bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes)
+{
+ /*
+ TODO: Remove the dummy return below, when cluster gets
+ signal from alter table when only .frm is changed. Cluster
+ needs it to manage the copies.
+ */
+ return COMPATIBLE_DATA_NO;
+
+ if (table_changes != IS_EQUAL_YES)
+ return COMPATIBLE_DATA_NO;
+
+ /* Check that auto_increment value was not changed */
+ if ((info->used_fields & HA_CREATE_USED_AUTO) &&
+ info->auto_increment_value != 0)
+ return COMPATIBLE_DATA_NO;
+
+ /* Check that row format didn't change */
+ if ((info->used_fields & HA_CREATE_USED_AUTO) &&
+ get_row_type() != info->row_type)
+ return COMPATIBLE_DATA_NO;
+
+ return COMPATIBLE_DATA_YES;
+}
+
#endif /* HAVE_NDBCLUSTER_DB */
--- 1.75/sql/ha_ndbcluster.h 2005-07-21 15:33:38 +02:00
+++ 1.76/sql/ha_ndbcluster.h 2005-07-25 10:30:25 +02:00
@@ -541,6 +541,10 @@
uint key_length,
qc_engine_callback *engine_callback,
ulonglong *engine_data);
+
+ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes);
+
private:
int alter_table_name(const char *to);
int drop_table();
--- 1.212/sql/ha_innodb.cc 2005-07-21 15:33:38 +02:00
+++ 1.213/sql/ha_innodb.cc 2005-07-25 10:30:25 +02:00
@@ -7132,4 +7132,24 @@
}
}
+
+bool ha_innobase::check_if_incompatible_data(HA_CREATE_INFO *info,
+ uint table_changes)
+{
+ if (table_changes != IS_EQUAL_YES)
+ return COMPATIBLE_DATA_NO;
+
+ /* Check that auto_increment value was not changed */
+ if ((info->used_fields & HA_CREATE_USED_AUTO) &&
+ info->auto_increment_value != 0)
+ return COMPATIBLE_DATA_NO;
+
+ /* Check that row format didn't change */
+ if ((info->used_fields & HA_CREATE_USED_AUTO) &&
+ get_row_type() != info->row_type)
+ return COMPATIBLE_DATA_NO;
+
+ return COMPATIBLE_DATA_YES;
+}
+
#endif /* HAVE_INNOBASE_DB */
--- 1.62/libmysqld/Makefile.am 2005-07-21 15:33:37 +02:00
+++ 1.63/libmysqld/Makefile.am 2005-07-25 10:30:25 +02:00
@@ -63,7 +63,7 @@
spatial.cc gstream.cc sql_help.cc tztime.cc protocol_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc rpl_filter.cc sql_view.cc sql_trigger.cc my_decimal.cc \
- ha_blackhole.cc
+ ha_blackhole.cc sql_partition.cc ha_partition.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
$(sqlexamplessources)
libmysqld_a_SOURCES=
--- 1.46/storage/ndb/src/ndbapi/ndberror.c 2005-07-21 16:15:16 +02:00
+++ 1.47/storage/ndb/src/ndbapi/ndberror.c 2005-07-25 10:50:22 +02:00
@@ -347,9 +347,9 @@
{ 743, SE, "Unsupported character set in table or index" },
{ 744, SE, "Character string is invalid for given character set" },
{ 745, SE, "Distribution key not supported for char attribute (use binary attribute)"
},
- { 747, SE, "Invalid undo buffer size" },
- { 748, SE, "Invalid extent size" },
- { 749, SE, "Out of filegroup records" },
+ { 763, SE, "Invalid undo buffer size" },
+ { 764, SE, "Invalid extent size" },
+ { 765, SE, "Out of filegroup records" },
{ 750, SE, "Invalid file type" },
{ 751, SE, "Out of file records" },
{ 752, SE, "Invalid file format" },
@@ -361,6 +361,9 @@
{ 758, SE, "Tablespace has changed" },
{ 759, SE, "Invalid tablespace version " },
{ 760, SE, "File already exists", },
+ { 747, AE, "Given NODEGROUP doesn't exist in this cluster" },
+ { 748, IE, "Given fragmentType doesn't exist" },
+ { 749, IE, "Primary Table in wrong state" },
{ 761, SE, "Unable to drop table as backup is in progress" },
{ 762, SE, "Unable to alter table as backup is in progress" },
{ 241, SE, "Invalid schema object version" },
| Thread |
|---|
| • bk commit into 5.1 tree (joreland:1.1947) | jonas.oreland | 25 Jul |