summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJustin.He/justin.he@dev3-240.dev.cn.tlan <>2007-04-05 12:26:01 +0800
committerJustin.He/justin.he@dev3-240.dev.cn.tlan <>2007-04-05 12:26:01 +0800
commit10dffc5a1917b9f5d7cd7c45e20446490a19a3bd (patch)
tree396ac36ed6b03ffd28556e94d00380df8db47243 /sql
parent343bfb779d9f85cb8d5fec1c76e8898291718d11 (diff)
parentfdf57c7ac2fd52f254daa6b6b11017d480d257aa (diff)
downloadmariadb-git-10dffc5a1917b9f5d7cd7c45e20446490a19a3bd.tar.gz
Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/mysql-5.1-new-ndb
into dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/mysql-5.1-new-ndb-bj.merge
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc34
-rw-r--r--sql/sql_table.cc14
-rw-r--r--sql/sql_update.cc6
3 files changed, 51 insertions, 3 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index cefd313067b..4a52aabc351 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -4457,7 +4457,9 @@ static int ndbcluster_commit(handlerton *hton, THD *thd, bool all)
DBUG_PRINT("transaction",("%s",
trans == thd_ndb->stmt ?
"stmt" : "all"));
- DBUG_ASSERT(ndb && trans);
+ DBUG_ASSERT(ndb);
+ if (trans == NULL)
+ DBUG_RETURN(0);
#ifdef HAVE_NDB_BINLOG
if (thd->slave_thread)
@@ -10787,6 +10789,36 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
if (field->flags & FIELD_IN_ADD_INDEX)
ai=1;
}
+
+ char tablespace_name[FN_LEN];
+ if (get_tablespace_name(current_thd, tablespace_name, FN_LEN))
+ {
+ if (create_info->tablespace)
+ {
+ if (strcmp(create_info->tablespace, tablespace_name))
+ {
+ DBUG_PRINT("info", ("storage media is changed, old tablespace=%s, new tablespace=%s",
+ tablespace_name, create_info->tablespace));
+ DBUG_RETURN(COMPATIBLE_DATA_NO);
+ }
+ }
+ else
+ {
+ DBUG_PRINT("info", ("storage media is changed, old is DISK and tablespace=%s, new is MEM",
+ tablespace_name));
+ DBUG_RETURN(COMPATIBLE_DATA_NO);
+ }
+ }
+ else
+ {
+ if (create_info->storage_media != HA_SM_MEMORY)
+ {
+ DBUG_PRINT("info", ("storage media is changed, old is MEM, new is DISK and tablespace=%s",
+ create_info->tablespace));
+ DBUG_RETURN(COMPATIBLE_DATA_NO);
+ }
+ }
+
if (table_changes != IS_EQUAL_YES)
DBUG_RETURN(COMPATIBLE_DATA_NO);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3eb47ebae6e..feaefa160b8 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3488,6 +3488,7 @@ bool mysql_create_table_internal(THD *thd,
{
bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
+
if (ha_table_exists_in_engine(thd, db, table_name))
{
DBUG_PRINT("info", ("Table with same name already existed in handler"));
@@ -4618,6 +4619,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
#ifdef WITH_PARTITION_STORAGE_ENGINE
char tmp_path[FN_REFLEN];
#endif
+ char ts_name[FN_LEN];
TABLE_LIST src_tables_list, dst_tables_list;
DBUG_ENTER("mysql_create_like_table");
@@ -4699,6 +4701,18 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
DBUG_RETURN(TRUE);
/*
+ For bug#25875, Newly created table through CREATE TABLE .. LIKE
+ has no ndb_dd attributes;
+ Add something to get possible tablespace info from src table,
+ it can get valid tablespace name only for disk-base ndb table
+ */
+ if ((src_tables_list.table->file->get_tablespace_name(thd, ts_name, FN_LEN)))
+ {
+ create_info->tablespace= ts_name;
+ create_info->storage_media= HA_SM_DISK;
+ }
+
+ /*
Validate the destination table
skip the destination table name checking as this is already
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 19c171b1be0..56c952f34ce 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -201,8 +201,10 @@ int mysql_update(THD *thd,
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
else
{
- bitmap_set_bit(table->write_set,
- table->timestamp_field->field_index);
+ if (table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
+ table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)
+ bitmap_set_bit(table->write_set,
+ table->timestamp_field->field_index);
}
}