Commit 253dab84 authored by unknown's avatar unknown

wl2240 - ndb partitioning,

  fix scan take over


ndb/include/kernel/AttributeDescriptor.hpp:
  remove deprecated bits
ndb/include/kernel/signaldata/DictTabInfo.hpp:
  removed deprecated parameters
  moved never implemented to Unimplemented
ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
  removed deprecated parameters
  moved never implemented to Unimplemented
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  removed deprecated parameters
  moved never implemented to Unimplemented
ndb/src/kernel/vm/MetaData.hpp:
  removed deprecated parameters
  moved never implemented to Unimplemented
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  removed deprecated parameters
  moved never implemented to Unimplemented
ndb/src/ndbapi/NdbScanOperation.cpp:
  Do scan take over via distribution key code
parent c798d5be
......@@ -33,7 +33,6 @@ private:
static void setDGroup(Uint32 &, Uint32 dgroup);
static void setDKey(Uint32 &, Uint32 dkey);
static void setPrimaryKey(Uint32 &, Uint32 dkey);
static void setStoredInTup(Uint32 &, Uint32 storedInTup);
static void setDynamic(Uint32 &, Uint32 dynamicInd);
static Uint32 getType(const Uint32 &);
......@@ -44,10 +43,8 @@ private:
static Uint32 getArraySize(const Uint32 &);
static Uint32 getOriginal(const Uint32 &);
static Uint32 getNullable(const Uint32 &);
static Uint32 getDGroup(const Uint32 &);
static Uint32 getDKey(const Uint32 &);
static Uint32 getPrimaryKey(const Uint32 &);
static Uint32 getStoredInTup(const Uint32 &);
static Uint32 getDynamic(const Uint32 &);
};
......@@ -58,18 +55,15 @@ private:
* s = Attribute size - 3 Bits -> Max 7 (Bit 4-6)
* o = Original attribute - 1 Bit 7
* n = Nullable - 1 Bit 8
* ? = Stored in tup - 1 Bit 9
* d = Disk based - 1 Bit 10
* g = Distribution Group Ind- 1 Bit 11
* k = Distribution Key Ind - 1 Bit 12
* r = Distribution group sz - 1 Bit 13
* p = Primary key attribute - 1 Bit 14
* y = Dynamic attribute - 1 Bit 15
* z = Array size - 16 Bits -> Max 65535 (Bit 16-31)
*
* 1111111111222222222233
* 01234567890123456789012345678901
* aattsss n dgkrpyzzzzzzzzzzzzzzzz
* aattsss n d k pyzzzzzzzzzzzzzzzz
*
*/
......@@ -89,11 +83,8 @@ private:
#define AD_ORIGINAL_SHIFT (8)
#define AD_NULLABLE_SHIFT (8)
#define AD_TUP_STORED_SHIFT (9)
#define AD_DISTR_GROUP_SHIFT (11)
#define AD_DISTR_KEY_SHIFT (12)
#define AD_DISTR_GROUP_SZ (13)
#define AD_PRIMARY_KEY (14)
#define AD_DYNAMIC (15)
......@@ -140,13 +131,6 @@ AttributeDescriptor::setOriginal(Uint32 & desc, Uint32 original){
desc |= (original << AD_ORIGINAL_SHIFT);
}
inline
void
AttributeDescriptor::setDGroup(Uint32 & desc, Uint32 dgroup){
ASSERT_BOOL(dgroup, "AttributeDescriptor::setDGroup");
desc |= (dgroup << AD_DISTR_GROUP_SHIFT);
}
inline
void
AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){
......@@ -161,13 +145,6 @@ AttributeDescriptor::setPrimaryKey(Uint32 & desc, Uint32 dkey){
desc |= (dkey << AD_PRIMARY_KEY);
}
inline
void
AttributeDescriptor::setStoredInTup(Uint32 & desc, Uint32 storedInTup){
ASSERT_BOOL(storedInTup, "AttributeDescriptor::setStoredInTup");
desc |= (storedInTup << AD_TUP_STORED_SHIFT);
}
inline
void
AttributeDescriptor::setDynamic(Uint32 & desc, Uint32 dynamic){
......@@ -229,12 +206,6 @@ AttributeDescriptor::getOriginal(const Uint32 & desc){
return (desc >> AD_ORIGINAL_SHIFT) & 1;
}
inline
Uint32
AttributeDescriptor::getDGroup(const Uint32 & desc){
return (desc >> AD_DISTR_GROUP_SHIFT) & 1;
}
inline
Uint32
AttributeDescriptor::getDKey(const Uint32 & desc){
......@@ -253,10 +224,4 @@ AttributeDescriptor::getDynamic(const Uint32 & desc){
return (desc >> AD_DYNAMIC) & 1;
}
inline
Uint32
AttributeDescriptor::getStoredInTup(const Uint32 & desc){
return (desc >> AD_TUP_STORED_SHIFT) & 1;
}
#endif
......@@ -85,10 +85,6 @@ public:
MaxLoadFactor = 11, //Default 80
KeyLength = 12, //Default 1 (No of words in primary key)
FragmentTypeVal = 13, //Default AllNodesSmallTable
TableStorageVal = 14, //Default StorageType::MainMemory
ScanOptimised = 15, //Default updateOptimised
FragmentKeyTypeVal = 16, //Default PrimaryKey
SecondTableId = 17, //Mandatory between DICT's otherwise not allowed
TableTypeVal = 18, //Default TableType::UserTable
PrimaryTable = 19, //Mandatory for index otherwise RNIL
PrimaryTableId = 20, //ditto
......@@ -110,10 +106,7 @@ public:
AttributeKeyFlag = 1006, //Default noKey
AttributeStorage = 1007, //Default MainMemory
AttributeNullableFlag = 1008, //Default NotNullable
AttributeDGroup = 1009, //Default NotDGroup
AttributeDKey = 1010, //Default NotDKey
AttributeStoredInd = 1011, //Default NotStored
AttributeGroup = 1012, //Default 0
AttributeExtType = 1013, //Default 0 (undefined)
AttributeExtPrecision = 1014, //Default 0
AttributeExtScale = 1015, //Default 0
......@@ -127,12 +120,7 @@ public:
// have a default value. Thus the default values are part of the protocol.
// ----------------------------------------------------------------------
// FragmentKeyType constants
enum FragmentKeyType {
PrimaryKey = 0,
DistributionKey = 1,
DistributionGroup = 2
};
// FragmentType constants
enum FragmentType {
......@@ -142,12 +130,6 @@ public:
SingleFragment = 3
};
// TableStorage AND AttributeStorage constants
enum StorageType {
MainMemory = 0,
DiskMemory = 1
};
// TableType constants + objects
enum TableType {
UndefTableType = 0,
......@@ -219,10 +201,6 @@ public:
StorePermanent = 2
};
// ScanOptimised constants
STATIC_CONST( updateOptimised = 0 );
STATIC_CONST( scanOptimised = 1 );
// AttributeType constants
STATIC_CONST( SignedType = 0 );
STATIC_CONST( UnSignedType = 1 );
......@@ -237,23 +215,10 @@ public:
STATIC_CONST( a64Bit = 6 );
STATIC_CONST( a128Bit = 7 );
// AttributeDGroup constants
STATIC_CONST( NotDGroup = 0 );
STATIC_CONST( DGroup = 1 );
// AttributeDKey constants
STATIC_CONST( NotDKey = 0 );
STATIC_CONST( DKey = 1 );
// AttributeStoredInd constants
STATIC_CONST( NotStored = 0 );
STATIC_CONST( Stored = 1 );
// Table data interpretation
struct Table {
char TableName[MAX_TAB_NAME_SIZE];
Uint32 TableId;
Uint32 SecondTableId;
char PrimaryTable[MAX_TAB_NAME_SIZE]; // Only used when "index"
Uint32 PrimaryTableId;
Uint32 TableLoggedFlag;
......@@ -267,8 +232,6 @@ public:
Uint32 KeyLength;
Uint32 FragmentType;
Uint32 TableStorage;
Uint32 ScanOptimised;
Uint32 FragmentKeyType;
Uint32 TableType;
Uint32 TableVersion;
Uint32 IndexState;
......@@ -323,12 +286,8 @@ public:
Uint32 AttributeSize;
Uint32 AttributeArraySize;
Uint32 AttributeKeyFlag;
Uint32 AttributeStorage;
Uint32 AttributeNullableFlag;
Uint32 AttributeDGroup;
Uint32 AttributeDKey;
Uint32 AttributeStoredInd;
Uint32 AttributeGroup;
Uint32 AttributeExtType;
Uint32 AttributeExtPrecision;
Uint32 AttributeExtScale;
......@@ -460,9 +419,7 @@ public:
fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag);
fprintf(out, "AttributeStorage = %d\n", AttributeStorage);
fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag);
fprintf(out, "AttributeDGroup = %d\n", AttributeDGroup);
fprintf(out, "AttributeDKey = %d\n", AttributeDKey);
fprintf(out, "AttributeStoredInd = %d\n", AttributeStoredInd);
fprintf(out, "AttributeGroup = %d\n", AttributeGroup);
fprintf(out, "AttributeAutoIncrement = %d\n", AttributeAutoIncrement);
fprintf(out, "AttributeExtType = %d\n", AttributeExtType);
......@@ -496,6 +453,22 @@ private:
*/
Uint32 tabInfoData[DataLength];
public:
enum Depricated
{
AttributeDGroup = 1009, //Default NotDGroup
AttributeStoredInd = 1011, //Default NotStored
SecondTableId = 17, //Mandatory between DICT's otherwise not allowed
FragmentKeyTypeVal = 16 //Default PrimaryKey
};
enum Unimplemented
{
TableStorageVal = 14, //Default StorageType::MainMemory
ScanOptimised = 15, //Default updateOptimised
AttributeGroup = 1012 //Default 0
};
};
#endif
......@@ -23,7 +23,6 @@ SimpleProperties::SP2StructMapping
DictTabInfo::TableMapping[] = {
DTIMAPS(Table, TableName, TableName, 0, MAX_TAB_NAME_SIZE),
DTIMAP(Table, TableId, TableId),
DTIMAP(Table, SecondTableId, SecondTableId),
DTIMAPS(Table, PrimaryTable, PrimaryTable, 0, MAX_TAB_NAME_SIZE),
DTIMAP(Table, PrimaryTableId, PrimaryTableId),
DTIMAP2(Table, TableLoggedFlag, TableLoggedFlag, 0, 1),
......@@ -32,8 +31,6 @@ DictTabInfo::TableMapping[] = {
DTIMAP2(Table, MaxLoadFactor, MaxLoadFactor, 25, 110),
DTIMAP2(Table, FragmentTypeVal, FragmentType, 0, 3),
DTIMAP2(Table, TableStorageVal, TableStorage, 0, 0),
DTIMAP2(Table, ScanOptimised, ScanOptimised, 0, 0),
DTIMAP2(Table, FragmentKeyTypeVal, FragmentKeyType, 0, 2),
DTIMAP2(Table, TableTypeVal, TableType, 1, 3),
DTIMAP(Table, NoOfKeyAttr, NoOfKeyAttr),
DTIMAP2(Table, NoOfAttributes, NoOfAttributes, 1, MAX_ATTRIBUTES_IN_TABLE),
......@@ -66,12 +63,8 @@ DictTabInfo::AttributeMapping[] = {
DTIMAP2(Attribute, AttributeSize, AttributeSize, 3, 7),
DTIMAP2(Attribute, AttributeArraySize, AttributeArraySize, 0, 65535),
DTIMAP2(Attribute, AttributeKeyFlag, AttributeKeyFlag, 0, 1),
DTIMAP2(Attribute, AttributeStorage, AttributeStorage, 0, 0),
DTIMAP2(Attribute, AttributeNullableFlag, AttributeNullableFlag, 0, 1),
DTIMAP2(Attribute, AttributeDGroup, AttributeDGroup, 0, 1),
DTIMAP2(Attribute, AttributeDKey, AttributeDKey, 0, 1),
DTIMAP2(Attribute, AttributeStoredInd, AttributeStoredInd, 0, 1),
DTIMAP2(Attribute, AttributeGroup, AttributeGroup, 0, 0),
DTIMAP(Attribute, AttributeExtType, AttributeExtType),
DTIMAP(Attribute, AttributeExtPrecision, AttributeExtPrecision),
DTIMAP(Attribute, AttributeExtScale, AttributeExtScale),
......@@ -104,7 +97,6 @@ void
DictTabInfo::Table::init(){
memset(TableName, 0, sizeof(TableName));//TableName[0] = 0;
TableId = ~0;
SecondTableId = ~0;
memset(PrimaryTable, 0, sizeof(PrimaryTable));//PrimaryTable[0] = 0; // Only used when "index"
PrimaryTableId = RNIL;
TableLoggedFlag = 1;
......@@ -118,8 +110,6 @@ DictTabInfo::Table::init(){
KeyLength = 0;
FragmentType = DictTabInfo::AllNodesSmallTable;
TableStorage = 0;
ScanOptimised = 0;
FragmentKeyType = DictTabInfo::PrimaryKey;
TableType = DictTabInfo::UndefTableType;
TableVersion = 0;
IndexState = ~0;
......@@ -140,12 +130,8 @@ DictTabInfo::Attribute::init(){
AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = 1;
AttributeKeyFlag = 0;
AttributeStorage = 1;
AttributeNullableFlag = 0;
AttributeDGroup = 0;
AttributeDKey = 0;
AttributeStoredInd = 1;
AttributeGroup = 0;
AttributeExtType = 0,
AttributeExtPrecision = 0,
AttributeExtScale = 0,
......
......@@ -256,7 +256,6 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w,
w.add(DictTabInfo::MaxLoadFactor, tablePtr.p->maxLoadFactor);
w.add(DictTabInfo::TableKValue, tablePtr.p->kValue);
w.add(DictTabInfo::FragmentTypeVal, tablePtr.p->fragmentType);
w.add(DictTabInfo::FragmentKeyTypeVal, tablePtr.p->fragmentKeyType);
w.add(DictTabInfo::TableTypeVal, tablePtr.p->tableType);
w.add(DictTabInfo::FragmentCount, tablePtr.p->fragmentCount);
......@@ -289,17 +288,13 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w,
const Uint32 attrSize = AttributeDescriptor::getSize(desc);
const Uint32 arraySize = AttributeDescriptor::getArraySize(desc);
const Uint32 nullable = AttributeDescriptor::getNullable(desc);
const Uint32 DGroup = AttributeDescriptor::getDGroup(desc);
const Uint32 DKey = AttributeDescriptor::getDKey(desc);
const Uint32 attrStoredInd = AttributeDescriptor::getStoredInTup(desc);
w.add(DictTabInfo::AttributeType, attrType);
w.add(DictTabInfo::AttributeSize, attrSize);
w.add(DictTabInfo::AttributeArraySize, arraySize);
w.add(DictTabInfo::AttributeNullableFlag, nullable);
w.add(DictTabInfo::AttributeDGroup, DGroup);
w.add(DictTabInfo::AttributeDKey, DKey);
w.add(DictTabInfo::AttributeStoredInd, attrStoredInd);
w.add(DictTabInfo::AttributeExtType, attrPtr.p->extType);
w.add(DictTabInfo::AttributeExtPrecision, attrPtr.p->extPrecision);
w.add(DictTabInfo::AttributeExtScale, attrPtr.p->extScale);
......@@ -1340,10 +1335,8 @@ void Dbdict::initialiseTableRecord(TableRecordPtr tablePtr)
tablePtr.p->tableVersion = (Uint32)-1;
tablePtr.p->tabState = TableRecord::NOT_DEFINED;
tablePtr.p->tabReturnState = TableRecord::TRS_IDLE;
tablePtr.p->storageType = DictTabInfo::MainMemory;
tablePtr.p->myConnect = RNIL;
tablePtr.p->fragmentType = DictTabInfo::AllNodesSmallTable;
tablePtr.p->fragmentKeyType = DictTabInfo::PrimaryKey;
memset(tablePtr.p->tableName, 0, sizeof(tablePtr.p->tableName));
tablePtr.p->gciTableCreated = 0;
tablePtr.p->noOfAttributes = ZNIL;
......@@ -4698,7 +4691,6 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
tablePtr.p->minLoadFactor = tableDesc.MinLoadFactor;
tablePtr.p->maxLoadFactor = tableDesc.MaxLoadFactor;
tablePtr.p->fragmentType = (DictTabInfo::FragmentType)tableDesc.FragmentType;
tablePtr.p->fragmentKeyType = (DictTabInfo::FragmentKeyType)tableDesc.FragmentKeyType;
tablePtr.p->tableType = (DictTabInfo::TableType)tableDesc.TableType;
tablePtr.p->kValue = tableDesc.TableKValue;
tablePtr.p->fragmentCount = tableDesc.FragmentCount;
......@@ -4854,11 +4846,8 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it,
AttributeDescriptor::setSize(desc, attrDesc.AttributeSize);
AttributeDescriptor::setArray(desc, attrDesc.AttributeArraySize);
AttributeDescriptor::setNullable(desc, attrDesc.AttributeNullableFlag);
AttributeDescriptor::setDGroup(desc, attrDesc.AttributeDGroup);
AttributeDescriptor::setDKey(desc, attrDesc.AttributeDKey);
AttributeDescriptor::setPrimaryKey(desc, attrDesc.AttributeKeyFlag);
AttributeDescriptor::setStoredInTup(desc, attrDesc.AttributeStoredInd);
attrPtr.p->attributeDescriptor = desc;
attrPtr.p->autoIncrement = attrDesc.AttributeAutoIncrement;
strcpy(attrPtr.p->defaultValue, attrDesc.AttributeDefaultValue);
......@@ -6416,7 +6405,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)isNullable);
}
w.add(DictTabInfo::AttributeStoredInd, (Uint32)DictTabInfo::Stored);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, aRec->extType);
w.add(DictTabInfo::AttributeExtPrecision, aRec->extPrecision);
......@@ -6431,7 +6419,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeName, "NDB$PK");
w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false);
w.add(DictTabInfo::AttributeStoredInd, (Uint32)DictTabInfo::Stored);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned);
......@@ -6444,7 +6431,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeName, "NDB$TNODE");
w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)true);
w.add(DictTabInfo::AttributeStoredInd, (Uint32)DictTabInfo::Stored);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned);
......
......@@ -86,15 +86,9 @@ public:
/* Primary table of index otherwise RNIL */
Uint32 primaryTableId;
/* Type of storage (memory/disk, not used) */
DictTabInfo::StorageType storageType;
/* Type of fragmentation (small/medium/large) */
DictTabInfo::FragmentType fragmentType;
/* Key type of fragmentation (pk/dist key/dist group) */
DictTabInfo::FragmentKeyType fragmentKeyType;
/* Global checkpoint identity when table created */
Uint32 gciTableCreated;
......
......@@ -1525,9 +1525,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpAttr.AttributeId = i;
tmpAttr.AttributeKeyFlag = col->m_pk;
tmpAttr.AttributeNullableFlag = col->m_nullable;
tmpAttr.AttributeStoredInd = 1;
tmpAttr.AttributeDKey = col->m_distributionKey;
tmpAttr.AttributeDGroup = 0;
tmpAttr.AttributeExtType =
getKernelConstant(col->m_type,
......
......@@ -919,6 +919,8 @@ NdbScanOperation::takeOverScanOp(OperationType opType, NdbConnection* pTrans){
TcKeyReq::setTakeOverScanFragment(scanInfo, tTakeOverFragment);
TcKeyReq::setTakeOverScanInfo(scanInfo, tScanInfo);
newOp->theScanInfo = scanInfo;
newOp->theDistrKeyIndicator_ = 1;
newOp->theDistributionKey = tTakeOverFragment;
}
// Copy the first 8 words of key info from KEYINF20 into TCKEYREQ
......
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