Commit 6ba27373 authored by unknown's avatar unknown
Browse files

NDB temporary tables.

Temporary tables are not written to disk by DDL operations. This makes
DDL much faster (useful for tests), but tables are lost after system
restart.

New commit, since this feature will not be available in 5.1.


storage/ndb/include/kernel/signaldata/CreateIndx.hpp:
  Add new error messages for temporary tables.
storage/ndb/include/kernel/signaldata/CreateTable.hpp:
  Add new error messages for temporary tables.
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
  Add parameter for making table temporary.
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
  Add parameter for making table temporary.
storage/ndb/include/kernel/signaldata/ListTables.hpp:
  Add parameter for making table temporary.
storage/ndb/include/ndb_constants.h:
  Add parameter for making table temporary.
storage/ndb/include/ndbapi/NdbDictionary.hpp:
  Add parameter for making table temporary.
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
  Add parameter for making table temporary.
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Implement temporary tables.
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Implement temporary tables.
storage/ndb/src/kernel/blocks/dbdict/SchemaFile.hpp:
  Implement temporary tables.
storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
  Implement temporary tables.
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Implement temporary tables.
storage/ndb/src/ndbapi/NdbDictionary.cpp:
  Implement temporary tables.
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Implement temporary tables.
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Implement temporary tables.
storage/ndb/src/ndbapi/ndberror.c:
  Add new error messages for temporary tables.
storage/ndb/tools/listTables.cpp:
  Add display of table and index temporary status.
parent 15ede695
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -208,7 +208,10 @@ public:
    NotUnique = 4251,
    AllocationError = 4252,
    CreateIndexTableFailed = 4253,
    DuplicateAttributes = 4258
    DuplicateAttributes = 4258,
    TableIsTemporary = 776,
    TableIsNotTemporary = 777,
    NoLoggingTemporaryIndex = 778,
  };

  CreateIndxConf m_conf;
+2 −1
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ public:
    VarsizeBitfieldNotSupported = 757,
    NotATablespace = 758,
    InvalidTablespaceVersion = 759,
    OutOfStringBuffer = 773
    OutOfStringBuffer = 773,
    NoLoggingTemporaryTable = 778,
  };

private:
+3 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class DiAddTabReq {
   */
  friend class Dbdih;
public:
  STATIC_CONST( SignalLength = 9 );
  STATIC_CONST( SignalLength = 10 );
  SECTION( FRAGMENTATION = 0 );
  SECTION( TS_RANGE = 0 );
  
@@ -40,10 +40,11 @@ private:
  Uint32 fragType;
  Uint32 kValue;
  Uint32 noOfReplicas; //Currently not used
  Uint32 storedTable;
  Uint32 loggedTable;
  Uint32 tableType;
  Uint32 schemaVersion;
  Uint32 primaryTableId;
  Uint32 temporaryTable;
};

class DiAddTabRef {
+4 −1
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ public:
    FrmLen             = 26,
    FrmData            = 27,

    TableTemporaryFlag = 28,  //Default not Temporary

    FragmentCount      = 128, // No of fragments in table (!fragment replicas)
    FragmentDataLen    = 129,
    FragmentData       = 130, // CREATE_FRAGMENTATION reply
@@ -278,7 +280,7 @@ public:
  // Object store for translating from/to API
  enum ObjectStore {
    StoreUndefined = 0,
    StoreTemporary = 1,
    StoreNotLogged = 1,
    StorePermanent = 2
  };
  
@@ -297,6 +299,7 @@ public:
    char   PrimaryTable[MAX_TAB_NAME_SIZE]; // Only used when "index"
    Uint32 PrimaryTableId;
    Uint32 TableLoggedFlag;
    Uint32 TableTemporaryFlag;
    Uint32 NoOfKeyAttr;
    Uint32 NoOfAttributes;
    Uint32 NoOfNullable;
+14 −2
Original line number Diff line number Diff line
@@ -39,10 +39,16 @@ public:
    BitmaskImpl::setField(1, &data, 12, 8, val);
  }
  static Uint32 getTableStore(Uint32 data) {
    return BitmaskImpl::getField(1, &data, 20, 4);
    return BitmaskImpl::getField(1, &data, 20, 3);
  }
  static void setTableStore(Uint32& data, Uint32 val) {
    BitmaskImpl::setField(1, &data, 20, 4, val);
    BitmaskImpl::setField(1, &data, 20, 3, val);
  }
  static Uint32 getTableTemp(Uint32 data) {
    return BitmaskImpl::getField(1, &data, 23, 1);
  }
  static void setTableTemp(Uint32& data, Uint32 val) {
    BitmaskImpl::setField(1, &data, 23, 1, val);
  }
  static Uint32 getTableState(Uint32 data) {
    return BitmaskImpl::getField(1, &data, 24, 4);
@@ -161,6 +167,12 @@ public:
  void setTableState(unsigned pos, Uint32 val) {
    ListTablesData::setTableState(tableData[pos], val);
  }
  static Uint32 getTableTemp(Uint32 data) {
    return ListTablesData::getTableTemp(data);
  }
  void setTableTemp(unsigned pos, Uint32 val) {
    ListTablesData::setTableTemp(tableData[pos], val);
  }
};

#endif
Loading