Commit 18069347 authored by unknown's avatar unknown

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new


sql/ha_ndbcluster.cc:
  Auto merged
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Auto merged
parents 1692707c dc86ad6d
......@@ -3,10 +3,19 @@ create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
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';
a b c
2 two two
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';
a b c
2 two two
......
......@@ -13,10 +13,12 @@ engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
create index c on t1(c);
connection server2;
show indexes from t1;
select * from t1 where c = 'two';
connection server1;
alter table t1 drop index c;
connection server2;
show indexes from t1;
select * from t1 where c = 'two';
connection server1;
drop table t1;
......
......@@ -519,6 +519,7 @@ void ha_ndbcluster::invalidate_dictionary_cache(bool global)
{
NDBINDEX *index = (NDBINDEX *) m_index[i].index;
NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index;
if (!index && !unique_index) continue;
NDB_INDEX_TYPE idx_type= m_index[i].type;
switch (idx_type) {
......@@ -991,8 +992,8 @@ bool ha_ndbcluster::uses_blob_value()
-2 Meta data has changed; Re-read data and try again
*/
static int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length)
int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length)
{
DBUG_ENTER("cmp_frm");
/*
......@@ -1076,7 +1077,7 @@ int ha_ndbcluster::get_metadata(const char *path)
m_table= (void *)tab;
m_table_info= NULL; // Set in external lock
DBUG_RETURN(open_indexes(ndb, table));
DBUG_RETURN(open_indexes(ndb, table, FALSE));
}
static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
......@@ -1249,7 +1250,7 @@ int ha_ndbcluster::add_index_handle(THD *thd, NDBDICT *dict, KEY *key_info,
/*
Associate index handles for each index of a table
*/
int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab)
int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error)
{
uint i;
int error= 0;
......@@ -1263,7 +1264,10 @@ int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab)
for (i= 0; i < tab->s->keys; i++, key_info++, key_name++)
{
if ((error= add_index_handle(thd, dict, key_info, *key_name, i)))
break;
if (ignore_error)
m_index[i].index= m_index[i].unique_index= NULL;
else
break;
}
DBUG_RETURN(error);
......@@ -3739,7 +3743,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
if (!(my_errno= open_indexes(ndb, table)))
if (!(my_errno= open_indexes(ndb, table, FALSE)))
DBUG_RETURN(my_errno);
}
m_table_info= tab_info;
......
......@@ -691,6 +691,10 @@ static void set_tabname(const char *pathname, char *tabname);
private:
friend int ndbcluster_drop_database_impl(const char *path);
friend int ndb_handle_schema_change(THD *thd,
Ndb *ndb, NdbEventOperation *pOp,
NDB_SHARE *share);
int alter_table_name(const char *to);
static int delete_table(ha_ndbcluster *h, Ndb *ndb,
const char *path,
......@@ -708,7 +712,7 @@ private:
int create_indexes(Ndb *ndb, TABLE *tab);
void clear_index(int i);
void clear_indexes();
int open_indexes(Ndb *ndb, TABLE *tab);
int open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error);
void renumber_indexes(Ndb *ndb, TABLE *tab);
int drop_indexes(Ndb *ndb, TABLE *tab);
int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict,
......
This diff is collapsed.
......@@ -123,6 +123,8 @@ ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print,
prototypes for ndb handler utility function also needed by
the ndb binlog code
*/
int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length);
int ndbcluster_find_all_files(THD *thd);
#endif /* HAVE_NDB_BINLOG */
......
......@@ -66,6 +66,7 @@
#define MAX_FRAGMENT_DATA_BYTES (4+(2 * 8 * MAX_REPLICAS * MAX_NDB_NODES))
#define MAX_NDB_PARTITIONS 1024
#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)
/*
......
......@@ -39,6 +39,7 @@ class AlterTableReq {
friend class NdbEventOperationImpl;
friend class NdbDictInterface;
friend class Dbdict;
friend class Suma;
/**
* For printing
......
......@@ -1598,6 +1598,14 @@ public:
*/
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
* @param indexName Name of index to get.
......
......@@ -220,6 +220,7 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** these are subject to change at any time */
const NdbDictionary::Table* getTable() const;
const NdbDictionary::Event *getEvent() const;
const NdbRecAttr *getFirstPkAttr() const;
const NdbRecAttr *getFirstPkPreAttr() const;
......
......@@ -530,7 +530,7 @@ public:
Config c_defaults;
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
......
......@@ -42,6 +42,7 @@
#include <signaldata/GCPSave.hpp>
#include <signaldata/CreateTab.hpp>
#include <signaldata/DropTab.hpp>
#include <signaldata/AlterTable.hpp>
#include <signaldata/AlterTab.hpp>
#include <signaldata/DihFragCount.hpp>
#include <signaldata/SystemError.hpp>
......@@ -3440,7 +3441,7 @@ Suma::execDROP_TAB_CONF(Signal *signal)
DBUG_VOID_RETURN;
}
static Uint32 b_dti_buf[10000];
static Uint32 b_dti_buf[MAX_WORDS_META_FILE];
void
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));
Table::State old_state = tabPtr.p->m_state;
tabPtr.p->m_state = Table::ALTERED;
// triggers must be removed, waiting for sub stop req for that
......@@ -3520,6 +3521,11 @@ Suma::execALTER_TAB_REQ(Signal *signal)
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;
}
......
......@@ -1349,6 +1349,13 @@ NdbDictionary::Dictionary::getTable(const char * name, void **data) const
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)
{
m_impl.m_local_table_data_size= sz;
......
......@@ -1305,7 +1305,14 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const BaseString& internalTableName)
void
NdbDictionaryImpl::putTable(NdbTableImpl *impl)
{
NdbTableImpl *old;
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->unlock();
Ndb_local_table_info *info=
......@@ -1313,6 +1320,8 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl)
m_localHash.put(impl->m_internalName.c_str(), info);
addBlobTables(*impl);
m_ndb.theFirstTupleId[impl->getTableId()] = ~0;
m_ndb.theLastTupleId[impl->getTableId()] = ~0;
}
......
......@@ -144,6 +144,10 @@ NdbEventOperation::print()
/*
* 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
{
return m_impl.m_eventImpl->m_facade;
......
......@@ -643,6 +643,14 @@ NdbEventOperationImpl::receive_event()
m_buffer.length() / 4,
true);
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)
delete m_eventImpl->m_tableImpl;
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