Commit bf466eee authored by unknown's avatar unknown

Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj

into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-bug21699

parents 4c073230 e6c667b1
......@@ -4366,7 +4366,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);
if (execute_commit(thd,trans) != 0)
{
......@@ -10662,6 +10664,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);
......
......@@ -4611,6 +4611,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");
......@@ -4691,6 +4692,18 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if (simple_open_n_lock_tables(thd, &src_tables_list))
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
......
......@@ -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);
}
}
......
......@@ -152,6 +152,8 @@ TCP_Transporter::initTransporter() {
void
TCP_Transporter::setSocketOptions(){
int sockOptKeepAlive = 1;
if (setsockopt(theSocket, SOL_SOCKET, SO_RCVBUF,
(char*)&sockOptRcvBufSize, sizeof(sockOptRcvBufSize)) < 0) {
#ifdef DEBUG_TRANSPORTER
......@@ -166,6 +168,11 @@ TCP_Transporter::setSocketOptions(){
#endif
}//if
if (setsockopt(theSocket, SOL_SOCKET, SO_KEEPALIVE,
(char*)&sockOptKeepAlive, sizeof(sockOptKeepAlive)) < 0) {
ndbout_c("The setsockopt SO_KEEPALIVE error code = %d", InetErrno);
}//if
//-----------------------------------------------
// Set the TCP_NODELAY option so also small packets are sent
// as soon as possible
......
......@@ -1963,6 +1963,9 @@ CommandInterpreter::executeRestart(Vector<BaseString> &command_list,
return -1;
}
if (!nostart)
ndbout_c("Shutting down nodes with \"-n, no start\" option, to subsequently start the nodes.");
result= ndb_mgm_restart3(m_mgmsrv, no_of_nodes, node_ids,
initialstart, nostart, abort, &need_disconnect);
......@@ -2489,6 +2492,7 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
{
flags = 0;
result = ndb_mgm_start_backup(m_mgmsrv, 0, &backupId, &reply);
goto END_BACKUP;
}
else if (sz == 1 || (sz == 3 && args[1] == "WAIT" && args[2] == "COMPLETED"))
{
......@@ -2522,6 +2526,7 @@ CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
}
result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
END_BACKUP:
if (result != 0) {
ndbout << "Backup failed" << endl;
printError();
......
......@@ -328,12 +328,18 @@ NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){
int
NdbScanFilter::isnull(int AttrId){
return m_impl.cond_col(Interpreter::IS_NULL, AttrId);
if(m_impl.m_negative == 1)
return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId);
else
return m_impl.cond_col(Interpreter::IS_NULL, AttrId);
}
int
NdbScanFilter::isnotnull(int AttrId){
return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId);
if(m_impl.m_negative == 1)
return m_impl.cond_col(Interpreter::IS_NULL, AttrId);
else
return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId);
}
struct tab3 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment