Commit 043a16e3 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new-ndb_improved_on-line_discover

into  mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new
parents df4a6323 ae586462
...@@ -3,10 +3,19 @@ create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) ) ...@@ -3,10 +3,19 @@ create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
engine=ndb; engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
create index c on t1(c); create index c on t1(c);
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE
t1 1 c 1 c A 3 NULL NULL YES BTREE
select * from t1 where c = 'two'; select * from t1 where c = 'two';
a b c a b c
2 two two 2 two two
alter table t1 drop index c; alter table t1 drop index c;
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE
select * from t1 where c = 'two'; select * from t1 where c = 'two';
a b c a b c
2 two two 2 two two
......
...@@ -13,10 +13,12 @@ engine=ndb; ...@@ -13,10 +13,12 @@ engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
create index c on t1(c); create index c on t1(c);
connection server2; connection server2;
show indexes from t1;
select * from t1 where c = 'two'; select * from t1 where c = 'two';
connection server1; connection server1;
alter table t1 drop index c; alter table t1 drop index c;
connection server2; connection server2;
show indexes from t1;
select * from t1 where c = 'two'; select * from t1 where c = 'two';
connection server1; connection server1;
drop table t1; drop table t1;
......
...@@ -992,8 +992,8 @@ bool ha_ndbcluster::uses_blob_value() ...@@ -992,8 +992,8 @@ bool ha_ndbcluster::uses_blob_value()
-2 Meta data has changed; Re-read data and try again -2 Meta data has changed; Re-read data and try again
*/ */
static int cmp_frm(const NDBTAB *ndbtab, const void *pack_data, int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length) uint pack_length)
{ {
DBUG_ENTER("cmp_frm"); DBUG_ENTER("cmp_frm");
/* /*
......
This diff is collapsed.
...@@ -123,6 +123,8 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print, ...@@ -123,6 +123,8 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print,
prototypes for ndb handler utility function also needed by prototypes for ndb handler utility function also needed by
the ndb binlog code the ndb binlog code
*/ */
int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length);
int ndbcluster_find_all_files(THD *thd); int ndbcluster_find_all_files(THD *thd);
#endif /* HAVE_NDB_BINLOG */ #endif /* HAVE_NDB_BINLOG */
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#define MAX_FRAGMENT_DATA_BYTES (4+(2 * 8 * MAX_REPLICAS * MAX_NDB_NODES)) #define MAX_FRAGMENT_DATA_BYTES (4+(2 * 8 * MAX_REPLICAS * MAX_NDB_NODES))
#define MAX_NDB_PARTITIONS 1024 #define MAX_NDB_PARTITIONS 1024
#define MAX_RANGE_DATA (131072+MAX_NDB_PARTITIONS) //0.5 MByte of list data #define MAX_RANGE_DATA (131072+MAX_NDB_PARTITIONS) //0.5 MByte of list data
#define MAX_WORDS_META_FILE 16382
#define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1) #define MIN_ATTRBUF ((MAX_ATTRIBUTES_IN_TABLE/24) + 1)
/* /*
......
...@@ -39,6 +39,7 @@ class AlterTableReq { ...@@ -39,6 +39,7 @@ class AlterTableReq {
friend class NdbEventOperationImpl; friend class NdbEventOperationImpl;
friend class NdbDictInterface; friend class NdbDictInterface;
friend class Dbdict; friend class Dbdict;
friend class Suma;
/** /**
* For printing * For printing
......
...@@ -1598,6 +1598,14 @@ public: ...@@ -1598,6 +1598,14 @@ public:
*/ */
const Table * getTable(const char * name) const; const Table * getTable(const char * name) const;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/*
* Save a table definition in dictionary cache
* @param table Object to put into cache
*/
void putTable(const Table * table);
#endif
/** /**
* Get index with given name, NULL if undefined * Get index with given name, NULL if undefined
* @param indexName Name of index to get. * @param indexName Name of index to get.
......
...@@ -220,6 +220,7 @@ public: ...@@ -220,6 +220,7 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** these are subject to change at any time */ /** these are subject to change at any time */
const NdbDictionary::Table* getTable() const;
const NdbDictionary::Event *getEvent() const; const NdbDictionary::Event *getEvent() const;
const NdbRecAttr *getFirstPkAttr() const; const NdbRecAttr *getFirstPkAttr() const;
const NdbRecAttr *getFirstPkPreAttr() const; const NdbRecAttr *getFirstPkPreAttr() const;
......
...@@ -530,7 +530,7 @@ public: ...@@ -530,7 +530,7 @@ public:
Config c_defaults; Config c_defaults;
Uint32 m_diskless; Uint32 m_diskless;
STATIC_CONST(NO_OF_PAGES_META_FILE = 2); STATIC_CONST(NO_OF_PAGES_META_FILE = MAX_WORDS_META_FILE/BACKUP_WORDS_PER_PAGE);
/** /**
* Pools * Pools
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <signaldata/GCPSave.hpp> #include <signaldata/GCPSave.hpp>
#include <signaldata/CreateTab.hpp> #include <signaldata/CreateTab.hpp>
#include <signaldata/DropTab.hpp> #include <signaldata/DropTab.hpp>
#include <signaldata/AlterTable.hpp>
#include <signaldata/AlterTab.hpp> #include <signaldata/AlterTab.hpp>
#include <signaldata/DihFragCount.hpp> #include <signaldata/DihFragCount.hpp>
#include <signaldata/SystemError.hpp> #include <signaldata/SystemError.hpp>
...@@ -3440,7 +3441,7 @@ Suma::execDROP_TAB_CONF(Signal *signal) ...@@ -3440,7 +3441,7 @@ Suma::execDROP_TAB_CONF(Signal *signal)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static Uint32 b_dti_buf[10000]; static Uint32 b_dti_buf[MAX_WORDS_META_FILE];
void void
Suma::execALTER_TAB_REQ(Signal *signal) Suma::execALTER_TAB_REQ(Signal *signal)
...@@ -3462,7 +3463,7 @@ Suma::execALTER_TAB_REQ(Signal *signal) ...@@ -3462,7 +3463,7 @@ Suma::execALTER_TAB_REQ(Signal *signal)
} }
DBUG_PRINT("info",("alter table id: %d[i=%u]", tableId, tabPtr.i)); DBUG_PRINT("info",("alter table id: %d[i=%u]", tableId, tabPtr.i));
Table::State old_state = tabPtr.p->m_state;
tabPtr.p->m_state = Table::ALTERED; tabPtr.p->m_state = Table::ALTERED;
// triggers must be removed, waiting for sub stop req for that // triggers must be removed, waiting for sub stop req for that
...@@ -3520,6 +3521,11 @@ Suma::execALTER_TAB_REQ(Signal *signal) ...@@ -3520,6 +3521,11 @@ Suma::execALTER_TAB_REQ(Signal *signal)
DBUG_PRINT("info",("sent to subscriber %d", subbPtr.i)); DBUG_PRINT("info",("sent to subscriber %d", subbPtr.i));
} }
} }
if (AlterTableReq::getFrmFlag(changeMask))
{
// Frm changes only are handled on-line
tabPtr.p->m_state = old_state;
}
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -1349,6 +1349,13 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data) const ...@@ -1349,6 +1349,13 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data) const
return 0; return 0;
} }
void NdbDictionary::Dictionary::putTable(const NdbDictionary::Table * table)
{
NdbDictionary::Table *copy_table = new NdbDictionary::Table;
*copy_table = *table;
m_impl.putTable(&NdbTableImpl::getImpl(*copy_table));
}
void NdbDictionary::Dictionary::set_local_table_data_size(unsigned sz) void NdbDictionary::Dictionary::set_local_table_data_size(unsigned sz)
{ {
m_impl.m_local_table_data_size= sz; m_impl.m_local_table_data_size= sz;
......
...@@ -1305,7 +1305,14 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const BaseString& internalTableName) ...@@ -1305,7 +1305,14 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const BaseString& internalTableName)
void void
NdbDictionaryImpl::putTable(NdbTableImpl *impl) NdbDictionaryImpl::putTable(NdbTableImpl *impl)
{ {
NdbTableImpl *old;
m_globalHash->lock(); m_globalHash->lock();
if ((old= m_globalHash->get(impl->m_internalName.c_str())))
{
old->m_status = NdbDictionary::Object::Invalid;
m_globalHash->drop(old);
}
m_globalHash->put(impl->m_internalName.c_str(), impl); m_globalHash->put(impl->m_internalName.c_str(), impl);
m_globalHash->unlock(); m_globalHash->unlock();
Ndb_local_table_info *info= Ndb_local_table_info *info=
...@@ -1313,6 +1320,8 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl) ...@@ -1313,6 +1320,8 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl)
m_localHash.put(impl->m_internalName.c_str(), info); m_localHash.put(impl->m_internalName.c_str(), info);
addBlobTables(*impl);
m_ndb.theFirstTupleId[impl->getTableId()] = ~0; m_ndb.theFirstTupleId[impl->getTableId()] = ~0;
m_ndb.theLastTupleId[impl->getTableId()] = ~0; m_ndb.theLastTupleId[impl->getTableId()] = ~0;
} }
......
...@@ -144,6 +144,10 @@ NdbEventOperation::print() ...@@ -144,6 +144,10 @@ NdbEventOperation::print()
/* /*
* Internal for the mysql server * Internal for the mysql server
*/ */
const NdbDictionary::Table *NdbEventOperation::getTable() const
{
return m_impl.m_eventImpl->m_tableImpl->m_facade;
}
const NdbDictionary::Event *NdbEventOperation::getEvent() const const NdbDictionary::Event *NdbEventOperation::getEvent() const
{ {
return m_impl.m_eventImpl->m_facade; return m_impl.m_eventImpl->m_facade;
......
...@@ -645,6 +645,14 @@ NdbEventOperationImpl::receive_event() ...@@ -645,6 +645,14 @@ NdbEventOperationImpl::receive_event()
m_buffer.length() / 4, m_buffer.length() / 4,
true); true);
m_buffer.clear(); m_buffer.clear();
if (at)
at->buildColumnHash();
else
{
DBUG_PRINT_EVENT("info", ("Failed to parse DictTabInfo error %u",
error.code));
DBUG_RETURN_EVENT(1);
}
if ( m_eventImpl->m_tableImpl) if ( m_eventImpl->m_tableImpl)
delete m_eventImpl->m_tableImpl; delete m_eventImpl->m_tableImpl;
m_eventImpl->m_tableImpl = at; m_eventImpl->m_tableImpl = at;
......
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