summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ndb_index_unique.result15
-rw-r--r--mysql-test/t/ndb_index_unique.test8
-rw-r--r--ndb/src/common/util/File.cpp18
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.cpp14
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp12
5 files changed, 58 insertions, 9 deletions
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index f9fb6f89aa2..3bc41e8a197 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -133,6 +133,21 @@ a b c
6 7 2
7 8 3
8 2 3
+create unique index bi using hash on t2(b);
+insert into t2 values(9, 3, 1);
+ERROR 23000: Duplicate entry '' for key 0
+alter table t2 drop index bi;
+insert into t2 values(9, 3, 1);
+select * from t2 order by a;
+a b c
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+7 8 3
+8 2 3
+9 3 1
drop table t2;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index 458f6a165f8..2bf4a763313 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -83,6 +83,14 @@ delete from t2 where a = 1;
insert into t2 values(8, 2, 3);
select * from t2 order by a;
+# Bug #24818 CREATE UNIQUE INDEX (...) USING HASH on a NDB table crashes mysqld
+create unique index bi using hash on t2(b);
+-- error 1062
+insert into t2 values(9, 3, 1);
+alter table t2 drop index bi;
+insert into t2 values(9, 3, 1);
+select * from t2 order by a;
+
drop table t2;
-- error 1121
diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp
index 12626f29e7d..00741d3a576 100644
--- a/ndb/src/common/util/File.cpp
+++ b/ndb/src/common/util/File.cpp
@@ -123,13 +123,25 @@ bool
File_class::close()
{
bool rc = true;
+ int retval = 0;
+
if (m_file != NULL)
{
::fflush(m_file);
- rc = (::fclose(m_file) == 0 ? true : false);
- m_file = NULL; // Try again?
+ retval = ::fclose(m_file);
+ while ( (retval != 0) && (errno == EINTR) ){
+ retval = ::fclose(m_file);
+ }
+ if( retval == 0){
+ rc = true;
+ }
+ else {
+ rc = false;
+ ndbout_c("ERROR: Close file error in File.cpp for %s",strerror(errno));
+ }
}
-
+ m_file = NULL;
+
return rc;
}
diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp
index 9b52ac65331..d5ba3ac63c1 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.cpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.cpp
@@ -658,24 +658,26 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
void * p = NULL;
size_t size = n*s;
+ Uint64 real_size = (Uint64)((Uint64)n)*((Uint64)s);
refresh_watch_dog();
- if (size > 0){
+ if (real_size > 0){
#ifdef VM_TRACE_MEM
- ndbout_c("%s::allocRecord(%s, %u, %u) = %u bytes",
+ ndbout_c("%s::allocRecord(%s, %u, %u) = %llu bytes",
getBlockName(number()),
type,
s,
n,
- size);
+ real_size);
#endif
- p = NdbMem_Allocate(size);
+ if( real_size == (Uint64)size )
+ p = NdbMem_Allocate(size);
if (p == NULL){
char buf1[255];
char buf2[255];
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
- BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
- (Uint32)s, (Uint32)n, (Uint32)size);
+ BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %llu bytes",
+ (Uint32)s, (Uint32)n, (Uint64)real_size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
}
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index 65d5b038707..ea5dc218898 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -1627,6 +1627,18 @@ CommandInterpreter::executeStatus(int processId,
ndbout << processId << ": Node not found" << endl;
return -1;
}
+ if (cl->node_states[i].node_type != NDB_MGM_NODE_TYPE_NDB){
+ if (cl->node_states[i].version != 0){
+ ndbout << "Node "<< cl->node_states[i].node_id <<": connected" ;
+ ndbout_c(" (Version %d.%d.%d)",
+ getMajor(version) ,
+ getMinor(version),
+ getBuild(version));
+
+ }else
+ ndbout << "Node "<< cl->node_states[i].node_id <<": not connected" << endl;
+ return 0;
+ }
status = cl->node_states[i].node_status;
startPhase = cl->node_states[i].start_phase;
version = cl->node_states[i].version;