Commit 9077fea5 authored by unknown's avatar unknown

bug#10190 - ndb

  ndb_restore invalid handling of distribution keys when restoring meta data
  (also aligned printout with that of ndb_desc)


ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Don't call it a distribution key if all keys are set as distribution key
ndb/tools/Makefile.am:
  Use same format as desc when printing meta in ndb_restore
ndb/tools/restore/Restore.cpp:
  Use same format as desc when printing meta in ndb_restore
parent 4330c39c
...@@ -1649,7 +1649,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -1649,7 +1649,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
abort(); abort();
} }
int distKeys= impl.m_noOfDistributionKeys; int distKeys= impl.m_noOfDistributionKeys &&
impl.m_noOfDistributionKeys < impl.m_noOfKeys;
assert(distKeys == 0 || distKeys == 1);
for(i = 0; i<sz; i++){ for(i = 0; i<sz; i++){
const NdbColumnImpl * col = impl.m_columns[i]; const NdbColumnImpl * col = impl.m_columns[i];
if(col == 0) if(col == 0)
...@@ -1661,7 +1665,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -1661,7 +1665,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpAttr.AttributeId = i; tmpAttr.AttributeId = i;
tmpAttr.AttributeKeyFlag = col->m_pk; tmpAttr.AttributeKeyFlag = col->m_pk;
tmpAttr.AttributeNullableFlag = col->m_nullable; tmpAttr.AttributeNullableFlag = col->m_nullable;
tmpAttr.AttributeDKey = col->m_distributionKey; tmpAttr.AttributeDKey = distKeys * col->m_distributionKey;
tmpAttr.AttributeExtType = (Uint32)col->m_type; tmpAttr.AttributeExtType = (Uint32)col->m_type;
tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF); tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF);
......
...@@ -30,7 +30,8 @@ ndb_restore_SOURCES = restore/restore_main.cpp \ ...@@ -30,7 +30,8 @@ ndb_restore_SOURCES = restore/restore_main.cpp \
restore/consumer.cpp \ restore/consumer.cpp \
restore/consumer_restore.cpp \ restore/consumer_restore.cpp \
restore/consumer_printer.cpp \ restore/consumer_printer.cpp \
restore/Restore.cpp restore/Restore.cpp \
../test/src/NDBT_ResultRow.cpp $(tools_common_sources)
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am
......
...@@ -925,19 +925,12 @@ operator<<(NdbOut& ndbout, const LogEntry& logE) ...@@ -925,19 +925,12 @@ operator<<(NdbOut& ndbout, const LogEntry& logE)
return ndbout; return ndbout;
} }
#include <NDBT.hpp>
NdbOut & NdbOut &
operator<<(NdbOut& ndbout, const TableS & table){ operator<<(NdbOut& ndbout, const TableS & table){
ndbout << endl << "Table: " << table.getTableName() << endl;
for (int j = 0; j < table.getNoOfAttributes(); j++) ndbout << (* (NDBT_Table*)table.m_dictTable) << endl;
{
const AttributeDesc * desc = table[j];
ndbout << desc->m_column->getName() << ": "
<< (Uint32) desc->m_column->getType();
ndbout << " key: " << (Uint32) desc->m_column->getPrimaryKey();
ndbout << " array: " << desc->arraySize;
ndbout << " size: " << desc->size << endl;
} // for
return ndbout; return ndbout;
} }
......
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