Commit d5c744d2 authored by unknown's avatar unknown

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


sql/handler.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbScanFilter.cpp:
  Auto merged
sql/ha_ndbcluster.cc:
  merge
parents 502e5c93 22e2ca54
......@@ -186,6 +186,34 @@ INITIAL_SIZE 1000000000000K
ENGINE = NDB;
ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion
DROP TABLE t1;
create tablespace ts2
add datafile 'datafile2_1.dat'
use logfile group lg1
initial_size 12M
engine ndb;
CREATE TABLE City (
ID int(11) NOT NULL AUTO_INCREMENT,
Name char(35) NOT NULL,
CountryCode char(3) NOT NULL,
District char(20) NOT NULL,
Population int(11) NOT NULL,
PRIMARY KEY (ID)
) ENGINE=ndbcluster
tablespace ts2
storage disk;
alter tablespace ts2
drop datafile 'datafile2_1.dat'
engine ndb;
insert
into City (Name,CountryCode,District,Population)
values ('BeiJing','CN','Beijing',2000);
ERROR HY000: Got error 1602 'No datafile in tablespace' from NDBCLUSTER
drop tablespace ts2
engine ndb;
ERROR HY000: Failed to drop TABLESPACE
drop table City;
drop tablespace ts2
engine ndb;
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN;
......
......@@ -7,6 +7,10 @@
# Change Date: 2006-01-11
# Change: Cleanup and test rename
#################################
# Change Author: Guangbao Ni
# Change Date: 2007-03-20
# Change: Test insert data when no datafile in spacetable
#################################
-- source include/have_ndb.inc
......@@ -216,6 +220,42 @@ ENGINE = NDB;
DROP TABLE t1;
create tablespace ts2
add datafile 'datafile2_1.dat'
use logfile group lg1
initial_size 12M
engine ndb;
CREATE TABLE City (
ID int(11) NOT NULL AUTO_INCREMENT,
Name char(35) NOT NULL,
CountryCode char(3) NOT NULL,
District char(20) NOT NULL,
Population int(11) NOT NULL,
PRIMARY KEY (ID)
) ENGINE=ndbcluster
tablespace ts2
storage disk;
alter tablespace ts2
drop datafile 'datafile2_1.dat'
engine ndb;
#It will give error messages: NoDatafile in tablespace
--error ER_GET_ERRMSG
insert
into City (Name,CountryCode,District,Population)
values ('BeiJing','CN','Beijing',2000);
--error ER_DROP_FILEGROUP_FAILED
drop tablespace ts2
engine ndb;
drop table City;
drop tablespace ts2
engine ndb;
############################
# Test update of mm/dd part
############################
......
......@@ -4440,7 +4440,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)
......@@ -10768,6 +10770,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);
......
......@@ -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");
......@@ -4698,6 +4700,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,6 +201,8 @@ int mysql_update(THD *thd,
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
else
{
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);
}
......
......@@ -31,7 +31,8 @@ struct AllocExtentReq {
enum ErrorCode {
UnmappedExtentPageIsNotImplemented = 1,
NoExtentAvailable = 1601
NoExtentAvailable = 1601,
NoDatafile = 1602
};
union
......
......@@ -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
......
......@@ -105,11 +105,11 @@ Ndbfs::execREAD_CONFIG_REQ(Signal* signal)
theRequestPool = new Pool<Request>;
m_maxFiles = 40;
m_maxFiles = 0;
ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
Uint32 noIdleFiles = 27;
ndb_mgm_get_int_parameter(p, CFG_DB_INITIAL_OPEN_FILES, &noIdleFiles);
if (noIdleFiles > m_maxFiles)
if (noIdleFiles > m_maxFiles && m_maxFiles != 0)
m_maxFiles = noIdleFiles;
// Create idle AsyncFiles
for (Uint32 i = 0; i < noIdleFiles; i++){
......@@ -650,7 +650,7 @@ AsyncFile*
Ndbfs::createAsyncFile(){
// Check limit of open files
if (theFiles.size()+1 == m_maxFiles) {
if (m_maxFiles !=0 && theFiles.size()+1 == m_maxFiles) {
// Print info about all open files
for (unsigned i = 0; i < theFiles.size(); i++){
AsyncFile* file = theFiles[i];
......
......@@ -1483,6 +1483,12 @@ Tsman::execALLOC_EXTENT_REQ(Signal* signal)
{
jam();
err = AllocExtentReq::NoExtentAvailable;
Local_datafile_list full_tmp(m_file_pool, ts_ptr.p->m_full_files);
if (tmp.isEmpty() && full_tmp.isEmpty())
{
jam();
err = AllocExtentReq::NoDatafile;
}
}
/**
......
......@@ -1966,6 +1966,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);
......@@ -2492,6 +2495,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"))
{
......@@ -2525,6 +2529,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();
......
......@@ -879,7 +879,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
"40",
"0",
"20",
STR_VALUE(MAX_INT_RNIL) },
......
......@@ -380,10 +380,10 @@ const ParamInfo ParamInfoArray[] = {
"If set to yes, then NDB Cluster data will not be swapped out to disk",
CI_USED,
true,
CI_BOOL,
"false",
"false",
"true" },
CI_INT,
"0",
"1",
"2" },
{
CFG_DB_WATCHDOG_INTERVAL,
......@@ -705,7 +705,7 @@ const ParamInfo ParamInfoArray[] = {
CI_USED,
false,
CI_INT,
"40",
"0",
"20",
STR_VALUE(MAX_INT_RNIL) },
......@@ -1115,6 +1115,18 @@ const ParamInfo ParamInfoArray[] = {
"0",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_DB_MEMREPORT_FREQUENCY,
"MemReportFrequency",
DB_TOKEN,
"Frequency of mem reports in seconds, 0 = only when passing %-limits",
CI_USED,
false,
CI_INT,
"0",
"0",
STR_VALUE(MAX_INT_RNIL) },
/***************************************************************************
* API
***************************************************************************/
......
......@@ -328,11 +328,17 @@ NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){
int
NdbScanFilter::isnull(int 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){
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);
}
......
......@@ -201,6 +201,7 @@ ErrorBundle ErrorCodes[] = {
{ 904, HA_ERR_INDEX_FILE_FULL, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" },
{ 905, DMEC, IS, "Out of attribute records (increase MaxNoOfAttributes)" },
{ 1601, HA_ERR_RECORD_FILE_FULL, IS, "Out extents, tablespace full" },
{ 1602, DMEC, IS,"No datafile in tablespace" },
/**
* TimeoutExpired
......
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