Below is the list of changes that have just been committed into a local
5.1-ndb repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1770 05/03/06 17:22:12 pekka@stripped +12 -0
ndb - add storage memory/disk to NdbDictionary
ndb/test/src/NdbSchemaOp.cpp
1.9 05/03/06 17:09:58 pekka@stripped +1 -0
add storage memory/disk to NdbDictionary
ndb/test/include/NdbSchemaOp.hpp
1.13 05/03/06 17:09:58 pekka@stripped +3 -3
add storage memory/disk to NdbDictionary
ndb/src/ndbapi/NdbDictionaryImpl.hpp
1.32 05/03/06 17:09:58 pekka@stripped +1 -0
add storage memory/disk to NdbDictionary
ndb/src/ndbapi/NdbDictionaryImpl.cpp
1.67 05/03/06 17:09:58 pekka@stripped +9 -0
add storage memory/disk to NdbDictionary
ndb/src/ndbapi/NdbDictionary.cpp
1.36 05/03/06 17:09:58 pekka@stripped +31 -7
add storage memory/disk to NdbDictionary
ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
1.16 05/03/06 17:09:57 pekka@stripped +0 -1
add storage memory/disk to NdbDictionary
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
1.57 05/03/06 17:09:57 pekka@stripped +1 -1
add storage memory/disk to NdbDictionary
ndb/src/common/debugger/signaldata/DictTabInfo.cpp
1.11 05/03/06 17:09:57 pekka@stripped +2 -4
add storage memory/disk to NdbDictionary
ndb/include/ndbapi/NdbDictionary.hpp
1.37 05/03/06 17:09:57 pekka@stripped +33 -4
add storage memory/disk to NdbDictionary
ndb/include/ndb_constants.h
1.11 05/03/06 17:09:57 pekka@stripped +7 -0
add storage memory/disk to NdbDictionary
ndb/include/kernel/signaldata/DictTabInfo.hpp
1.21 05/03/06 17:09:57 pekka@stripped +4 -5
add storage memory/disk to NdbDictionary
ndb/include/kernel/AttributeDescriptor.hpp
1.10 05/03/06 17:09:57 pekka@stripped +8 -10
add storage memory/disk to NdbDictionary
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pekka
# Host: tuna.ndb.mysql.com
# Root: /orca/space/pekka/ndb/version/my51-dd2
--- 1.9/ndb/include/kernel/AttributeDescriptor.hpp 2005-02-15 16:02:21 +01:00
+++ 1.10/ndb/include/kernel/AttributeDescriptor.hpp 2005-03-06 17:09:57 +01:00
@@ -148,6 +148,14 @@
desc |= (dynamic << AD_DYNAMIC);
}
+inline
+void
+AttributeDescriptor::setDiskBased(Uint32 & desc, Uint32 val)
+{
+ assert(val <= 1);
+ desc |= (val << AD_DISK_SHIFT);
+}
+
/**
* Getters
*/
@@ -212,16 +220,6 @@
Uint32
AttributeDescriptor::getDynamic(const Uint32 & desc){
return (desc >> AD_DYNAMIC) & 1;
-}
-
-inline
-void
-AttributeDescriptor::setDiskBased(Uint32 & desc, Uint32 val)
-{
- if(val)
- desc |= (1 << AD_DISK_SHIFT);
- else
- desc &= ~(Uint32)(1 << AD_DISK_SHIFT);
}
inline
--- 1.20/ndb/include/kernel/signaldata/DictTabInfo.hpp 2005-02-21 07:28:15 +01:00
+++ 1.21/ndb/include/kernel/signaldata/DictTabInfo.hpp 2005-03-06 17:09:57 +01:00
@@ -128,7 +128,7 @@
AttributeSize = 1003, //Default DictTabInfo::a32Bit
AttributeArraySize = 1005, //Default 1
AttributeKeyFlag = 1006, //Default noKey
- AttributeStorage = 1007, //Default MainMemory
+ AttributeStorageType = 1007, //Default NDB_STORAGETYPE_MEMORY
AttributeNullableFlag = 1008, //Default NotNullable
AttributeDKey = 1010, //Default NotDKey
AttributeExtType = 1013, //Default ExtUnsigned
@@ -277,7 +277,6 @@
Uint32 MaxLoadFactor;
Uint32 KeyLength;
Uint32 FragmentType;
- Uint32 TableStorage;
Uint32 TableType;
Uint32 TableVersion;
Uint32 IndexState;
@@ -350,7 +349,7 @@
Uint32 AttributeExtScale;
Uint32 AttributeExtLength;
Uint32 AttributeAutoIncrement;
- Uint32 AttributeStorage;
+ Uint32 AttributeStorageType;
char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
void init();
@@ -489,7 +488,7 @@
fprintf(out, "AttributeArraySize = %d\n", AttributeArraySize);
fprintf(out, "AttributeArrayType = %d\n", AttributeArrayType);
fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag);
- fprintf(out, "AttributeStorage = %d\n", AttributeStorage);
+ fprintf(out, "AttributeStorageType = %d\n", AttributeStorageType);
fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag);
fprintf(out, "AttributeDKey = %d\n", AttributeDKey);
fprintf(out, "AttributeGroup = %d\n", AttributeGroup);
@@ -531,13 +530,13 @@
{
AttributeDGroup = 1009, //Default NotDGroup
AttributeStoredInd = 1011, //Default NotStored
+ TableStorageVal = 14, //Disk storage specified per attribute
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
};
--- 1.36/ndb/include/ndbapi/NdbDictionary.hpp 2005-02-27 17:37:10 +01:00
+++ 1.37/ndb/include/ndbapi/NdbDictionary.hpp 2005-03-06 17:09:57 +01:00
@@ -208,6 +208,33 @@
Timestamp = NDB_TYPE_TIMESTAMP ///< Unix time
};
+ /*
+ * Array type specifies internal attribute format.
+ *
+ * - ArrayTypeFixed is stored as fixed number of bytes. This type
+ * is fastest to access but can waste space.
+ *
+ * - ArrayTypeVar is stored as variable number of bytes with a fixed
+ * overhead of 2 bytes.
+ *
+ * Default is ArrayTypeVar for Var* types and ArrayTypeFixed for
+ * others. The default is normally ok.
+ */
+ enum ArrayType {
+ ArrayTypeFixed = NDB_ARRAYTYPE_FIXED,
+ ArrayTypeVar = NDB_ARRAYTYPE_VAR
+ };
+
+ /*
+ * Storage type specifies whether attribute is stored in memory or
+ * on disk. Default is memory. Disk attributes are potentially
+ * much slower to access and cannot be indexed in version 5.1.
+ */
+ enum StorageType {
+ StorageTypeMemory = NDB_STORAGETYPE_MEMORY,
+ StorageTypeDisk = NDB_STORAGETYPE_DISK
+ };
+
/**
* @name General
* @{
@@ -327,6 +354,9 @@
inline bool getDistributionKey() const { return getPartitionKey(); };
#endif
+ ArrayType getArrayType() const;
+ StorageType getStorageType() const;
+
/** @} *******************************************************************/
@@ -435,6 +465,9 @@
{ setPartitionKey(enable); };
#endif
+ void setArrayType(ArrayType type);
+ void setStorageType(StorageType type);
+
/** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
@@ -454,10 +487,6 @@
static const Column * RANGE_NO;
int getSizeInBytes() const;
-
- // later add enum, change name, make public
- void setArrayType(Uint32 val);
- Uint32 getArrayType() const;
#endif
private:
--- 1.12/ndb/test/include/NdbSchemaOp.hpp 2005-03-06 13:58:20 +01:00
+++ 1.13/ndb/test/include/NdbSchemaOp.hpp 2005-03-06 17:09:58 +01:00
@@ -71,11 +71,11 @@
};
/**
* Indicate whether the attribute should be stored on disk or not
+ * Only for legacy createAttribute().
*/
enum StorageMode {
- MMBased = 0, ///< Main memory
- DiskBased = 1, ///< Disk (Not yet supported.)
- NoStorageTypeDef ///< Used for debugging only
+ MMBased = NDB_STORAGETYPE_MEMORY,
+ DiskBased = NDB_STORAGETYPE_DISK
};
/**
--- 1.10/ndb/src/common/debugger/signaldata/DictTabInfo.cpp 2005-02-15 16:02:21 +01:00
+++ 1.11/ndb/src/common/debugger/signaldata/DictTabInfo.cpp 2005-03-06 17:09:57 +01:00
@@ -30,7 +30,6 @@
DTIMAP2(Table, MinLoadFactor, MinLoadFactor, 0, 90),
DTIMAP2(Table, MaxLoadFactor, MaxLoadFactor, 25, 110),
DTIMAP2(Table, FragmentTypeVal, FragmentType, 0, 3),
- DTIMAP2(Table, TableStorageVal, TableStorage, 0, 0),
DTIMAP2(Table, TableTypeVal, TableType, 1, 3),
DTIMAP(Table, NoOfKeyAttr, NoOfKeyAttr),
DTIMAP2(Table, NoOfAttributes, NoOfAttributes, 1, MAX_ATTRIBUTES_IN_TABLE),
@@ -68,7 +67,7 @@
DTIMAP2(Attribute, AttributeKeyFlag, AttributeKeyFlag, 0, 1),
DTIMAP2(Attribute, AttributeNullableFlag, AttributeNullableFlag, 0, 1),
DTIMAP2(Attribute, AttributeDKey, AttributeDKey, 0, 1),
- DTIMAP2(Attribute, AttributeStorage, AttributeStorage, 0, 1),
+ DTIMAP2(Attribute, AttributeStorageType, AttributeStorageType, 0, 1),
DTIMAP(Attribute, AttributeExtType, AttributeExtType),
DTIMAP(Attribute, AttributeExtPrecision, AttributeExtPrecision),
DTIMAP(Attribute, AttributeExtScale, AttributeExtScale),
@@ -113,7 +112,6 @@
MaxLoadFactor = 80;
KeyLength = 0;
FragmentType = DictTabInfo::AllNodesSmallTable;
- TableStorage = 0;
TableType = DictTabInfo::UndefTableType;
TableVersion = 0;
IndexState = ~0;
@@ -144,7 +142,7 @@
AttributeExtScale = 0,
AttributeExtLength = 0,
AttributeAutoIncrement = false;
- AttributeStorage= 0;
+ AttributeStorageType = 0;
memset(AttributeDefaultValue, 0,
sizeof(AttributeDefaultValue));//AttributeDefaultValue[0] = 0;
}
--- 1.56/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-03-04 14:17:24 +01:00
+++ 1.57/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-03-06 17:09:57 +01:00
@@ -5027,7 +5027,7 @@
AttributeDescriptor::setNullable(desc, attrDesc.AttributeNullableFlag);
AttributeDescriptor::setDKey(desc, attrDesc.AttributeDKey);
AttributeDescriptor::setPrimaryKey(desc, attrDesc.AttributeKeyFlag);
- AttributeDescriptor::setDiskBased(desc, attrDesc.AttributeStorage);
+ AttributeDescriptor::setDiskBased(desc, attrDesc.AttributeStorageType ==
NDB_STORAGETYPE_DISK);
attrPtr.p->attributeDescriptor = desc;
attrPtr.p->autoIncrement = attrDesc.AttributeAutoIncrement;
{
--- 1.15/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2005-02-24 01:40:29 +01:00
+++ 1.16/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp 2005-03-06 17:09:57 +01:00
@@ -1553,7 +1553,6 @@
//w.add(DictTabInfo::MinLoadFactor, 70);
//w.add(DictTabInfo::MaxLoadFactor, 80);
w.add(DictTabInfo::FragmentTypeVal, (Uint32)table.fragmentType);
- //w.add(DictTabInfo::TableStorageVal, (Uint32)DictTabInfo::MainMemory);
//w.add(DictTabInfo::NoOfKeyAttr, 1);
w.add(DictTabInfo::NoOfAttributes, (Uint32)table.columnCount);
//w.add(DictTabInfo::NoOfNullable, (Uint32)0);
--- 1.35/ndb/src/ndbapi/NdbDictionary.cpp 2005-02-21 07:28:16 +01:00
+++ 1.36/ndb/src/ndbapi/NdbDictionary.cpp 2005-03-06 17:09:58 +01:00
@@ -238,15 +238,27 @@
}
void
-NdbDictionary::Column::setArrayType(Uint32 val)
+NdbDictionary::Column::setArrayType(ArrayType type)
{
- m_impl.m_arrayType = val;
+ m_impl.m_arrayType = type;
}
-Uint32
+NdbDictionary::Column::ArrayType
NdbDictionary::Column::getArrayType() const
{
- return m_impl.m_arrayType;
+ return (ArrayType)m_impl.m_arrayType;
+}
+
+void
+NdbDictionary::Column::setStorageType(StorageType type)
+{
+ m_impl.m_storageType = type;
+}
+
+NdbDictionary::Column::StorageType
+NdbDictionary::Column::getStorageType() const
+{
+ return (StorageType)m_impl.m_storageType;
}
/*****************************************************************
@@ -1332,13 +1344,25 @@
switch (col.getArrayType()) {
case NDB_ARRAYTYPE_FIXED:
- out << " STORAGE=FIXED";
+ out << " AT=FIXED";
break;
case NDB_ARRAYTYPE_VAR:
- out << " STORAGE=VAR";
+ out << " AT=VAR";
+ break;
+ default:
+ out << " AT=" << col.getArrayType() << "?";
+ break;
+ }
+
+ switch (col.getStorageType()) {
+ case NDB_STORAGETYPE_MEMORY:
+ out << " ST=MEMORY";
+ break;
+ case NDB_STORAGETYPE_DISK:
+ out << " ST=DISK";
break;
default:
- out << " STORAGE=" << col.getArrayType() << "?";
+ out << " ST=" << col.getStorageType() << "?";
break;
}
--- 1.66/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-03-04 07:59:04 +01:00
+++ 1.67/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-03-06 17:09:58 +01:00
@@ -80,6 +80,7 @@
m_attrSize = col.m_attrSize;
m_arraySize = col.m_arraySize;
m_arrayType = col.m_arrayType;
+ m_storageType = col.m_storageType;
m_keyInfoPos = col.m_keyInfoPos;
m_blobTable = col.m_blobTable;
m_column_no = col.m_column_no;
@@ -218,6 +219,8 @@
m_autoIncrement = false;
m_autoIncrementInitialValue = 1;
m_blobTable = NULL;
+ m_storageType = NDB_STORAGETYPE_MEMORY;
+ // temp
m_arrayType = NDB_ARRAYTYPE_FIXED;
}
@@ -259,6 +262,10 @@
DBUG_RETURN(false);
}
+ if (m_arrayType != col.m_arrayType || m_storageType != col.m_storageType){
+ DBUG_RETURN(false);
+ }
+
DBUG_RETURN(true);
}
@@ -1396,6 +1403,7 @@
col->m_attrSize = 4;
col->m_arraySize = (attrDesc.AttributeArraySize + 31) >> 5;
}
+ col->m_storageType = attrDesc.AttributeStorageType;
col->m_pk = attrDesc.AttributeKeyFlag;
col->m_distributionKey = attrDesc.AttributeDKey;
@@ -1680,6 +1688,7 @@
tmpAttr.AttributeExtScale = col->m_scale;
tmpAttr.AttributeExtLength = col->m_length;
tmpAttr.AttributeArrayType = col->m_arrayType;
+ tmpAttr.AttributeStorageType = col->m_storageType;
// check type and compute attribute size and array size
if (! tmpAttr.translateExtType()) {
--- 1.31/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-02-25 09:24:46 +01:00
+++ 1.32/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-03-06 17:09:58 +01:00
@@ -81,6 +81,7 @@
Uint32 m_attrSize; // element size (size when arraySize==1)
Uint32 m_arraySize; // length or maxlength+1/2 for Var* types
Uint32 m_arrayType; // NDB_ARRAYTYPE_FIXED or _VAR
+ Uint32 m_storageType; // NDB_STORAGETYPE_MEMORY or _DISK
Uint32 m_keyInfoPos;
// TODO: use bits in attr desc 2
bool getInterpretableType() const ;
--- 1.8/ndb/test/src/NdbSchemaOp.cpp 2005-03-06 13:58:20 +01:00
+++ 1.9/ndb/test/src/NdbSchemaOp.cpp 2005-03-06 17:09:58 +01:00
@@ -160,6 +160,7 @@
col.setDistributionKey(aDistributionKeyFlag);
col.setAutoIncrement(aAutoIncrement);
col.setDefaultValue(aDefaultValue != 0 ? aDefaultValue : "");
+ col.setStorageType((NdbDictionary::Column::StorageType)aStorageMode);
m_currentTable->addColumn(col);
return 0;
--- 1.10/ndb/include/ndb_constants.h 2005-02-27 17:37:10 +01:00
+++ 1.11/ndb/include/ndb_constants.h 2005-03-06 17:09:57 +01:00
@@ -76,5 +76,12 @@
#define NDB_ARRAYTYPE_FIXED 2
#define NDB_ARRAYTYPE_VAR 0
+
+/*
+ * Attribute storage type.
+ */
+
+#define NDB_STORAGETYPE_MEMORY 0
+#define NDB_STORAGETYPE_DISK 1
#endif
| Thread |
|---|
| • bk commit into 5.1-ndb tree (pekka:1.1770) | pekka | 6 Mar |