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
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 attrLen = (sig->attrLenKeyLen & 0xFFFF);
......
......@@ -1930,7 +1930,7 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName,
int
NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst,
const NdbTableImpl* tab,
NdbTableImpl* tab,
const NdbTableImpl* prim){
NdbIndexImpl *idx = new NdbIndexImpl();
idx->m_version = tab->m_version;
......@@ -1938,23 +1938,43 @@ NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst,
idx->m_indexId = tab->m_tableId;
idx->m_externalName.assign(tab->getName());
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;
// skip last attribute (NDB$PK or NDB$TNODE)
Uint32 distKeys = 0;
for(unsigned i = 0; i+1<tab->m_columns.size(); i++){
NdbColumnImpl* org = tab->m_columns[i];
NdbColumnImpl* col = new NdbColumnImpl;
// Copy column definition
*col = *tab->m_columns[i];
*col = * org;
idx->m_columns.push_back(col);
/**
* 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;
idx->m_key_ids.fill(key_id, fill);
idx->m_key_ids[key_id] = i;
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;
return 0;
......
......@@ -303,8 +303,8 @@ public:
bool fullyQualifiedNames);
static int create_index_obj_from_table(NdbIndexImpl ** dst,
const NdbTableImpl*,
const NdbTableImpl*);
NdbTableImpl* index_table,
const NdbTableImpl* primary_table);
NdbError & m_error;
private:
......
......@@ -209,7 +209,7 @@ BackupRestore::endOfTables(){
NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
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());
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