Commit 7a7ac8f6 authored by unknown's avatar unknown

wl2240 - ndb - scan only 1 fragment if possible


ndb/src/common/debugger/signaldata/ScanTab.cpp:
  Fix printout
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Set distribution key for ordered indexes
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Allow create_index_object to modify index_table
ndb/tools/restore/consumer_restore.cpp:
  Allow create_index_object to modify index_table
parent 09206a94
...@@ -41,7 +41,7 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv ...@@ -41,7 +41,7 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
sig->getDistributionKeyFlag(requestInfo)); sig->getDistributionKeyFlag(requestInfo));
if(sig->getDistributionKeyFlag(requestInfo)) if(sig->getDistributionKeyFlag(requestInfo))
fprintf(output, " DKey: %u", sig->distributionKey); fprintf(output, " DKey: %x", sig->distributionKey);
Uint32 keyLen = (sig->attrLenKeyLen >> 16); Uint32 keyLen = (sig->attrLenKeyLen >> 16);
Uint32 attrLen = (sig->attrLenKeyLen & 0xFFFF); Uint32 attrLen = (sig->attrLenKeyLen & 0xFFFF);
......
...@@ -1930,7 +1930,7 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName, ...@@ -1930,7 +1930,7 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName,
int int
NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst, NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst,
const NdbTableImpl* tab, NdbTableImpl* tab,
const NdbTableImpl* prim){ const NdbTableImpl* prim){
NdbIndexImpl *idx = new NdbIndexImpl(); NdbIndexImpl *idx = new NdbIndexImpl();
idx->m_version = tab->m_version; idx->m_version = tab->m_version;
...@@ -1938,23 +1938,43 @@ NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst, ...@@ -1938,23 +1938,43 @@ NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst,
idx->m_indexId = tab->m_tableId; idx->m_indexId = tab->m_tableId;
idx->m_externalName.assign(tab->getName()); idx->m_externalName.assign(tab->getName());
idx->m_tableName.assign(prim->m_externalName); idx->m_tableName.assign(prim->m_externalName);
idx->m_type = tab->m_indexType; NdbDictionary::Index::Type type = idx->m_type = tab->m_indexType;
idx->m_logging = tab->m_logging; idx->m_logging = tab->m_logging;
// skip last attribute (NDB$PK or NDB$TNODE) // skip last attribute (NDB$PK or NDB$TNODE)
Uint32 distKeys = 0;
for(unsigned i = 0; i+1<tab->m_columns.size(); i++){ for(unsigned i = 0; i+1<tab->m_columns.size(); i++){
NdbColumnImpl* org = tab->m_columns[i];
NdbColumnImpl* col = new NdbColumnImpl; NdbColumnImpl* col = new NdbColumnImpl;
// Copy column definition // Copy column definition
*col = *tab->m_columns[i]; *col = * org;
idx->m_columns.push_back(col); idx->m_columns.push_back(col);
/** /**
* reverse map * reverse map
*/ */
int key_id = prim->getColumn(col->getName())->getColumnNo(); const NdbColumnImpl* primCol = prim->getColumn(col->getName());
int key_id = primCol->getColumnNo();
int fill = -1; int fill = -1;
idx->m_key_ids.fill(key_id, fill); idx->m_key_ids.fill(key_id, fill);
idx->m_key_ids[key_id] = i; idx->m_key_ids[key_id] = i;
col->m_keyInfoPos = key_id; col->m_keyInfoPos = key_id;
/**
* Fix distribution key stuff for ordered indexes
*/
if(type == NdbDictionary::Index::OrderedIndex)
{
if(primCol->m_distributionKey ||
(prim->m_noOfDistributionKeys == 0 && primCol->getPrimaryKey()))
{
distKeys++;
org->m_distributionKey = 1;
}
}
} }
tab->m_noOfDistributionKeys = distKeys;
* dst = idx; * dst = idx;
return 0; return 0;
......
...@@ -303,8 +303,8 @@ public: ...@@ -303,8 +303,8 @@ public:
bool fullyQualifiedNames); bool fullyQualifiedNames);
static int create_index_obj_from_table(NdbIndexImpl ** dst, static int create_index_obj_from_table(NdbIndexImpl ** dst,
const NdbTableImpl*, NdbTableImpl* index_table,
const NdbTableImpl*); const NdbTableImpl* primary_table);
NdbError & m_error; NdbError & m_error;
private: private:
......
...@@ -209,7 +209,7 @@ BackupRestore::endOfTables(){ ...@@ -209,7 +209,7 @@ BackupRestore::endOfTables(){
NdbDictionary::Dictionary* dict = m_ndb->getDictionary(); NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
for(size_t i = 0; i<m_indexes.size(); i++){ for(size_t i = 0; i<m_indexes.size(); i++){
const NdbTableImpl & indtab = NdbTableImpl::getImpl(* m_indexes[i]); NdbTableImpl & indtab = NdbTableImpl::getImpl(* m_indexes[i]);
BaseString tmp(indtab.m_primaryTable.c_str()); BaseString tmp(indtab.m_primaryTable.c_str());
Vector<BaseString> split; Vector<BaseString> split;
......
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