Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2200 06/02/28 17:01:47 pekka@stripped +3 -0
ndb - blob tables vs dict cache : patch 1
storage/ndb/src/ndbapi/ndberror.c
1.51 06/02/28 17:00:31 pekka@stripped +3 -1
blob fix 1: cache no tables at create.
previously main table was cached before blob tables were ready.
autoincr fix to avoid caching as side-effect.
also removes some rename fix where createBlobTables had old/new args.
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
1.51 06/02/28 17:00:31 pekka@stripped +2 -1
blob fix 1: cache no tables at create.
previously main table was cached before blob tables were ready.
autoincr fix to avoid caching as side-effect.
also removes some rename fix where createBlobTables had old/new args.
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
1.111 06/02/28 17:00:31 pekka@stripped +73 -57
blob fix 1: cache no tables at create.
previously main table was cached before blob tables were ready.
autoincr fix to avoid caching as side-effect.
also removes some rename fix where createBlobTables had old/new args.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pekka
# Host: orca.ndb.mysql.com
# Root: /space/pekka/ndb/version/my51-dict
--- 1.110/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2006-02-22 15:19:07 +01:00
+++ 1.111/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2006-02-28 17:00:31 +01:00
@@ -2056,59 +2056,94 @@
NdbDictionaryImpl::createTable(NdbTableImpl &t)
{
DBUG_ENTER("NdbDictionaryImpl::createTable");
- // If the a new name has not been set, used the copied name
+
+ // if the new name has not been set, use the copied name
if (t.m_newExternalName.empty())
t.m_newExternalName.assign(t.m_externalName);
+
+ // create table
if (m_receiver.createTable(m_ndb, t) != 0)
- {
+ DBUG_RETURN(-1);
+ Uint32* data = (Uint32*)m_receiver.m_buffer.get_data();
+ t.m_id = data[0];
+ t.m_version = data[1];
+
+ // update table def from DICT - by-pass cache
+ NdbTableImpl* t2 =
+ m_receiver.getTable(t.m_internalName, m_ndb.usingFullyQualifiedNames());
+
+ // check if we got back same table
+ if (t2 == NULL) {
+ DBUG_PRINT("info", ("table %s dropped by another thread",
+ t.m_internalName.c_str()));
+ m_error.code = 283;
DBUG_RETURN(-1);
}
- if (t.m_noOfBlobs == 0)
- {
- DBUG_RETURN(0);
- }
- // update table def from DICT
- Ndb_local_table_info *info=
- get_local_table_info(t.m_internalName,false);
- if (info == NULL) {
- m_error.code= 709;
+ if (t.m_id != t2->m_id || t.m_version != t2->m_version) {
+ DBUG_PRINT("info", ("table %s re-created by another thread",
+ t.m_internalName.c_str()));
+ m_error.code = 283;
+ delete t2;
DBUG_RETURN(-1);
}
- if (createBlobTables(t, *(info->m_table_impl)) != 0) {
+
+ // auto-increment - use "t" because initial value is not in DICT
+ {
+ bool autoIncrement = false;
+ Uint64 initialValue = 0;
+ for (Uint32 i = 0; i < t.m_columns.size(); i++) {
+ const NdbColumnImpl* c = t.m_columns[i];
+ assert(c != NULL);
+ if (c->m_autoIncrement) {
+ if (autoIncrement) {
+ m_error.code = 4335;
+ delete t2;
+ DBUG_RETURN(-1);
+ }
+ autoIncrement = true;
+ initialValue = c->m_autoIncrementInitialValue;
+ }
+ }
+ if (autoIncrement) {
+ // XXX unlikely race condition - t.m_id may no longer be same table
+ if (! m_ndb.setTupleIdInNdb(t.m_id, initialValue, false)) {
+ if (m_ndb.theError.code)
+ m_error.code = m_ndb.theError.code;
+ else
+ m_error.code = 4336;
+ delete t2;
+ DBUG_RETURN(-1);
+ }
+ }
+ }
+
+ // blob tables - use "t2" to get values set by kernel
+ if (t2->m_noOfBlobs != 0 && createBlobTables(*t2) != 0) {
int save_code = m_error.code;
- (void)dropTable(t);
- m_error.code= save_code;
+ (void)dropTable(*t2);
+ m_error.code = save_code;
+ delete t2;
DBUG_RETURN(-1);
}
+
+ // not entered in cache
+ delete t2;
DBUG_RETURN(0);
}
int
-NdbDictionaryImpl::createBlobTables(NdbTableImpl& org, NdbTableImpl &t)
+NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
{
DBUG_ENTER("NdbDictionaryImpl::createBlobTables");
for (unsigned i = 0; i < t.m_columns.size(); i++) {
NdbColumnImpl & c = *t.m_columns[i];
- NdbColumnImpl & oc = *org.m_columns[i];
if (! c.getBlobType() || c.getPartSize() == 0)
continue;
NdbTableImpl bt;
- NdbDictionary::Column::StorageType save = c.getStorageType();
- c.setStorageType(oc.getStorageType());
NdbBlob::getBlobTable(bt, &t, &c);
- c.setStorageType(save);
- if (createTable(bt) != 0)
- {
- DBUG_RETURN(-1);
- }
- // Save BLOB table handle
- Ndb_local_table_info *info=
- get_local_table_info(bt.m_internalName, false);
- if (info == 0)
- {
+ if (createTable(bt) != 0) {
DBUG_RETURN(-1);
}
- c.m_blobTable = info->m_table_impl;
}
DBUG_RETURN(0);
}
@@ -2292,21 +2327,13 @@
sizeof(tmpTab->TableName),
internalName.c_str());
- bool haveAutoIncrement = false;
- Uint64 autoIncrementValue = 0;
Uint32 distKeys= 0;
- for(i = 0; i<sz; i++){
+ for(i = 0; i<sz; i++) {
const NdbColumnImpl * col = impl.m_columns[i];
- if(col == 0)
- continue;
- if (col->m_autoIncrement) {
- if (haveAutoIncrement) {
- m_error.code= 4335;
- NdbMem_Free((void*)tmpTab);
- DBUG_RETURN(-1);
- }
- haveAutoIncrement = true;
- autoIncrementValue = col->m_autoIncrementInitialValue;
+ if (col == NULL) {
+ m_error.code = 4272;
+ NdbMem_Free((void*)tmpTab);
+ DBUG_RETURN(-1);
}
if (col->m_distributionKey)
{
@@ -2570,17 +2597,6 @@
errCodes);
}
- if (!ret && !alter && haveAutoIncrement) {
- if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(),
- autoIncrementValue)) {
- if (ndb.theError.code == 0) {
- m_error.code = 4336;
- ndb.theError = m_error;
- } else
- m_error= ndb.theError;
- ret = -1; // errorcode set in initialize_autoincrement
- }
- }
DBUG_RETURN(ret);
}
@@ -2588,12 +2604,12 @@
NdbDictInterface::execCREATE_TABLE_CONF(NdbApiSignal * signal,
LinearSectionPtr ptr[3])
{
-#if 0
const CreateTableConf* const conf=
CAST_CONSTPTR(CreateTableConf, signal->getDataPtr());
- Uint32 tableId= conf->tableId;
- Uint32 tableVersion= conf->tableVersion;
-#endif
+ m_buffer.grow(4 * 2); // 2 words
+ Uint32* data = (Uint32*)m_buffer.get_data();
+ data[0] = conf->tableId;
+ data[1] = conf->tableVersion;
m_waiter.signal(NO_WAIT);
}
--- 1.50/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2006-02-17 22:28:44 +01:00
+++ 1.51/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2006-02-28 17:00:31 +01:00
@@ -479,6 +479,7 @@
class TransporterFacade * m_transporter;
friend class Ndb;
+ friend class NdbDictionaryImpl;
static void execSignal(void* dictImpl,
class NdbApiSignal* signal,
struct LinearSectionPtr ptr[3]);
@@ -540,7 +541,7 @@
bool setTransporter(class TransporterFacade * tf);
int createTable(NdbTableImpl &t);
- int createBlobTables(NdbTableImpl& org, NdbTableImpl & created);
+ int createBlobTables(NdbTableImpl& t);
int addBlobTables(NdbTableImpl &);
int alterTable(NdbTableImpl &t);
int dropTable(const char * name);
--- 1.50/storage/ndb/src/ndbapi/ndberror.c 2006-01-30 11:09:49 +01:00
+++ 1.51/storage/ndb/src/ndbapi/ndberror.c 2006-02-28 17:00:31 +01:00
@@ -596,7 +596,9 @@
{ 4269, DMEC, IE, "No connection to ndb management server" },
{ 4270, DMEC, IE, "Unknown blob error" },
{ 4335, DMEC, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" },
- { 4271, DMEC, AE, "Invalid index object, not retrieved via getIndex()" }
+ { 4336, DMEC, AE, "Auto-increment value set below current value" },
+ { 4271, DMEC, AE, "Invalid index object, not retrieved via getIndex()" },
+ { 4272, DMEC, AE, "Table definition has undefined column" }
};
static
| Thread |
|---|
| • bk commit into 5.1 tree (pekka:1.2200) | pekka | 28 Feb |