Commit 350232cf authored by unknown's avatar unknown
Browse files

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 e3648650
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1649,7 +1649,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
    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++){
    const NdbColumnImpl * col = impl.m_columns[i];
    if(col == 0)
@@ -1661,7 +1665,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
    tmpAttr.AttributeId = i;
    tmpAttr.AttributeKeyFlag = col->m_pk;
    tmpAttr.AttributeNullableFlag = col->m_nullable;
    tmpAttr.AttributeDKey = col->m_distributionKey;
    tmpAttr.AttributeDKey = distKeys * col->m_distributionKey;

    tmpAttr.AttributeExtType = (Uint32)col->m_type;
    tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF);
+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@ ndb_restore_SOURCES = restore/restore_main.cpp \
                      restore/consumer.cpp \
                      restore/consumer_restore.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/type_ndbapitools.mk.am
+3 −10
Original line number Diff line number Diff line
@@ -925,19 +925,12 @@ operator<<(NdbOut& ndbout, const LogEntry& logE)
  return ndbout;
}

#include <NDBT.hpp>

NdbOut & 
operator<<(NdbOut& ndbout, const TableS & table){
  ndbout << endl << "Table: " << table.getTableName() << endl;
  for (int j = 0; j < table.getNoOfAttributes(); j++) 
  {
    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
  
  ndbout << (* (NDBT_Table*)table.m_dictTable) << endl;
  return ndbout;
}