3129 Magnus Blåudd 2010-11-29 [merge]
Merge 7.0 -> 5.5-telco-7.0
removed:
storage/ndb/src/common/util/filetest/
storage/ndb/src/common/util/filetest/FileUnitTest.cpp
storage/ndb/src/common/util/filetest/FileUnitTest.hpp
storage/ndb/src/common/util/filetest/Makefile
storage/ndb/src/kernel/blocks/dbdih/printSysfile/
storage/ndb/src/kernel/blocks/dbdih/printSysfile/Makefile
storage/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp
added:
storage/ndb/src/common/util/Vector.cpp
modified:
mysql-test/suite/ndb/r/ndb_index.result
mysql-test/suite/ndb/r/ndb_read_multi_range.result
mysql-test/suite/ndb/r/ndb_subquery.result
mysql-test/suite/ndb/t/ndb_index.test
mysql-test/suite/ndb/t/ndb_read_multi_range.test
mysql-test/suite/ndb/t/ndb_subquery.test
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
storage/ndb/CMakeLists.txt
storage/ndb/config/type_kernel.cmake
storage/ndb/include/ndb_config.h.in
storage/ndb/include/ndb_global.h
storage/ndb/include/portlib/NdbDir.hpp
storage/ndb/ndb_configure.cmake
storage/ndb/src/common/debugger/CMakeLists.txt
storage/ndb/src/common/util/BaseString.cpp
storage/ndb/src/common/util/CMakeLists.txt
storage/ndb/src/common/util/File.cpp
storage/ndb/src/common/util/Makefile.am
storage/ndb/src/common/util/SparseBitmask.cpp
storage/ndb/src/kernel/blocks/ERROR_codes.txt
storage/ndb/src/kernel/blocks/backup/CMakeLists.txt
storage/ndb/src/kernel/blocks/dbdict/CMakeLists.txt
storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp
storage/ndb/src/kernel/blocks/dbdih/CMakeLists.txt
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp
storage/ndb/src/kernel/blocks/dblqh/CMakeLists.txt
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/vm/GlobalData.hpp
storage/ndb/src/kernel/vm/mt.cpp
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
storage/ndb/src/mgmapi/mgmapi.cpp
storage/ndb/src/mgmclient/CommandInterpreter.cpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp
storage/ndb/src/mgmsrv/testConfig.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
storage/ndb/test/ndbapi/testBasic.cpp
storage/ndb/test/ndbapi/testBitfield.cpp
storage/ndb/test/ndbapi/testMgm.cpp
storage/ndb/test/ndbapi/testNdbApi.cpp
storage/ndb/test/ndbapi/testNodeRestart.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/test/run-test/main.cpp
3128 Magnus Blåudd 2010-11-29 [merge]
Merge 5.5-telco -> 5.5-telco-7.0
added:
mysql-test/suite/rpl/t/rpl_change_master_bind.inc
modified:
mysql-test/include/mysqld--help.inc
mysql-test/suite/rpl/r/rpl_change_master.result
mysql-test/suite/rpl/t/rpl_change_master.test
mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
sql/lex.h
sql/mysqld.h
sql/rpl_mi.cc
sql/rpl_mi.h
sql/slave.cc
sql/sql_lex.h
sql/sql_repl.cc
sql/sql_show.cc
sql/sql_yacc.yy
sql/sys_vars.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_index.result'
--- a/mysql-test/suite/ndb/r/ndb_index.result 2010-03-01 20:10:49 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index.result 2010-11-24 17:45:27 +0000
@@ -288,3 +288,93 @@ b
5
6
drop table t1;
+create table t1(vc varchar(16), i int, vc2 varchar(1024)
+, PRIMARY KEY(vc,vc2) USING HASH
+, KEY i1(i)
+, KEY i2(vc)
+) ENGINE=ndbcluster;
+insert into t1 values
+('1',1,'1'), ('2',2,'2'), ('3',3,'3'), ('4',1,'4'), ('5',2,'5'),
+('6',3,'6'), ('7',1,'7'), ('8',2,'8'), ('9',3,'9'), ('10',1,'10'),
+('11',2,'11'), ('12',3,'12'), ('13',1,'13'), ('14',2,'14'), ('15',3,'15'),
+('16',1,'16'), ('17',2,'17'), ('x',3,'x'), ('y',1,'y'), ('z',2,'z'),
+('1000',3,'1000'), ('2000',3,'2000'), ('10000',3,'10000');
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+explain
+select i,vc from t1
+where i>=1 or vc > '0';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,i1,i2 i1,i2 5,18 NULL 20 Using sort_union(i1,i2); Using where with pushed condition
+select i,vc from t1
+where i>=1 or vc > '0';
+i vc
+1 1
+1 10
+1 13
+1 16
+1 4
+1 7
+1 y
+2 11
+2 14
+2 17
+2 2
+2 5
+2 8
+2 z
+3 1000
+3 10000
+3 12
+3 15
+3 2000
+3 3
+3 6
+3 9
+3 x
+create table t2(vc varchar(16), i int, vc2 varchar(1024)
+, KEY i1(i)
+, KEY i2(vc)
+) ENGINE=ndbcluster;
+insert into t2 values
+('1',1,'1'), ('2',2,'2'), ('3',3,'3'), ('4',1,'4'), ('5',2,'5'),
+('6',3,'6'), ('7',1,'7'), ('8',2,'8'), ('9',3,'9'), ('10',1,'10'),
+('11',2,'11'), ('12',3,'12'), ('13',1,'13'), ('14',2,'14'), ('15',3,'15'),
+('16',1,'16'), ('17',2,'17'), ('x',3,'x'), ('y',1,'y'), ('z',2,'z'),
+('1000',3,'1000'), ('2000',3,'2000'), ('10000',3,'10000');
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+explain
+select i,vc from t2
+where i>=1 or vc > '0';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index_merge i1,i2 i1,i2 5,19 NULL 20 Using sort_union(i1,i2); Using where with pushed condition
+select i,vc from t2
+where i>=1 or vc > '0';
+i vc
+1 1
+1 10
+1 13
+1 16
+1 4
+1 7
+1 y
+2 11
+2 14
+2 17
+2 2
+2 5
+2 8
+2 z
+3 1000
+3 10000
+3 12
+3 15
+3 2000
+3 3
+3 6
+3 9
+3 x
+drop table t1, t2;
=== modified file 'mysql-test/suite/ndb/r/ndb_read_multi_range.result'
--- a/mysql-test/suite/ndb/r/ndb_read_multi_range.result 2009-02-03 13:35:56 +0000
+++ b/mysql-test/suite/ndb/r/ndb_read_multi_range.result 2010-11-24 13:16:09 +0000
@@ -588,3 +588,24 @@ i i 9
m m 13
v v 22
drop table t1, t2;
+create table t1 (pk int primary key, a int) engine=ndb;
+create table t2 (pk int primary key, a int) engine=ndb;
+insert into t2 values
+(0,0), (1,1), (2,2), (3,3), (4,4),
+(5,5), (6,6), (7,7), (8,8), (9,9);
+insert into t1
+select
+t1.a + t2.a*10 + t3.a*100 + t4.a*1000,
+(t1.a + t2.a*10 + t3.a*100 + t4.a*1000) / 1000
+from
+t2 as t1, t2 as t2, t2 as t3, t2 as t4
+where (t1.a + t2.a*10 + t3.a*100 + t4.a*1000) < 3000;
+explain
+SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM
+t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3000 Using temporary
+1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Distinct
+SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM
+t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
+drop table t1, t2;
=== modified file 'mysql-test/suite/ndb/r/ndb_subquery.result'
--- a/mysql-test/suite/ndb/r/ndb_subquery.result 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_subquery.result 2010-11-24 13:05:04 +0000
@@ -89,4 +89,10 @@ a b
3 30
4 30
drop table if exists t1, t2, t3, t4;
+create table t (k int, uq int, unique key ix1 (uq)) engine = ndb;
+insert into t values (1,3), (3,6), (6,9), (9,1);
+select * from t where
+k in (select uq from t as subq where subq.k>10);
+k uq
+drop table if exists t;
End of 5.1 tests
=== modified file 'mysql-test/suite/ndb/t/ndb_index.test'
--- a/mysql-test/suite/ndb/t/ndb_index.test 2010-03-01 20:10:49 +0000
+++ b/mysql-test/suite/ndb/t/ndb_index.test 2010-11-24 17:45:27 +0000
@@ -192,3 +192,50 @@ select distinct b from t1;
select distinct b from t1 group by b;
drop table t1;
+
+# bug#58280
+create table t1(vc varchar(16), i int, vc2 varchar(1024)
+ , PRIMARY KEY(vc,vc2) USING HASH
+ , KEY i1(i)
+ , KEY i2(vc)
+ ) ENGINE=ndbcluster;
+
+insert into t1 values
+('1',1,'1'), ('2',2,'2'), ('3',3,'3'), ('4',1,'4'), ('5',2,'5'),
+('6',3,'6'), ('7',1,'7'), ('8',2,'8'), ('9',3,'9'), ('10',1,'10'),
+('11',2,'11'), ('12',3,'12'), ('13',1,'13'), ('14',2,'14'), ('15',3,'15'),
+('16',1,'16'), ('17',2,'17'), ('x',3,'x'), ('y',1,'y'), ('z',2,'z'),
+('1000',3,'1000'), ('2000',3,'2000'), ('10000',3,'10000');
+
+analyze table t1;
+explain
+select i,vc from t1
+ where i>=1 or vc > '0';
+
+--sorted_result
+select i,vc from t1
+ where i>=1 or vc > '0';
+
+# also test with hidden primary key
+create table t2(vc varchar(16), i int, vc2 varchar(1024)
+ , KEY i1(i)
+ , KEY i2(vc)
+ ) ENGINE=ndbcluster;
+
+insert into t2 values
+('1',1,'1'), ('2',2,'2'), ('3',3,'3'), ('4',1,'4'), ('5',2,'5'),
+('6',3,'6'), ('7',1,'7'), ('8',2,'8'), ('9',3,'9'), ('10',1,'10'),
+('11',2,'11'), ('12',3,'12'), ('13',1,'13'), ('14',2,'14'), ('15',3,'15'),
+('16',1,'16'), ('17',2,'17'), ('x',3,'x'), ('y',1,'y'), ('z',2,'z'),
+('1000',3,'1000'), ('2000',3,'2000'), ('10000',3,'10000');
+
+analyze table t2;
+explain
+select i,vc from t2
+ where i>=1 or vc > '0';
+
+--sorted_result
+select i,vc from t2
+ where i>=1 or vc > '0';
+
+drop table t1, t2;
=== modified file 'mysql-test/suite/ndb/t/ndb_read_multi_range.test'
--- a/mysql-test/suite/ndb/t/ndb_read_multi_range.test 2010-09-22 11:36:01 +0000
+++ b/mysql-test/suite/ndb/t/ndb_read_multi_range.test 2010-11-24 17:45:27 +0000
@@ -428,3 +428,53 @@ select * from t1
or (a = 'v')
order by a asc, b asc;
drop table t1, t2;
+
+########################
+# Check propper reinit of a mrr executed multiple time as part of a join.
+# The mrr access is driven by a scan and executed as for every tuple
+# in the scaned table.
+#
+# In certain queries the optimizer don't read the entire mrr result set
+# before it fetch the next tuple from the scanned table.
+# The next mrr operation would then still have an open scan which wasn't
+# cleaned up as expected. This may cause all available NdbOperation,
+# NdbTransaction or lock objects to be consumed before the operation
+# could finish.
+#####################
+
+create table t1 (pk int primary key, a int) engine=ndb;
+create table t2 (pk int primary key, a int) engine=ndb;
+
+insert into t2 values
+ (0,0), (1,1), (2,2), (3,3), (4,4),
+ (5,5), (6,6), (7,7), (8,8), (9,9);
+
+##
+# 10^4 cross product on t2 creates 10.000 rows:
+# Insert volume has been tunes to insert only 3.000
+# of these as this is sufficient to produce an 'out of connection objects'
+##
+insert into t1
+ select
+ t1.a + t2.a*10 + t3.a*100 + t4.a*1000,
+ (t1.a + t2.a*10 + t3.a*100 + t4.a*1000) / 1000
+from
+ t2 as t1, t2 as t2, t2 as t3, t2 as t4
+where (t1.a + t2.a*10 + t3.a*100 + t4.a*1000) < 3000;
+
+
+# Execute a 'scan(t1) join mrr(t2)'
+# - 'DISTINCT t1.pk' will cause optimizer to stop fetching mrr(t2)
+# when the first matching 't2.a = t1.a' is found.
+# - 'LEFT JOIN' is to ensure that 'Using join buffer' is *not* used
+#
+explain
+SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM
+ t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
+
+--disable_result_log
+SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM
+ t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
+--enable_result_log
+
+drop table t1, t2;
=== modified file 'mysql-test/suite/ndb/t/ndb_subquery.test'
--- a/mysql-test/suite/ndb/t/ndb_subquery.test 2007-11-29 10:29:35 +0000
+++ b/mysql-test/suite/ndb/t/ndb_subquery.test 2010-11-24 13:05:04 +0000
@@ -75,4 +75,15 @@ select * from t3 where exists (select *
drop table if exists t1, t2, t3, t4;
+##########
+# bug#58163
+
+create table t (k int, uq int, unique key ix1 (uq)) engine = ndb;
+insert into t values (1,3), (3,6), (6,9), (9,1);
+
+select * from t where
+ k in (select uq from t as subq where subq.k>10);
+
+drop table if exists t;
+
--echo End of 5.1 tests
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-11-16 14:15:52 +0000
+++ b/sql/ha_ndbcluster.cc 2010-11-29 15:42:25 +0000
@@ -3103,8 +3103,8 @@ inline int ha_ndbcluster::fetch_next(Ndb
(long) m_thd_ndb->m_unsent_bytes));
if (m_thd_ndb->m_unsent_bytes)
{
- if (flush_bulk_insert() != 0)
- DBUG_RETURN(-1);
+ if ((error = flush_bulk_insert()) != 0)
+ DBUG_RETURN(error);
}
contact_ndb= (local_check == 2);
}
@@ -3309,8 +3309,11 @@ int ha_ndbcluster::ordered_index_scan(co
if (m_active_cursor && (error= close_scan()))
DBUG_RETURN(error);
- if (m_active_cursor && (error= close_scan()))
- DBUG_RETURN(error);
+ if (m_thd_ndb->m_unsent_bytes)
+ {
+ if ((error = flush_bulk_insert()) != 0)
+ DBUG_RETURN(error);
+ }
const NdbOperation::LockMode lm = get_ndb_lock_mode(m_lock.type);
@@ -3430,6 +3433,12 @@ int ha_ndbcluster::full_table_scan(const
DBUG_ENTER("full_table_scan");
DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname));
+ if (m_thd_ndb->m_unsent_bytes)
+ {
+ if ((error = flush_bulk_insert()) != 0)
+ DBUG_RETURN(error);
+ }
+
if (m_use_partition_pruning && m_user_defined_partitioning)
{
part_spec.start_part= 0;
@@ -5289,8 +5298,10 @@ int ha_ndbcluster::index_read(uchar *buf
default:
break;
}
- DBUG_RETURN(read_range_first_to_buf(&start_key, 0, descending,
- m_sorted, buf));
+ const int error= read_range_first_to_buf(&start_key, 0, descending,
+ m_sorted, buf);
+ table->status=error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
@@ -5298,7 +5309,9 @@ int ha_ndbcluster::index_next(uchar *buf
{
DBUG_ENTER("ha_ndbcluster::index_next");
ha_statistic_increment(&SSV::ha_read_next_count);
- DBUG_RETURN(next_result(buf));
+ const int error= next_result(buf);
+ table->status=error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
@@ -5306,7 +5319,9 @@ int ha_ndbcluster::index_prev(uchar *buf
{
DBUG_ENTER("ha_ndbcluster::index_prev");
ha_statistic_increment(&SSV::ha_read_prev_count);
- DBUG_RETURN(next_result(buf));
+ const int error= next_result(buf);
+ table->status=error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
@@ -5317,7 +5332,9 @@ int ha_ndbcluster::index_first(uchar *bu
// Start the ordered index scan and fetch the first row
// Only HA_READ_ORDER indexes get called by index_first
- DBUG_RETURN(ordered_index_scan(0, 0, TRUE, FALSE, buf, NULL));
+ const int error= ordered_index_scan(0, 0, TRUE, FALSE, buf, NULL);
+ table->status=error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
@@ -5325,7 +5342,9 @@ int ha_ndbcluster::index_last(uchar *buf
{
DBUG_ENTER("ha_ndbcluster::index_last");
ha_statistic_increment(&SSV::ha_read_last_count);
- DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
+ const int error= ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL);
+ table->status=error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
int ha_ndbcluster::index_read_last(uchar * buf, const uchar * key, uint key_len)
@@ -5520,9 +5539,14 @@ int ha_ndbcluster::rnd_next(uchar *buf)
DBUG_ENTER("rnd_next");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
- if (!m_active_cursor)
- DBUG_RETURN(full_table_scan(NULL, NULL, NULL, buf));
- DBUG_RETURN(next_result(buf));
+ int error;
+ if (m_active_cursor)
+ error= next_result(buf);
+ else
+ error= full_table_scan(NULL, NULL, NULL, buf);
+
+ table->status= error ? STATUS_NOT_FOUND: 0;
+ DBUG_RETURN(error);
}
@@ -5587,6 +5611,7 @@ int ha_ndbcluster::rnd_pos(uchar *buf, u
*/
res= HA_ERR_RECORD_DELETED;
}
+ table->status= res ? STATUS_NOT_FOUND: 0;
DBUG_RETURN(res);
}
}
@@ -5686,6 +5711,44 @@ void ha_ndbcluster::position(const uchar
DBUG_VOID_RETURN;
}
+int
+ha_ndbcluster::cmp_ref(const uchar * ref1, const uchar * ref2)
+{
+ DBUG_ENTER("cmp_ref");
+
+ if (table_share->primary_key != MAX_KEY)
+ {
+ KEY *key_info= table->key_info + table_share->primary_key;
+ KEY_PART_INFO *key_part= key_info->key_part;
+ KEY_PART_INFO *end= key_part + key_info->key_parts;
+
+ for (; key_part != end; key_part++)
+ {
+ // NOTE: No need to check for null since PK is not-null
+
+ Field *field= key_part->field;
+ int result= field->key_cmp(ref1, ref2);
+ if (result)
+ {
+ DBUG_RETURN(result);
+ }
+
+ if (field->type() == MYSQL_TYPE_VARCHAR)
+ {
+ ref1+= 2;
+ ref2+= 2;
+ }
+
+ ref1+= key_part->length;
+ ref2+= key_part->length;
+ }
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ DBUG_RETURN(memcmp(ref1, ref2, ref_length));
+ }
+}
int ha_ndbcluster::info(uint flag)
{
@@ -11691,10 +11754,17 @@ ha_ndbcluster::read_multi_range_first(KE
const NdbOperation* op;
Thd_ndb *thd_ndb= m_thd_ndb;
NdbTransaction *trans= m_thd_ndb->trans;
+ int error;
DBUG_ENTER("ha_ndbcluster::read_multi_range_first");
DBUG_PRINT("info", ("blob fields=%d read_set=0x%x", table_share->blob_fields, table->read_set->bitmap[0]));
+ if (m_thd_ndb->m_unsent_bytes)
+ {
+ if ((error = flush_bulk_insert()) != 0)
+ DBUG_RETURN(error);
+ }
+
/**
* blobs and unique hash index with NULL can't be batched currently
*/
@@ -11712,6 +11782,14 @@ ha_ndbcluster::read_multi_range_first(KE
sorted,
buffer));
}
+
+ /**
+ * There may still be an open m_multi_cursor from the previous mrr access on this handler.
+ * Close it now to free up resources for this NdbScanOperation.
+ */
+ if (unlikely((error= close_scan())))
+ DBUG_RETURN(error);
+
thd_ndb->query_state|= NDB_QUERY_MULTI_READ_RANGE;
m_disable_multi_read= FALSE;
@@ -11747,15 +11825,14 @@ ha_ndbcluster::read_multi_range_first(KE
*/
DBUG_ASSERT(cur_index_type != UNDEFINED_INDEX);
+ DBUG_ASSERT(m_multi_cursor==NULL);
- m_multi_cursor= 0;
const NdbOperation* lastOp= trans ? trans->getLastDefinedOperation() : 0;
const NdbOperation::LockMode lm = get_ndb_lock_mode(m_lock.type);
uchar *row_buf= (uchar *)buffer->buffer;
const uchar *end_of_buffer= buffer->buffer_end;
uint num_scan_ranges= 0;
uint i;
- int error;
bool any_real_read= FALSE;
if (m_read_before_write_removal_possible)
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2010-11-15 10:52:52 +0000
+++ b/sql/ha_ndbcluster.h 2010-11-29 15:42:25 +0000
@@ -405,6 +405,7 @@ class ha_ndbcluster: public handler
int rnd_next(uchar *buf);
int rnd_pos(uchar *buf, uchar *pos);
void position(const uchar *record);
+ virtual int cmp_ref(const uchar * ref1, const uchar * ref2);
int read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_range, bool sorted);
=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt 2010-11-17 11:35:04 +0000
+++ b/storage/ndb/CMakeLists.txt 2010-11-18 10:17:29 +0000
@@ -58,14 +58,6 @@ IF(WITH_NDB_TEST)
MESSAGE(STATUS "Building NDB test programs")
ENDIF()
-SET(WITH_NDB_PORT "" CACHE INTEGER
- "Default port used by NDB Cluster management server")
-IF(WITH_NDB_PORT GREATER 0)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDB_PORT=\"${WITH_NDB_PORT}\"")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDB_PORT=\"${WITH_NDB_PORT}\"")
- MESSAGE ( STATUS "Setting management server port to ${WITH_NDB_PORT}" )
-ENDIF()
-
OPTION(WITH_NDB_BINLOG
"Disable NDB binlog" ON)
@@ -90,13 +82,6 @@ ELSE()
ENDIF()
ENDIF()
-IF(MSVC)
- # Disable some warnings for NDB build on Windows
- # 4355: 'this': used in base member initializer list
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4355")
-ENDIF()
-
IF(NOT SOURCE_SUBLIBS)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
=== modified file 'storage/ndb/config/type_kernel.cmake'
--- a/storage/ndb/config/type_kernel.cmake 2008-08-21 06:37:31 +0000
+++ b/storage/ndb/config/type_kernel.cmake 2010-11-26 10:42:53 +0000
@@ -13,23 +13,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_BINARY_DIR}/include
- ${CMAKE_BINARY_DIR}/storage/ndb/include
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/storage/ndb/include
- ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/vm
- ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/error
- ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/blocks
- ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/kernel
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/transporter
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/debugger
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmcommon
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/ndbapi
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/util
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib
- ${CMAKE_SOURCE_DIR}/storage/ndb/include/logger
- ${CMAKE_SOURCE_DIR}/zlib)
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/vm
+ ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/error
+ ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel/blocks
+ ${CMAKE_SOURCE_DIR}/storage/ndb/src/kernel
+)
=== modified file 'storage/ndb/include/ndb_config.h.in'
--- a/storage/ndb/include/ndb_config.h.in 2010-11-09 10:45:29 +0000
+++ b/storage/ndb/include/ndb_config.h.in 2010-11-18 09:38:59 +0000
@@ -34,3 +34,4 @@
#cmakedefine HAVE_LINUX_FUTEX 1
#cmakedefine HAVE_ATOMIC_H 1
#cmakedefine HAVE_SUN_PREFETCH_H 1
+#cmakedefine NDB_PORT @NDB_PORT@
=== modified file 'storage/ndb/include/ndb_global.h'
--- a/storage/ndb/include/ndb_global.h 2010-11-15 15:03:18 +0000
+++ b/storage/ndb/include/ndb_global.h 2010-11-18 10:17:29 +0000
@@ -46,7 +46,11 @@
#define NDB_WIN 1
#define PATH_MAX 256
#define DIR_SEPARATOR "\\"
-#pragma warning(disable: 4503 4786)
+
+/* Disable a few compiler warnings on Windows */
+/* 4355: 'this': used in base member initializer list */
+#pragma warning(disable: 4355)
+
#else
#undef NDB_WIN32
#undef NDB_WIN
=== modified file 'storage/ndb/include/portlib/NdbDir.hpp'
--- a/storage/ndb/include/portlib/NdbDir.hpp 2010-11-17 10:37:58 +0000
+++ b/storage/ndb/include/portlib/NdbDir.hpp 2010-11-18 10:03:45 +0000
@@ -16,7 +16,7 @@
#ifndef NdbDir_HPP
#define NdbDir_HPP
-#ifdef __WIN32
+#ifdef _WIN32
#ifndef mode_t /* MySQL 5.5+ defines mode_t */
typedef int mode_t;
#endif
=== modified file 'storage/ndb/ndb_configure.cmake'
--- a/storage/ndb/ndb_configure.cmake 2010-11-10 09:42:49 +0000
+++ b/storage/ndb/ndb_configure.cmake 2010-11-18 09:38:59 +0000
@@ -130,6 +130,13 @@ IF(WITH_NDBMTD)
ENDIF()
+SET(WITH_NDB_PORT "" CACHE INTEGER
+ "Default port used by MySQL Cluster management server")
+IF(WITH_NDB_PORT GREATER 0)
+ SET(NDB_PORT ${WITH_NDB_PORT})
+ MESSAGE(STATUS "Setting MySQL Cluster management server port to ${NDB_PORT}")
+ENDIF()
+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/ndb_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/ndb_config.h)
=== modified file 'storage/ndb/src/common/debugger/CMakeLists.txt'
--- a/storage/ndb/src/common/debugger/CMakeLists.txt 2010-11-11 15:08:52 +0000
+++ b/storage/ndb/src/common/debugger/CMakeLists.txt 2010-11-26 10:42:53 +0000
@@ -22,6 +22,8 @@ ADD_LIBRARY(ndbtrace STATIC
SignalLoggerManager.cpp
DebuggerNames.cpp
BlockNames.cpp
- EventLogger.cpp)
+ EventLogger.cpp
+ ${NDB_SOURCE_DIR}/src/kernel/error/ndbd_exit_codes.c
+)
-TARGET_LINK_LIBRARIES(ndbtrace ndblogger ndberror ndbgeneral)
+TARGET_LINK_LIBRARIES(ndbtrace ndblogger ndbgeneral)
=== modified file 'storage/ndb/src/common/util/BaseString.cpp'
--- a/storage/ndb/src/common/util/BaseString.cpp 2010-09-21 07:36:08 +0000
+++ b/storage/ndb/src/common/util/BaseString.cpp 2010-11-28 11:34:01 +0000
@@ -646,5 +646,4 @@ TAPTEST(BaseString)
#endif
-template class Vector<char *>;
template class Vector<BaseString>;
=== modified file 'storage/ndb/src/common/util/CMakeLists.txt'
--- a/storage/ndb/src/common/util/CMakeLists.txt 2010-11-11 16:14:33 +0000
+++ b/storage/ndb/src/common/util/CMakeLists.txt 2010-11-28 11:34:01 +0000
@@ -53,6 +53,7 @@ ADD_LIBRARY(ndbgeneral STATIC
Bitmask.cpp
SparseBitmask.cpp
require.c
+ Vector.cpp
)
TARGET_LINK_LIBRARIES(ndbgeneral ndbtrace ${ZLIB_LIBRARY} mysys)
=== modified file 'storage/ndb/src/common/util/File.cpp'
--- a/storage/ndb/src/common/util/File.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/common/util/File.cpp 2010-11-22 15:00:08 +0000
@@ -19,9 +19,8 @@
#include <ndb_global.h>
#include <File.hpp>
-
#include <NdbOut.hpp>
-#include <my_dir.h>
+#include <sys/stat.h>
//
// PUBLIC
@@ -29,33 +28,27 @@
time_t
File_class::mtime(const char* aFileName)
{
- MY_STAT stmp;
- time_t rc = 0;
-
- if (my_stat(aFileName, &stmp, MYF(0)) != NULL) {
- rc = stmp.st_mtime;
- }
-
- return rc;
+ struct stat s;
+ if (stat(aFileName, &s) != 0)
+ return 0;
+ return s.st_mtime;
}
bool
File_class::exists(const char* aFileName)
{
- MY_STAT stmp;
-
- return (my_stat(aFileName, &stmp, MYF(0))!=NULL);
+ struct stat s;
+ if (stat(aFileName, &s) != 0)
+ return false;
+ return true;
}
off_t
File_class::size(FILE* f)
{
- MY_STAT s;
-
- // Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
- if (my_fstat(fileno(f), &s, MYF(0)))
+ struct stat s;
+ if (fstat(fileno(f), &s) != 0)
return 0;
-
return s.st_size;
}
=== modified file 'storage/ndb/src/common/util/Makefile.am'
--- a/storage/ndb/src/common/util/Makefile.am 2010-10-27 11:32:32 +0000
+++ b/storage/ndb/src/common/util/Makefile.am 2010-11-29 15:42:25 +0000
@@ -28,7 +28,7 @@ libgeneral_la_SOURCES = \
strdup.c \
ConfigValues.cpp ndb_init.cpp basestring_vsnprintf.c \
Bitmask.cpp SparseBitmask.cpp parse_mask.hpp \
- ndb_rand.c require.c
+ ndb_rand.c require.c Vector.cpp
INCLUDES_LOC = @ZLIB_INCLUDES@
=== modified file 'storage/ndb/src/common/util/SparseBitmask.cpp'
--- a/storage/ndb/src/common/util/SparseBitmask.cpp 2010-11-11 09:46:05 +0000
+++ b/storage/ndb/src/common/util/SparseBitmask.cpp 2010-11-28 11:34:01 +0000
@@ -91,6 +91,3 @@ TAPTEST(SparseBitmask)
}
#endif
-
-template class Vector<unsigned>;
-
=== added file 'storage/ndb/src/common/util/Vector.cpp'
--- a/storage/ndb/src/common/util/Vector.cpp 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/common/util/Vector.cpp 2010-11-28 11:34:01 +0000
@@ -0,0 +1,27 @@
+/*
+ Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "Vector.hpp"
+
+template class Vector<int>;
+template class Vector<Uint8>;
+template class Vector<Uint16>;
+template class Vector<Uint32>;
+template class Vector<Uint64>;
+template class Vector<char*>;
+template class Vector<const char*>;
+template class Vector<Vector<Uint32> >;
=== removed directory 'storage/ndb/src/common/util/filetest'
=== removed file 'storage/ndb/src/common/util/filetest/FileUnitTest.cpp'
--- a/storage/ndb/src/common/util/filetest/FileUnitTest.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/common/util/filetest/FileUnitTest.cpp 1970-01-01 00:00:00 +0000
@@ -1,239 +0,0 @@
-/*
- Copyright (C) 2003 MySQL AB
- All rights reserved. Use is subject to license terms.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "FileUnitTest.hpp"
-#include <File.hpp>
-
-#include <NdbOut.hpp>
-
-typedef bool (*TESTFUNC)(const char*);
-
-typedef const char TESTNAME;
-typedef struct
-{
- const char* name;
- TESTFUNC test;
-}Tests;
-
-static Tests testCases[] = { {"Create/Write", &FileUnitTest::testWrite},
- {"Read", &FileUnitTest::testRead},
- {"Exists", &FileUnitTest::testExists},
- {"File Size", &FileUnitTest::testSize},
- {"Rename", &FileUnitTest::testRename},
- {"Remove", &FileUnitTest::testRemove} };
-
-static int testFailed = 0;
-
-int main(int argc, char* argv[])
-{
- if (argc < 2)
- {
- ndbout << "Usage: filetest <filename>" << endl;
- return 0;
- }
- const char* fileName = argv[1];
-
- int testCount = (sizeof(testCases) / sizeof(Tests));
- ndbout << "Starting " << testCount << " tests..." << endl;
- for (int i = 0; i < testCount; i++)
- {
- ndbout << "-- " << " Test " << i + 1
- << " [" << testCases[i].name << "] --" << endl;
- if (testCases[i].test(fileName))
- {
- ndbout << "-- Passed --" << endl;
- }
- else
- {
- ndbout << "-- Failed -- " << endl;
- }
-
- }
- ndbout << endl << "-- " << testCount - testFailed << " passed, "
- << testFailed << " failed --" << endl;
- return 0;
-}
-
-
-bool
-FileUnitTest::testWrite(const char* aFileName)
-{
- bool rc = true;
- File f;
- if (f.open(aFileName, "w"))
- {
- f.writeChar("ABABABABABAB ABBABAB ABBABA ABAB JKH KJHA JHHAHAH...");
- f.writeChar("12129791242 1298371923 912738912 378129837128371128132...\n");
- f.close();
- }
- else
- {
- error("testWrite failed: ");
- rc = false;
- }
- return rc;
-}
-
-bool
-FileUnitTest::testRead(const char* aFileName)
-{
- bool rc = true;
- // Read file
- File f;
- if (f.open(aFileName, "r"))
- {
- long size = f.size();
- ndbout << "File size = " << size << endl;
- ndbout << "Allocating buf of " << size << " bytes" << endl;
- char* buf = new char[size];
- buf[size - 1] = '\0';
- int r = 0;
- while ((r = f.readChar(buf, r, size)) > 0)
- {
- ndbout << "Read(" << r << "):" << buf << endl;
- }
- f.close();
- delete buf;
- }
- else
- {
- error("readTest failed: ");
- rc = false;
- }
- return rc;
-}
-
-bool
-FileUnitTest::testExists(const char* aFileName)
-{
- bool rc = true;
- if (File::exists(aFileName))
- {
- if (File::exists("ThisFileShouldnotbe.txt"))
- {
- rc = false;
- error("testExists failed, the file should NOT be found.");
- }
- }
- else
- {
- rc = false;
- error("testExists failed, the file should exist.");
- }
-
- return rc;
-}
-
-
-bool
-FileUnitTest::testSize(const char* aFileName)
-{
- bool rc = true;
- File f;
- if (f.open(aFileName, "r"))
- {
- long size = f.size();
- if (size <= 0)
- {
- rc = false;
- error("testSize failed, size is <= 0");
- }
- ndbout << "File size = " << size << endl;
- }
- else
- {
- rc = false;
- error("testSize failed, could no open file.");
- }
- f.close();
- return rc;
-}
-
-bool
-FileUnitTest::testRename(const char* aFileName)
-{
- bool rc = true;
- if (File::rename(aFileName, "filetest_new.txt"))
- {
- if (!File::exists("filetest_new.txt"))
- {
- rc = false;
- error("testRename failed, new file does not exists.");
- }
- else
- {
- ndbout << "Renamed " << aFileName << " to filetest_new.txt" << endl;
- }
- }
- else
- {
- rc = false;
- error("testRename failed, unable to rename file.");
- }
-
- return rc;
-}
-
-bool
-FileUnitTest::testRemove(const char* aFileName)
-{
- bool rc = true;
- File f;
- if (f.open("filetest_new.txt", "r"))
- {
- if (!f.remove())
- {
- rc = false;
- error("testRemove failed, could not remove file.");
- }
- else
- {
- if (File::exists("filetest_new"))
- {
- rc = false;
- error("testRemove failed, file was not removed, it still exists.");
- }
- }
- } // (f.open("filetest_new", "r"))
- else
- {
- rc = false;
- error("testRemove failed, could not read the file.");
- }
-
- return rc;
-}
-
-void
-FileUnitTest::error(const char* msg)
-{
- testFailed++;
- ndbout << "Test failed: " << msg << endl;
- perror("Errno msg");
-}
-
-
-FileUnitTest::FileUnitTest()
-{
-
-}
-
-FileUnitTest::~FileUnitTest()
-{
-
-}
=== removed file 'storage/ndb/src/common/util/filetest/FileUnitTest.hpp'
--- a/storage/ndb/src/common/util/filetest/FileUnitTest.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/common/util/filetest/FileUnitTest.hpp 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-/*
- Copyright (C) 2003 MySQL AB
- All rights reserved. Use is subject to license terms.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef FILEUNITTEST_H
-#define FILEUNITTEST_H
-
-/**
- * Unit test of File.
- *
- * @version #@ $Id: FileUnitTest.hpp,v 1.1 2002/03/13 18:09:03 eyualex Exp $
- */
-class FileUnitTest
-{
-public:
- static bool testWrite(const char* aFileName);
- static bool testRead(const char* aFileName);
- static bool testExists(const char* aFileName);
- static bool testSize(const char* aFileName);
- static bool testRename(const char* aFileName);
- static bool testRemove(const char* aFileName);
-
- static void error(const char* msg);
-private:
- FileUnitTest();
- ~FileUnitTest();
-
-};
-#endif
=== removed file 'storage/ndb/src/common/util/filetest/Makefile'
--- a/storage/ndb/src/common/util/filetest/Makefile 2005-04-27 01:19:54 +0000
+++ b/storage/ndb/src/common/util/filetest/Makefile 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-include .defs.mk
-
-TYPE :=
-
-BIN_TARGET := filetest
-BIN_TARGET_ARCHIVES := portlib general
-
-SOURCES := FileUnitTest.cpp
-
-CCFLAGS_LOC += -I$(NDB_TOP)/include/logger -I$(NDB_TOP)/include/portlib
-
-include $(NDB_TOP)/Epilogue.mk
-
-
=== modified file 'storage/ndb/src/kernel/blocks/ERROR_codes.txt'
--- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt 2010-10-28 12:59:31 +0000
+++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt 2010-11-24 12:16:55 +0000
@@ -3,7 +3,7 @@ Next NDBCNTR 1002
Next NDBFS 2000
Next DBACC 3002
Next DBTUP 4035
-Next DBLQH 5061
+Next DBLQH 5064
Next DBDICT 6026
Next DBDIH 7229
Next DBTC 8088
=== modified file 'storage/ndb/src/kernel/blocks/backup/CMakeLists.txt'
--- a/storage/ndb/src/kernel/blocks/backup/CMakeLists.txt 2010-01-04 00:59:59 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/CMakeLists.txt 2010-11-26 10:42:53 +0000
@@ -13,9 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-INCLUDE(${CMAKE_SOURCE_DIR}/storage/ndb/config/type_kernel.cmake)
-
ADD_EXECUTABLE(ndb_print_backup_file read.cpp)
TARGET_LINK_LIBRARIES(ndb_print_backup_file
- ndbtrace ndblogger ndbgeneral ndberror ndbportlib)
+ ndbtrace ndblogger ndbgeneral ndbportlib)
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/CMakeLists.txt'
--- a/storage/ndb/src/kernel/blocks/dbdict/CMakeLists.txt 2010-01-04 00:59:59 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/CMakeLists.txt 2010-11-26 10:42:53 +0000
@@ -13,10 +13,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-INCLUDE(${CMAKE_SOURCE_DIR}/storage/ndb/config/type_kernel.cmake)
-
ADD_EXECUTABLE(ndb_print_schema_file
printSchemaFile.cpp)
TARGET_LINK_LIBRARIES(ndb_print_schema_file
- ndbtrace ndblogger ndbgeneral ndberror ndbportlib)
+ ndbtrace ndblogger ndbgeneral ndbportlib)
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp 2010-11-26 10:42:53 +0000
@@ -25,7 +25,7 @@
#include <NdbMain.h>
#include <NdbOut.hpp>
-#include <SchemaFile.hpp>
+#include "SchemaFile.hpp"
#include <kernel_types.h>
static const char* progname = 0;
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/CMakeLists.txt'
--- a/storage/ndb/src/kernel/blocks/dbdih/CMakeLists.txt 2010-01-04 00:59:59 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/CMakeLists.txt 2010-11-26 10:42:53 +0000
@@ -14,8 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-INCLUDE(${CMAKE_SOURCE_DIR}/storage/ndb/config/type_kernel.cmake)
-
ADD_EXECUTABLE(ndb_print_sys_file printSysfile.cpp)
TARGET_LINK_LIBRARIES(ndb_print_sys_file
- ndbtrace ndblogger ndbgeneral ndberror ndbportlib)
+ ndbtrace ndblogger ndbgeneral ndbportlib)
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2010-10-25 18:35:08 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2010-11-22 14:27:12 +0000
@@ -1714,6 +1714,17 @@ void Dbdih::execNDB_STTOR(Signal* signal
break;
case ZNDB_SPH5:
jam();
+ if (m_gcp_monitor.m_micro_gcp.m_max_lag > 0)
+ {
+ infoEvent("GCP Monitor: Computed max GCP_SAVE lag to %u seconds",
+ m_gcp_monitor.m_gcp_save.m_max_lag / 10);
+ infoEvent("GCP Monitor: Computed max GCP_COMMIT lag to %u seconds",
+ m_gcp_monitor.m_micro_gcp.m_max_lag / 10);
+ }
+ else
+ {
+ infoEvent("GCP Monitor: unlimited lags allowed");
+ }
switch(typestart){
case NodeState::ST_INITIAL_START:
case NodeState::ST_SYSTEM_RESTART:
@@ -5850,6 +5861,17 @@ void Dbdih::MASTER_GCPhandling(Signal* s
m_micro_gcp.m_master.m_start_time = 0;
m_gcp_save.m_master.m_start_time = 0;
+ if (m_gcp_monitor.m_micro_gcp.m_max_lag > 0)
+ {
+ infoEvent("GCP Monitor: Computed max GCP_SAVE lag to %u seconds",
+ m_gcp_monitor.m_gcp_save.m_max_lag / 10);
+ infoEvent("GCP Monitor: Computed max GCP_COMMIT lag to %u seconds",
+ m_gcp_monitor.m_micro_gcp.m_max_lag / 10);
+ }
+ else
+ {
+ infoEvent("GCP Monitor: unlimited lags allowed");
+ }
bool ok = false;
switch(m_micro_gcp.m_master.m_state){
@@ -13947,11 +13969,29 @@ void Dbdih::checkGcpStopLab(Signal* sign
if (m_gcp_monitor.m_gcp_save.m_gci == m_gcp_save.m_gci)
{
jam();
- if (cnt0 == m_gcp_monitor.m_gcp_save.m_max_lag)
+ if (m_gcp_monitor.m_gcp_save.m_max_lag &&
+ cnt0 == m_gcp_monitor.m_gcp_save.m_max_lag)
{
crashSystemAtGcpStop(signal, false);
return;
}
+
+ Uint32 threshold = 60; // seconds
+ if (cnt0 && ((cnt0 % (threshold * 10)) == 0))
+ {
+ if (m_gcp_monitor.m_gcp_save.m_max_lag)
+ {
+ warningEvent("GCP Monitor: GCP_SAVE lag %u seconds"
+ " (max lag: %us)",
+ cnt0/10, m_gcp_monitor.m_gcp_save.m_max_lag/10);
+ }
+ else
+ {
+ warningEvent("GCP Monitor: GCP_SAVE lag %u seconds"
+ " (no max lag)",
+ cnt0/10);
+ }
+ }
}
else
{
@@ -13967,11 +14007,28 @@ void Dbdih::checkGcpStopLab(Signal* sign
m_gcp_monitor.m_micro_gcp.m_max_lag :
m_gcp_monitor.m_gcp_save.m_max_lag;
- if (cnt1 == cmp)
+ if (cmp && cnt1 == cmp)
{
crashSystemAtGcpStop(signal, false);
return;
}
+
+ Uint32 threshold = 10; // seconds
+ if (cnt1 && ((cnt0 % (threshold * 10)) == 0))
+ {
+ if (m_gcp_monitor.m_micro_gcp.m_max_lag)
+ {
+ warningEvent("GCP Monitor: GCP_COMMIT lag %u seconds"
+ " (max lag: %u)",
+ cnt1/10, m_gcp_monitor.m_micro_gcp.m_max_lag/10);
+ }
+ else
+ {
+ warningEvent("GCP Monitor: GCP_COMMIT lag %u seconds"
+ " (no max lag)",
+ cnt1/10);
+ }
+ }
}
else
{
@@ -14932,9 +14989,19 @@ void Dbdih::initCommonData()
{ // Set time-between epochs timeout
Uint32 tmp = 4000;
ndb_mgm_get_int_parameter(p, CFG_DB_MICRO_GCP_TIMEOUT, &tmp);
- tmp += max_failure_time;
- m_gcp_monitor.m_micro_gcp.m_max_lag =
- (m_micro_gcp.m_master.m_time_between_gcp + tmp) / 100;
+ if (tmp != 0)
+ {
+ jam();
+ tmp += max_failure_time;
+ m_gcp_monitor.m_micro_gcp.m_max_lag =
+ (m_micro_gcp.m_master.m_time_between_gcp + tmp) / 100;
+ }
+ else
+ {
+ jam();
+ m_gcp_monitor.m_gcp_save.m_max_lag = 0;
+ m_gcp_monitor.m_micro_gcp.m_max_lag = 0;
+ }
}
}
}//Dbdih::initCommonData()
=== removed directory 'storage/ndb/src/kernel/blocks/dbdih/printSysfile'
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp 2010-11-26 10:37:44 +0000
@@ -18,11 +18,11 @@
#include <ndb_global.h>
-#include <my_dir.h>
+#include <sys/stat.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
-#include <Sysfile.hpp>
+#include "Sysfile.hpp"
static int g_all = 0;
@@ -139,9 +139,9 @@ NDB_COMMAND(printSysfile,
continue;
}
- MY_STAT sbuf,*st;
+ struct stat sbuf;
- if(!(st=my_stat(filename, &sbuf,0)))
+ if(stat(filename, &sbuf) != 0)
{
ndbout << "Could not find file: \"" << filename << "\"" << endl;
continue;
=== removed file 'storage/ndb/src/kernel/blocks/dbdih/printSysfile/Makefile'
--- a/storage/ndb/src/kernel/blocks/dbdih/printSysfile/Makefile 2005-04-27 01:19:54 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/printSysfile/Makefile 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-BIN_TARGET := printSysfile
-BIN_TARGET_ARCHIVES := portlib general
-
-CCFLAGS_LOC += -I..
-
-SOURCES := printSysfile.cpp
-
-include $(NDB_TOP)/Epilogue.mk
=== removed file 'storage/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp 2009-10-15 12:31:11 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp 1970-01-01 00:00:00 +0000
@@ -1,162 +0,0 @@
-/*
- Copyright (C) 2003 MySQL AB
- All rights reserved. Use is subject to license terms.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#include <ndb_global.h>
-
-#include <NdbMain.h>
-#include <NdbOut.hpp>
-#include <Sysfile.hpp>
-
-void
-usage(const char * prg){
- ndbout << "Usage " << prg
- << " P[0-1].sysfile" << endl;
-}
-
-struct NSString {
- Sysfile::ActiveStatus NodeStatus;
- const char * desc;
-};
-
-static const
-NSString NodeStatusStrings[] = {
- { Sysfile::NS_Active, "Active " },
- { Sysfile::NS_ActiveMissed_1, "Active missed 1" },
- { Sysfile::NS_ActiveMissed_2, "Active missed 2" },
- { Sysfile::NS_ActiveMissed_3, "Active missed 3" },
- { Sysfile::NS_HotSpare, "Hot spare " },
- { Sysfile::NS_NotActive_NotTakenOver, "Not active " },
- { Sysfile::NS_TakeOver, "Take over " },
- { Sysfile::NS_NotActive_TakenOver, "Taken over " },
- { Sysfile::NS_NotDefined, "Not defined " },
- { Sysfile::NS_Standby, "Stand by " }
-};
-
-const
-char * getNSString(Uint32 ns){
- for(Uint32 i = 0; i<(sizeof(NodeStatusStrings)/sizeof(NSString)); i++)
- if((Uint32)NodeStatusStrings[i].NodeStatus == ns)
- return NodeStatusStrings[i].desc;
- return "<Unknown state>";
-}
-
-void
-fill(const char * buf, int mod){
- int len = strlen(buf)+1;
- ndbout << buf << " ";
- while((len % mod) != 0){
- ndbout << " ";
- len++;
- }
-}
-
-void
-print(const char * filename, const Sysfile * sysfile){
- char buf[255];
- ndbout << "----- Sysfile: " << filename << " -----" << endl;
- ndbout << "Initial start ongoing: "
- << Sysfile::getInitialStartOngoing(sysfile->systemRestartBits)
- << ", ";
-
- ndbout << "Restart Ongoing: "
- << Sysfile::getRestartOngoing(sysfile->systemRestartBits)
- << ", ";
-
- ndbout << "LCP Ongoing: "
- << Sysfile::getLCPOngoing(sysfile->systemRestartBits)
- << endl;
-
-
- ndbout << "-- Global Checkpoint Identities: --" << endl;
- sprintf(buf, "keepGCI = %u", sysfile->keepGCI);
- fill(buf, 40);
- ndbout << " -- Tail of REDO log" << endl;
-
- sprintf(buf, "oldestRestorableGCI = %u", sysfile->oldestRestorableGCI);
- fill(buf, 40);
- ndbout << " -- " << endl;
-
- sprintf(buf, "newestRestorableGCI = %u", sysfile->newestRestorableGCI);
- fill(buf, 40);
- ndbout << " -- " << endl;
-
- sprintf(buf, "latestLCP = %u", sysfile->latestLCP_ID);
- fill(buf, 40);
- ndbout << " -- " << endl;
-
- ndbout << "-- Node status: --" << endl;
- for(int i = 1; i < MAX_NDB_NODES; i++){
- if(Sysfile::getNodeStatus(i, sysfile->nodeStatus) !=Sysfile::NS_NotDefined){
- sprintf(buf,
- "Node %.2d -- %s GCP: %d, NodeGroup: %d, TakeOverNode: %d, "
- "LCP Ongoing: %s",
- i,
- getNSString(Sysfile::getNodeStatus(i,sysfile->nodeStatus)),
- sysfile->lastCompletedGCI[i],
- Sysfile::getNodeGroup(i, sysfile->nodeGroups),
- Sysfile::getTakeOverNode(i, sysfile->takeOver),
- BitmaskImpl::get(NdbNodeBitmask::Size,
- sysfile->lcpActive, i) != 0 ? "yes" : "no");
- ndbout << buf << endl;
- }
- }
-}
-
-NDB_COMMAND(printSysfile,
- "printSysfile", "printSysfile", "Prints a sysfile", 16384){
- ndb_init();
- if(argc < 2){
- usage(argv[0]);
- return 0;
- }
-
- for(int i = 1; i<argc; i++){
- const char * filename = argv[i];
-
- MY_STAT sbuf,*st;
-
- if(!st=my_stat(filename, &sbuf,0))
- {
- ndbout << "Could not find file: \"" << filename << "\"" << endl;
- continue;
- }
- const Uint32 bytes = sbuf.st_size;
-
- Uint32 * buf = new Uint32[bytes/4+1];
-
- FILE * f = fopen(filename, "rb");
- if(f == 0){
- ndbout << "Failed to open file" << endl;
- delete [] buf;
- continue;
- }
- Uint32 sz = fread(buf, 1, bytes, f);
- fclose(f);
- if(sz != bytes){
- ndbout << "Failure while reading file" << endl;
- delete [] buf;
- continue;
- }
-
- print(filename, (Sysfile *)&buf[0]);
- delete [] buf;
- continue;
- }
- return 0;
-}
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/CMakeLists.txt'
--- a/storage/ndb/src/kernel/blocks/dblqh/CMakeLists.txt 2010-01-04 00:59:59 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/CMakeLists.txt 2010-11-26 10:42:53 +0000
@@ -14,10 +14,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-INCLUDE(${CMAKE_SOURCE_DIR}/storage/ndb/config/type_kernel.cmake)
-
ADD_EXECUTABLE(ndb_redo_log_reader
redoLogReader/records.cpp
redoLogReader/reader.cpp)
TARGET_LINK_LIBRARIES(ndb_redo_log_reader
- ndbtrace ndblogger ndbgeneral ndberror ndbportlib)
+ ndbtrace ndblogger ndbgeneral ndbportlib)
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2010-11-01 16:11:10 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2010-11-24 12:16:55 +0000
@@ -3103,7 +3103,11 @@ void Dblqh::execPACKED_SIGNAL(Signal* si
TcommitLen = 4;
Tgci_lo_mask = 0;
}
-
+
+#ifdef ERROR_INSERT
+ Uint32 senderBlockRef = signal->getSendersBlockRef();
+#endif
+
ndbrequire(Tlength <= 25);
MEMCOPY_NO_WORDS(&TpackedData[0], &signal->theData[0], Tlength);
while (Tlength > Tstep) {
@@ -3172,6 +3176,9 @@ void Dblqh::execPACKED_SIGNAL(Signal* si
ndbrequire(false);
return;
}//switch
+#ifdef ERROR_INSERT
+ signal->header.theSendersBlockRef = senderBlockRef;
+#endif
}//while
ndbrequire(Tlength == Tstep);
return;
@@ -7147,6 +7154,24 @@ void Dblqh::execCOMMIT(Signal* signal)
sendSignalWithDelay(cownref, GSN_COMMIT, signal, 2000,signal->getLength());
return;
}//if
+ if (ERROR_INSERTED(5062) &&
+ ((refToMain(signal->getSendersBlockRef()) == DBTC) ||
+ signal->getSendersBlockRef() == reference()))
+ {
+ Uint32 save = signal->getSendersBlockRef();
+ ndbout_c("Delaying execCOMMIT");
+ sendSignalWithDelay(cownref, GSN_COMMIT, signal, 2000, signal->getLength());
+
+ if (refToMain(save) == DBTC)
+ {
+ ndbout_c("killing %u", refToNode(save));
+ signal->theData[0] = 9999;
+ sendSignal(numberToRef(CMVMI, refToNode(save)),
+ GSN_NDB_TAMPER, signal, 1, JBB);
+ }
+ return;
+ }
+
tcConnectptr.i = tcIndex;
ptrAss(tcConnectptr, regTcConnectionrec);
if ((tcConnectptr.p->transid[0] == transid1) &&
@@ -7284,6 +7309,24 @@ void Dblqh::execCOMPLETE(Signal* signal)
sendSignalWithDelay(cownref, GSN_COMPLETE, signal, 2000, 3);
return;
}//if
+ if (ERROR_INSERTED(5063) &&
+ ((refToMain(signal->getSendersBlockRef()) == DBTC) ||
+ signal->getSendersBlockRef() == reference()))
+ {
+ Uint32 save = signal->getSendersBlockRef();
+ ndbout_c("Delaying execCOMPLETE");
+ sendSignalWithDelay(cownref, GSN_COMPLETE,signal, 2000,signal->getLength());
+
+ if (refToMain(save) == DBTC)
+ {
+ ndbout_c("killing %u", refToNode(save));
+ signal->theData[0] = 9999;
+ sendSignal(numberToRef(CMVMI, refToNode(save)),
+ GSN_NDB_TAMPER, signal, 1, JBB);
+ }
+ return;
+ }
+
tcConnectptr.i = tcIndex;
ptrAss(tcConnectptr, regTcConnectionrec);
if ((tcConnectptr.p->transactionState == TcConnectionrec::COMMITTED) &&
@@ -7840,8 +7883,6 @@ void Dblqh::commitReplyLab(Signal* signa
sendSignal(tcConnectptr.p->reqBlockref, GSN_COMMITCONF, signal, 4, JBB);
} else {
ndbrequire(regTcPtr->abortState == TcConnectionrec::NEW_FROM_TC);
- jam();
- sendLqhTransconf(signal, LqhTransConf::Committed);
}//if
return;
}//Dblqh::commitReplyLab()
@@ -7894,7 +7935,6 @@ void Dblqh::completeUnusualLab(Signal* s
sendAborted(signal);
} else if (regTcPtr->abortState == TcConnectionrec::NEW_FROM_TC) {
jam();
- sendLqhTransconf(signal, LqhTransConf::Committed);
} else {
ndbrequire(regTcPtr->abortState == TcConnectionrec::REQ_FROM_TC);
jam();
@@ -8356,6 +8396,7 @@ void Dblqh::abortStateHandlerLab(Signal*
/*WE ARE ONLY CHECKING THE STATUS OF THE TRANSACTION. IT IS COMMITTING. */
/*COMPLETE THE COMMIT LOCALLY AND THEN SEND REPORT OF COMMITTED TO THE NEW TC*/
/* ------------------------------------------------------------------------- */
+ sendLqhTransconf(signal, LqhTransConf::Committed);
return;
break;
case TcConnectionrec::COMMITTED:
@@ -8868,6 +8909,29 @@ void Dblqh::lqhTransNextLab(Signal* sign
* now scan markers
*/
#ifdef ERROR_INSERT
+ if (ERROR_INSERTED(5061))
+ {
+ CLEAR_ERROR_INSERT_VALUE;
+ for (Uint32 i = 0; i < cnoOfNodes; i++)
+ {
+ Uint32 node = cnodeData[i];
+ if (node != getOwnNodeId() && cnodeStatus[i] == ZNODE_UP)
+ {
+ ndbout_c("clearing ERROR_INSERT in LQH:%u", node);
+ signal->theData[0] = 0;
+ sendSignal(numberToRef(DBLQH, node), GSN_NDB_TAMPER,
+ signal, 1, JBB);
+ }
+ }
+
+ signal->theData[0] = ZSCAN_MARKERS;
+ signal->theData[1] = tcNodeFailptr.i;
+ signal->theData[2] = 0;
+ signal->theData[3] = RNIL;
+ sendSignalWithDelay(cownref, GSN_CONTINUEB, signal, 5000, 4);
+ return;
+ }
+
if (ERROR_INSERTED(5050))
{
ndbout_c("send ZSCAN_MARKERS with 5s delay and killing master");
=== modified file 'storage/ndb/src/kernel/vm/GlobalData.hpp'
--- a/storage/ndb/src/kernel/vm/GlobalData.hpp 2010-04-28 12:21:54 +0000
+++ b/storage/ndb/src/kernel/vm/GlobalData.hpp 2010-11-25 12:53:32 +0000
@@ -96,6 +96,7 @@ struct GlobalData {
SimulatedBlock * getBlockInstance(BlockNumber fullBlockNo) {
return getBlock(blockToMain(fullBlockNo), blockToInstance(fullBlockNo));
}
+ SimulatedBlock * mt_getBlock(BlockNumber blockNo, Uint32 instanceNo);
void incrementWatchDogCounter(Uint32 place);
Uint32 * getWatchDogPtr();
=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp 2010-11-09 10:45:29 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp 2010-11-25 12:53:32 +0000
@@ -34,6 +34,16 @@
#include "mt-asm.h"
+inline
+SimulatedBlock*
+GlobalData::mt_getBlock(BlockNumber blockNo, Uint32 instanceNo)
+{
+ SimulatedBlock* b = getBlock(blockNo);
+ if (b != 0 && instanceNo != 0)
+ b = b->getInstance(instanceNo);
+ return b;
+}
+
#ifdef __GNUC__
/* Provides a small (but noticeable) speedup in benchmarks. */
#define memcpy __builtin_memcpy
@@ -2395,7 +2405,7 @@ execute_signals(thr_data *selfptr, thr_j
}
Uint32 bno = blockToMain(s->theReceiversBlockNumber);
Uint32 ino = map_instance(s);
- SimulatedBlock* block = globalData.getBlock(bno, ino);
+ SimulatedBlock* block = globalData.mt_getBlock(bno, ino);
assert(block != 0);
Uint32 gsn = s->theVerId_signalNumber;
=== modified file 'storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp'
--- a/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp 2010-05-24 08:04:47 +0000
+++ b/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp 2010-11-28 11:34:01 +0000
@@ -1076,4 +1076,3 @@ main(int argc, char** argv)
template class Vector<Chunk>;
#endif
-template class Vector<Uint32>;
=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp 2010-10-27 11:32:32 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp 2010-11-29 15:42:25 +0000
@@ -550,6 +550,41 @@ ndb_mgm_call(NdbMgmHandle handle,
DBUG_RETURN(p);
}
+/*
+ ndb_mgm_call_slow
+
+ Some commands are synchronous and known to take longer time
+ to complete(for example restart and stop). Increase the timeout
+ value before sending command if the timeout value is set lower
+ than what is normal.
+
+ Unfortunately the restart or stop may take longer than the
+ defalt min timeout value selected, mgmapi users can workaround
+ this problem by setting an even larger timeout for all commands
+ or only around restart and stop.
+
+*/
+
+static inline
+const Properties *
+ndb_mgm_call_slow(NdbMgmHandle handle,
+ const ParserRow<ParserDummy> *command_reply,
+ const char *cmd, const Properties *cmd_args,
+ unsigned int min_timeout = 5*60*1000, // ms
+ const char* cmd_bulk= NULL)
+{
+ const unsigned int save_timeout = handle->timeout;
+ if (min_timeout > save_timeout)
+ handle->timeout = min_timeout;
+ const Properties* reply = ndb_mgm_call(handle, command_reply,
+ cmd, cmd_args, cmd_bulk);
+
+ // Restore saved timeout value
+ handle->timeout = save_timeout;
+
+ return reply;
+}
+
/**
* Returns true if connected
*/
@@ -1290,7 +1325,6 @@ ndb_mgm_stop4(NdbMgmHandle handle, int n
DBUG_RETURN(-1);
}
- Uint32 stoppedNoOfNodes = 0;
if(no_of_nodes <= 0){
/**
* All nodes should be stopped (all or just db)
@@ -1302,12 +1336,14 @@ ndb_mgm_stop4(NdbMgmHandle handle, int n
// force has no effect, continue anyway for consistency
const Properties *reply;
if(use_v2)
- reply = ndb_mgm_call(handle, stop_reply_v2, "stop all", &args);
+ reply = ndb_mgm_call_slow(handle, stop_reply_v2, "stop all", &args);
else
- reply = ndb_mgm_call(handle, stop_reply_v1, "stop all", &args);
+ reply = ndb_mgm_call_slow(handle, stop_reply_v1, "stop all", &args);
CHECK_REPLY(handle, reply, -1);
- if(!reply->get("stopped", &stoppedNoOfNodes)){
+ Uint32 stopped = 0;
+ if(!reply->get("stopped", &stopped))
+ {
SET_ERROR(handle, NDB_MGM_STOP_FAILED,
"Could not get number of stopped nodes from mgm server");
delete reply;
@@ -1325,7 +1361,7 @@ ndb_mgm_stop4(NdbMgmHandle handle, int n
DBUG_RETURN(-1);
}
delete reply;
- DBUG_RETURN(stoppedNoOfNodes);
+ DBUG_RETURN(stopped);
}
/**
@@ -1351,12 +1387,14 @@ ndb_mgm_stop4(NdbMgmHandle handle, int n
const Properties *reply;
if(use_v2)
- reply = ndb_mgm_call(handle, stop_reply_v2, "stop v2", &args);
+ reply = ndb_mgm_call_slow(handle, stop_reply_v2, "stop v2", &args);
else
- reply = ndb_mgm_call(handle, stop_reply_v1, "stop", &args);
+ reply = ndb_mgm_call_slow(handle, stop_reply_v1, "stop", &args);
+ CHECK_REPLY(handle, reply, -1);
- CHECK_REPLY(handle, reply, stoppedNoOfNodes);
- if(!reply->get("stopped", &stoppedNoOfNodes)){
+ Uint32 stopped;
+ if(!reply->get("stopped", &stopped))
+ {
SET_ERROR(handle, NDB_MGM_STOP_FAILED,
"Could not get number of stopped nodes from mgm server");
delete reply;
@@ -1374,7 +1412,7 @@ ndb_mgm_stop4(NdbMgmHandle handle, int n
DBUG_RETURN(-1);
}
delete reply;
- DBUG_RETURN(stoppedNoOfNodes);
+ DBUG_RETURN(stopped);
}
extern "C"
@@ -1413,7 +1451,7 @@ ndb_mgm_restart4(NdbMgmHandle handle, in
DBUG_ENTER("ndb_mgm_restart");
CHECK_HANDLE(handle, -1);
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_restart4");
- Uint32 restarted = 0;
+
const ParserRow<ParserDummy> restart_reply_v1[] = {
MGM_CMD("restart reply", NULL, ""),
MGM_ARG("result", String, Mandatory, "Error message"),
@@ -1454,11 +1492,8 @@ ndb_mgm_restart4(NdbMgmHandle handle, in
args.put("initialstart", initial);
args.put("nostart", nostart);
// force has no effect, continue anyway for consistency
- const Properties *reply;
- const int timeout = handle->timeout;
- handle->timeout= 5*60*1000; // 5 minutes
- reply = ndb_mgm_call(handle, restart_reply_v1, "restart all", &args);
- handle->timeout= timeout;
+ const Properties *reply =
+ ndb_mgm_call_slow(handle, restart_reply_v1, "restart all", &args);
CHECK_REPLY(handle, reply, -1);
BaseString result;
@@ -1468,6 +1503,8 @@ ndb_mgm_restart4(NdbMgmHandle handle, in
delete reply;
DBUG_RETURN(-1);
}
+
+ Uint32 restarted;
if(!reply->get("restarted", &restarted)){
SET_ERROR(handle, NDB_MGM_RESTART_FAILED,
"Could not get restarted number of nodes from mgm server");
@@ -1500,29 +1537,28 @@ ndb_mgm_restart4(NdbMgmHandle handle, in
"The connected mgm server does not support 'restart --force'");
const Properties *reply;
- const int timeout = handle->timeout;
- handle->timeout= 5*60*1000; // 5 minutes
if(use_v2)
- reply = ndb_mgm_call(handle, restart_reply_v2, "restart node v2", &args);
+ reply = ndb_mgm_call_slow(handle, restart_reply_v2,
+ "restart node v2", &args);
else
- reply = ndb_mgm_call(handle, restart_reply_v1, "restart node", &args);
- handle->timeout= timeout;
- if(reply != NULL) {
- BaseString result;
- reply->get("result", result);
- if(strcmp(result.c_str(), "Ok") != 0) {
- SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str());
- delete reply;
- DBUG_RETURN(-1);
- }
- reply->get("restarted", &restarted);
- if(use_v2)
- reply->get("disconnect", (Uint32*)disconnect);
- else
- *disconnect= 0;
+ reply = ndb_mgm_call_slow(handle, restart_reply_v1,
+ "restart node", &args);
+ CHECK_REPLY(handle, reply, -1);
+
+ BaseString result;
+ reply->get("result", result);
+ if(strcmp(result.c_str(), "Ok") != 0) {
+ SET_ERROR(handle, NDB_MGM_RESTART_FAILED, result.c_str());
delete reply;
- }
-
+ DBUG_RETURN(-1);
+ }
+ Uint32 restarted;
+ reply->get("restarted", &restarted);
+ if(use_v2)
+ reply->get("disconnect", (Uint32*)disconnect);
+ else
+ *disconnect= 0;
+ delete reply;
DBUG_RETURN(restarted);
}
=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2010-11-11 09:46:05 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2010-11-28 11:34:01 +0000
@@ -3181,6 +3181,3 @@ err:
ndbout << "Invalid arguments: expected <NG>" << endl;
return -1;
}
-
-template class Vector<char const*>;
-template class Vector<int>;
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2010-10-28 13:24:21 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2010-11-22 14:27:12 +0000
@@ -1038,7 +1038,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_INT,
"4000",
"0",
- "32000" },
+ "256000" },
{
CFG_DB_MAX_BUFFERED_EPOCHS,
=== modified file 'storage/ndb/src/mgmsrv/testConfig.cpp'
--- a/storage/ndb/src/mgmsrv/testConfig.cpp 2010-11-11 09:46:05 +0000
+++ b/storage/ndb/src/mgmsrv/testConfig.cpp 2010-11-28 11:34:01 +0000
@@ -471,6 +471,3 @@ TAPTEST(MgmConfig)
ndb_end(0);
return 1; // OK
}
-
-template class Vector<const char*>;
-
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-11-09 20:40:03 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-11-28 11:34:01 +0000
@@ -8005,13 +8005,6 @@ NdbDictInterface::execCREATE_HASH_MAP_CO
m_impl->theWaiter.signal(NO_WAIT);
}
-
-
-template class Vector<int>;
-template class Vector<Uint8>;
-template class Vector<Uint16>;
-template class Vector<Uint32>;
-template class Vector<Vector<Uint32> >;
template class Vector<NdbTableImpl*>;
template class Vector<NdbColumnImpl*>;
=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-11-28 11:34:01 +0000
@@ -3644,6 +3644,5 @@ EventBufData_hash::search(Pos& hpos, Ndb
DBUG_VOID_RETURN_EVENT;
}
-template class Vector<Uint64>;
template class Vector<Gci_container_pod>;
template class Vector<NdbEventBuffer::EventBufData_chunk*>;
=== modified file 'storage/ndb/test/ndbapi/testBasic.cpp'
--- a/storage/ndb/test/ndbapi/testBasic.cpp 2010-08-31 06:39:44 +0000
+++ b/storage/ndb/test/ndbapi/testBasic.cpp 2010-11-28 11:34:01 +0000
@@ -1491,8 +1491,6 @@ runBug28073(NDBT_Context *ctx, NDBT_Step
return result;
}
-template class Vector<Uint64>;
-
int
runBug20535(NDBT_Context* ctx, NDBT_Step* step)
{
=== modified file 'storage/ndb/test/ndbapi/testBitfield.cpp'
--- a/storage/ndb/test/ndbapi/testBitfield.cpp 2010-09-03 05:35:51 +0000
+++ b/storage/ndb/test/ndbapi/testBitfield.cpp 2010-11-28 11:34:01 +0000
@@ -665,4 +665,3 @@ testBitmask()
}
template class Vector<Alloc>;
-template class Vector<Uint32>;
=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp 2010-06-14 13:36:31 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp 2010-11-26 09:41:23 +0000
@@ -2483,6 +2483,68 @@ int runTestDumpEvents(NDBT_Context* ctx,
return NDBT_OK;
}
+int runTestStatusAfterStop(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NdbMgmd mgmd;
+ mgmd.set_timeout(50); // Short timeout, should be upgraded
+
+ if (!mgmd.connect())
+ return NDBT_FAILED;
+
+ ndb_mgm_node_type
+ node_types[2] = { NDB_MGM_NODE_TYPE_NDB,
+ NDB_MGM_NODE_TYPE_UNKNOWN };
+
+ // Test: get status, stop node, get status again
+ printf("Getting status\n");
+ ndb_mgm_cluster_state *cs = ndb_mgm_get_status2(mgmd.handle(), node_types);
+ if (cs == NULL)
+ {
+ printf("%s (%d)\n", ndb_mgm_get_latest_error_msg(mgmd.handle()),
+ ndb_mgm_get_latest_error(mgmd.handle()));
+ return NDBT_FAILED;
+ }
+
+ for(int i=0; i < cs->no_of_nodes; i++ )
+ {
+ ndb_mgm_node_state *ns = cs->node_states + i;
+ printf("Node ID: %d status:%d\n", ns->node_id, ns->node_status);
+ }
+ free(cs);
+ cs = NULL;
+
+ printf("Stopping data node\n");
+ // We only stop 1 data node, in this case NodeId=2
+ int nodes[1] = { 2 };
+ int stopped = ndb_mgm_stop2(mgmd.handle(), NDB_ARRAY_SIZE(nodes), nodes, 0);
+ if (stopped < 0)
+ {
+ printf("ndb_mgm_stop failed, '%s' (%d)\n",
+ ndb_mgm_get_latest_error_msg(mgmd.handle()),
+ ndb_mgm_get_latest_error(mgmd.handle()));
+ return NDBT_FAILED;
+ }
+
+ printf("Stopped %d data node(s)\n", stopped);
+
+ printf("Getting status\n");
+ cs = ndb_mgm_get_status2(mgmd.handle(), node_types);
+ if (cs == NULL)
+ {
+ printf("%s (%d)\n", ndb_mgm_get_latest_error_msg(mgmd.handle()),
+ ndb_mgm_get_latest_error(mgmd.handle()));
+ return NDBT_FAILED;
+ }
+ for(int i=0; i < cs->no_of_nodes; i++ )
+ {
+ ndb_mgm_node_state *ns = cs->node_states + i;
+ printf("Node ID: %d status:%d\n", ns->node_id, ns->node_status);
+ }
+ free(cs);
+
+ return NDBT_OK;
+}
+
NDBT_TESTSUITE(testMgm);
DRIVER(DummyDriver); /* turn off use of NdbApi */
TESTCASE("ApiSessionFailure",
@@ -2614,6 +2676,10 @@ TESTCASE("TestDumpEvents",
"Test 'dump events'"){
STEPS(runTestDumpEvents, 1);
}
+TESTCASE("TestStatusAfterStop",
+ "Test get status after stop "){
+ STEPS(runTestStatusAfterStop, 1);
+}
NDBT_TESTSUITE_END(testMgm);
int main(int argc, const char** argv){
=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-11-10 12:28:34 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-11-24 12:42:48 +0000
@@ -3104,7 +3104,8 @@ int runBulkPkReads(NDBT_Context* ctx, ND
hugoOps.closeTransaction(otherNdb);
- if ((err.code == 4010) || // Node failure
+ if ((err.code == 4002) || // send failed
+ (err.code == 4010) || // Node failure
(err.code == 4025) || // Node failure
(err.code == 1218)) // Send buffer overload (reading larger tables)
{
=== modified file 'storage/ndb/test/ndbapi/testNodeRestart.cpp'
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp 2010-10-28 12:59:31 +0000
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp 2010-11-24 12:16:55 +0000
@@ -4127,6 +4127,59 @@ runForceStopAndRestart(NDBT_Context* ctx
return NDBT_OK;
}
+int
+runBug58453(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NdbRestarter res;
+ if (res.getNumDbNodes() < 4)
+ return NDBT_OK;
+
+ Ndb* pNdb = GETNDB(step);
+ HugoOperations hugoOps(*ctx->getTab());
+
+ int loops = ctx->getNumLoops();
+ while (loops--)
+ {
+ if (hugoOps.startTransaction(pNdb) != 0)
+ return NDBT_FAILED;
+
+ if (hugoOps.pkInsertRecord(pNdb, 0, 128 /* records */) != 0)
+ return NDBT_FAILED;
+
+ int err = 5062;
+ switch(loops & 1){
+ case 0:
+ err = 5062;
+ break;
+ case 1:
+ err = 5063;
+ break;
+ }
+ int node = (int)hugoOps.getTransaction()->getConnectedNodeId();
+ int node0 = res.getRandomNodeOtherNodeGroup(node, rand());
+ int node1 = res.getRandomNodeSameNodeGroup(node0, rand());
+
+ ndbout_c("node %u err: %u, node: %u err: %u",
+ node0, 5061, node1, err);
+
+ int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+
+ res.dumpStateOneNode(node, val2, 2);
+ res.insertErrorInNode(node0, 5061);
+ res.insertErrorInNode(node1, err);
+
+ hugoOps.execute_Commit(pNdb);
+ hugoOps.closeTransaction(pNdb);
+
+ res.waitNodesNoStart(&node, 1);
+ res.startNodes(&node, 1);
+ res.waitClusterStarted();
+ hugoOps.clearTable(pNdb);
+ }
+
+ return NDBT_OK;
+}
+
NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\
@@ -4609,6 +4662,10 @@ TESTCASE("Bug42422", ""){
TESTCASE("Bug43224", ""){
INITIALIZER(runBug43224);
}
+TESTCASE("Bug58453", "")
+{
+ INITIALIZER(runBug58453);
+}
TESTCASE("Bug43888", ""){
INITIALIZER(runBug43888);
}
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2010-11-02 14:53:26 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2010-11-24 12:16:55 +0000
@@ -1371,6 +1371,10 @@ cmd: testNodeRestart
args: -n Bug36245 T1
max-time: 300
+cmd: testNodeRestart
+args: -n Bug58453 T1
+
+max-time: 300
cmd: test_event
args: -n Bug34853 T1
=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp 2010-10-27 11:32:32 +0000
+++ b/storage/ndb/test/run-test/main.cpp 2010-11-29 15:42:25 +0000
@@ -81,10 +81,6 @@ const char * g_dummy;
char * g_env_path = 0;
const char* g_mysqld_host = 0;
-/** Dummy, extern declared in ndb_opts.h */
-int g_print_full_config = 0;
-my_bool opt_core;
-
static struct my_option g_options[] =
{
{ "help", '?', "Display this help and exit.",
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-5.5-telco-7.0 branch (magnus.blaudd:3128 to 3129) | Magnus Blåudd | 29 Nov |