Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1.b5382
This commit is contained in:
commit
e970eab39d
@ -332,7 +332,7 @@ Handler_discover 0
|
|||||||
drop table t6;
|
drop table t6;
|
||||||
show tables;
|
show tables;
|
||||||
Tables_in_test
|
Tables_in_test
|
||||||
create table t1 (a int) engine=ndb;
|
create table t1 (a int,b longblob) engine=ndb;
|
||||||
show tables;
|
show tables;
|
||||||
Tables_in_test
|
Tables_in_test
|
||||||
t1
|
t1
|
||||||
@ -342,10 +342,10 @@ show tables;
|
|||||||
Tables_in_test2
|
Tables_in_test2
|
||||||
select * from t1;
|
select * from t1;
|
||||||
ERROR 42S02: Table 'test2.t1' doesn't exist
|
ERROR 42S02: Table 'test2.t1' doesn't exist
|
||||||
create table t2 (b int) engine=ndb;
|
create table t2 (b int,c longblob) engine=ndb;
|
||||||
use test;
|
use test;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a b
|
||||||
show tables;
|
show tables;
|
||||||
Tables_in_test
|
Tables_in_test
|
||||||
t1
|
t1
|
||||||
|
@ -434,14 +434,14 @@ drop table t6;
|
|||||||
|
|
||||||
show tables;
|
show tables;
|
||||||
|
|
||||||
create table t1 (a int) engine=ndb;
|
create table t1 (a int,b longblob) engine=ndb;
|
||||||
show tables;
|
show tables;
|
||||||
create database test2;
|
create database test2;
|
||||||
use test2;
|
use test2;
|
||||||
show tables;
|
show tables;
|
||||||
--error 1146
|
--error 1146
|
||||||
select * from t1;
|
select * from t1;
|
||||||
create table t2 (b int) engine=ndb;
|
create table t2 (b int,c longblob) engine=ndb;
|
||||||
use test;
|
use test;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
show tables;
|
show tables;
|
||||||
|
@ -770,7 +770,8 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize)
|
|||||||
{
|
{
|
||||||
DEBUG_TRACE("getAutoIncrementValue");
|
DEBUG_TRACE("getAutoIncrementValue");
|
||||||
const char * internalTableName = internalizeTableName(aTableName);
|
const char * internalTableName = internalizeTableName(aTableName);
|
||||||
Ndb_local_table_info *info= theDictionary->get_local_table_info(internalTableName);
|
Ndb_local_table_info *info=
|
||||||
|
theDictionary->get_local_table_info(internalTableName, false);
|
||||||
if (info == 0)
|
if (info == 0)
|
||||||
return ~0;
|
return ~0;
|
||||||
const NdbTableImpl *table= info->m_table_impl;
|
const NdbTableImpl *table= info->m_table_impl;
|
||||||
@ -851,7 +852,8 @@ Ndb::setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase)
|
|||||||
{
|
{
|
||||||
DEBUG_TRACE("setAutoIncrementValue " << val);
|
DEBUG_TRACE("setAutoIncrementValue " << val);
|
||||||
const char * internalTableName= internalizeTableName(aTableName);
|
const char * internalTableName= internalizeTableName(aTableName);
|
||||||
Ndb_local_table_info *info= theDictionary->get_local_table_info(internalTableName);
|
Ndb_local_table_info *info=
|
||||||
|
theDictionary->get_local_table_info(internalTableName, false);
|
||||||
if (info == 0) {
|
if (info == 0) {
|
||||||
theError= theDictionary->getNdbError();
|
theError= theDictionary->getNdbError();
|
||||||
return false;
|
return false;
|
||||||
|
@ -653,7 +653,8 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const char * internalTableName)
|
|||||||
m_globalHash->unlock();
|
m_globalHash->unlock();
|
||||||
|
|
||||||
if (impl == 0){
|
if (impl == 0){
|
||||||
impl = m_receiver.getTable(internalTableName, m_ndb.usingFullyQualifiedNames());
|
impl = m_receiver.getTable(internalTableName,
|
||||||
|
m_ndb.usingFullyQualifiedNames());
|
||||||
m_globalHash->lock();
|
m_globalHash->lock();
|
||||||
m_globalHash->put(internalTableName, impl);
|
m_globalHash->put(internalTableName, impl);
|
||||||
m_globalHash->unlock();
|
m_globalHash->unlock();
|
||||||
@ -663,15 +664,14 @@ NdbDictionaryImpl::fetchGlobalTableImpl(const char * internalTableName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ndb_local_table_info *info= Ndb_local_table_info::create(impl, m_local_table_data_size);
|
Ndb_local_table_info *info=
|
||||||
|
Ndb_local_table_info::create(impl, m_local_table_data_size);
|
||||||
|
|
||||||
m_localHash.put(internalTableName, info);
|
m_localHash.put(internalTableName, info);
|
||||||
|
|
||||||
m_ndb.theFirstTupleId[impl->getTableId()] = ~0;
|
m_ndb.theFirstTupleId[impl->getTableId()] = ~0;
|
||||||
m_ndb.theLastTupleId[impl->getTableId()] = ~0;
|
m_ndb.theLastTupleId[impl->getTableId()] = ~0;
|
||||||
|
|
||||||
addBlobTables(*impl);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1333,12 +1333,13 @@ NdbDictionaryImpl::createTable(NdbTableImpl &t)
|
|||||||
if (t.m_noOfBlobs == 0)
|
if (t.m_noOfBlobs == 0)
|
||||||
return 0;
|
return 0;
|
||||||
// update table def from DICT
|
// update table def from DICT
|
||||||
NdbTableImpl * tp = getTable(t.m_externalName.c_str());
|
Ndb_local_table_info *info=
|
||||||
if (tp == NULL) {
|
get_local_table_info(t.m_internalName.c_str(),false);
|
||||||
|
if (info == NULL) {
|
||||||
m_error.code = 709;
|
m_error.code = 709;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (createBlobTables(* tp) != 0) {
|
if (createBlobTables(*(info->m_table_impl)) != 0) {
|
||||||
int save_code = m_error.code;
|
int save_code = m_error.code;
|
||||||
(void)dropTable(t);
|
(void)dropTable(t);
|
||||||
m_error.code = save_code;
|
m_error.code = save_code;
|
||||||
@ -1359,8 +1360,12 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
|
|||||||
if (createTable(bt) != 0)
|
if (createTable(bt) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
// Save BLOB table handle
|
// Save BLOB table handle
|
||||||
NdbTableImpl * cachedBlobTable = getTable(bt.m_externalName.c_str());
|
Ndb_local_table_info *info=
|
||||||
c.m_blobTable = cachedBlobTable;
|
get_local_table_info(bt.m_internalName.c_str(),false);
|
||||||
|
if (info == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
c.m_blobTable = info->m_table_impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1369,14 +1374,22 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
|
|||||||
int
|
int
|
||||||
NdbDictionaryImpl::addBlobTables(NdbTableImpl &t)
|
NdbDictionaryImpl::addBlobTables(NdbTableImpl &t)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < t.m_columns.size(); i++) {
|
unsigned n= t.m_noOfBlobs;
|
||||||
|
// optimized for blob column being the last one
|
||||||
|
// and not looking for more than one if not neccessary
|
||||||
|
for (unsigned i = t.m_columns.size(); i > 0 && n > 0;) {
|
||||||
|
i--;
|
||||||
NdbColumnImpl & c = *t.m_columns[i];
|
NdbColumnImpl & c = *t.m_columns[i];
|
||||||
if (! c.getBlobType() || c.getPartSize() == 0)
|
if (! c.getBlobType() || c.getPartSize() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
n--;
|
||||||
char btname[NdbBlob::BlobTableNameSize];
|
char btname[NdbBlob::BlobTableNameSize];
|
||||||
NdbBlob::getBlobTableName(btname, &t, &c);
|
NdbBlob::getBlobTableName(btname, &t, &c);
|
||||||
// Save BLOB table handle
|
// Save BLOB table handle
|
||||||
NdbTableImpl * cachedBlobTable = getTable(btname);;
|
NdbTableImpl * cachedBlobTable = getTable(btname);
|
||||||
|
if (cachedBlobTable == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
c.m_blobTable = cachedBlobTable;
|
c.m_blobTable = cachedBlobTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1587,7 +1600,8 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
|
|||||||
: createTable(&tSignal, ptr);
|
: createTable(&tSignal, ptr);
|
||||||
|
|
||||||
if (!alter && haveAutoIncrement) {
|
if (!alter && haveAutoIncrement) {
|
||||||
if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(), autoIncrementValue)) {
|
if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(),
|
||||||
|
autoIncrementValue)) {
|
||||||
if (ndb.theError.code == 0) {
|
if (ndb.theError.code == 0) {
|
||||||
m_error.code = 4336;
|
m_error.code = 4336;
|
||||||
ndb.theError = m_error;
|
ndb.theError = m_error;
|
||||||
@ -1607,7 +1621,6 @@ NdbDictInterface::createTable(NdbApiSignal* signal, LinearSectionPtr ptr[3])
|
|||||||
SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz);
|
SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz);
|
||||||
r.printAll(ndbout);
|
r.printAll(ndbout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int noErrCodes = 2;
|
const int noErrCodes = 2;
|
||||||
int errCodes[noErrCodes] =
|
int errCodes[noErrCodes] =
|
||||||
{CreateTableRef::Busy,
|
{CreateTableRef::Busy,
|
||||||
@ -1625,7 +1638,10 @@ void
|
|||||||
NdbDictInterface::execCREATE_TABLE_CONF(NdbApiSignal * signal,
|
NdbDictInterface::execCREATE_TABLE_CONF(NdbApiSignal * signal,
|
||||||
LinearSectionPtr ptr[3])
|
LinearSectionPtr ptr[3])
|
||||||
{
|
{
|
||||||
//CreateTableConf* const conf = CAST_PTR(CreateTableConf, signal->getDataPtr());
|
const CreateTableConf* const conf=
|
||||||
|
CAST_CONSTPTR(CreateTableConf, signal->getDataPtr());
|
||||||
|
Uint32 tableId= conf->tableId;
|
||||||
|
Uint32 tableVersion= conf->tableVersion;
|
||||||
|
|
||||||
m_waiter.signal(NO_WAIT);
|
m_waiter.signal(NO_WAIT);
|
||||||
}
|
}
|
||||||
@ -1634,7 +1650,8 @@ void
|
|||||||
NdbDictInterface::execCREATE_TABLE_REF(NdbApiSignal * signal,
|
NdbDictInterface::execCREATE_TABLE_REF(NdbApiSignal * signal,
|
||||||
LinearSectionPtr ptr[3])
|
LinearSectionPtr ptr[3])
|
||||||
{
|
{
|
||||||
const CreateTableRef* const ref = CAST_CONSTPTR(CreateTableRef, signal->getDataPtr());
|
const CreateTableRef* const ref=
|
||||||
|
CAST_CONSTPTR(CreateTableRef, signal->getDataPtr());
|
||||||
m_error.code = ref->errorCode;
|
m_error.code = ref->errorCode;
|
||||||
m_masterNodeId = ref->masterNodeId;
|
m_masterNodeId = ref->masterNodeId;
|
||||||
m_waiter.signal(NO_WAIT);
|
m_waiter.signal(NO_WAIT);
|
||||||
@ -1648,7 +1665,6 @@ NdbDictInterface::alterTable(NdbApiSignal* signal, LinearSectionPtr ptr[3])
|
|||||||
SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz);
|
SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz);
|
||||||
r.printAll(ndbout);
|
r.printAll(ndbout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int noErrCodes = 2;
|
const int noErrCodes = 2;
|
||||||
int errCodes[noErrCodes] =
|
int errCodes[noErrCodes] =
|
||||||
{AlterTableRef::NotMaster,
|
{AlterTableRef::NotMaster,
|
||||||
@ -1871,7 +1887,8 @@ NdbIndexImpl*
|
|||||||
NdbDictionaryImpl::getIndexImpl(const char * externalName,
|
NdbDictionaryImpl::getIndexImpl(const char * externalName,
|
||||||
const char * internalName)
|
const char * internalName)
|
||||||
{
|
{
|
||||||
Ndb_local_table_info * info = get_local_table_info(internalName);
|
Ndb_local_table_info * info = get_local_table_info(internalName,
|
||||||
|
false);
|
||||||
if(info == 0){
|
if(info == 0){
|
||||||
m_error.code = 4243;
|
m_error.code = 4243;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -393,7 +393,8 @@ public:
|
|||||||
int listIndexes(List& list, Uint32 indexId);
|
int listIndexes(List& list, Uint32 indexId);
|
||||||
|
|
||||||
NdbTableImpl * getTable(const char * tableName, void **data= 0);
|
NdbTableImpl * getTable(const char * tableName, void **data= 0);
|
||||||
Ndb_local_table_info * get_local_table_info(const char * internalName);
|
Ndb_local_table_info * get_local_table_info(const char * internalName,
|
||||||
|
bool do_add_blob_tables);
|
||||||
NdbIndexImpl * getIndex(const char * indexName,
|
NdbIndexImpl * getIndex(const char * indexName,
|
||||||
const char * tableName);
|
const char * tableName);
|
||||||
NdbIndexImpl * getIndexImpl(const char * name, const char * internalName);
|
NdbIndexImpl * getIndexImpl(const char * name, const char * internalName);
|
||||||
@ -613,8 +614,8 @@ inline
|
|||||||
NdbTableImpl *
|
NdbTableImpl *
|
||||||
NdbDictionaryImpl::getTable(const char * tableName, void **data)
|
NdbDictionaryImpl::getTable(const char * tableName, void **data)
|
||||||
{
|
{
|
||||||
const char * internalTableName = m_ndb.internalizeTableName(tableName);
|
Ndb_local_table_info *info=
|
||||||
Ndb_local_table_info *info= get_local_table_info(internalTableName);
|
get_local_table_info(m_ndb.internalizeTableName(tableName), true);
|
||||||
if (info == 0) {
|
if (info == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -626,13 +627,22 @@ NdbDictionaryImpl::getTable(const char * tableName, void **data)
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
Ndb_local_table_info *
|
Ndb_local_table_info *
|
||||||
NdbDictionaryImpl::get_local_table_info(const char * internalTableName)
|
NdbDictionaryImpl::get_local_table_info(const char * internalTableName,
|
||||||
|
bool do_add_blob_tables)
|
||||||
{
|
{
|
||||||
Ndb_local_table_info *info= m_localHash.get(internalTableName);
|
Ndb_local_table_info *info= m_localHash.get(internalTableName);
|
||||||
if (info != 0) {
|
if (info == 0) {
|
||||||
return info; // autoincrement already initialized
|
info= fetchGlobalTableImpl(internalTableName);
|
||||||
|
if (info == 0) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return fetchGlobalTableImpl(internalTableName);
|
}
|
||||||
|
if (do_add_blob_tables &&
|
||||||
|
info->m_table_impl->m_noOfBlobs &&
|
||||||
|
addBlobTables(*(info->m_table_impl))) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return info; // autoincrement already initialized
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -647,10 +657,12 @@ NdbDictionaryImpl::getIndex(const char * indexName,
|
|||||||
if (t != 0)
|
if (t != 0)
|
||||||
internalIndexName = m_ndb.internalizeIndexName(t, indexName);
|
internalIndexName = m_ndb.internalizeIndexName(t, indexName);
|
||||||
} else {
|
} else {
|
||||||
internalIndexName = m_ndb.internalizeTableName(indexName); // Index is also a table
|
internalIndexName =
|
||||||
|
m_ndb.internalizeTableName(indexName); // Index is also a table
|
||||||
}
|
}
|
||||||
if (internalIndexName) {
|
if (internalIndexName) {
|
||||||
Ndb_local_table_info * info = get_local_table_info(internalIndexName);
|
Ndb_local_table_info * info = get_local_table_info(internalIndexName,
|
||||||
|
false);
|
||||||
if (info) {
|
if (info) {
|
||||||
NdbTableImpl * tab = info->m_table_impl;
|
NdbTableImpl * tab = info->m_table_impl;
|
||||||
if (tab->m_index == 0)
|
if (tab->m_index == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user