ndb: force varpart part I, allow setting of flag in dictionary

parent 5dff16eb
......@@ -118,6 +118,7 @@ public:
FrmData = 27,
TableTemporaryFlag = 28, //Default not Temporary
ForceVarPartFlag = 29,
FragmentCount = 128, // No of fragments in table (!fragment replicas)
FragmentDataLen = 129,
......@@ -299,6 +300,7 @@ public:
Uint32 PrimaryTableId;
Uint32 TableLoggedFlag;
Uint32 TableTemporaryFlag;
Uint32 ForceVarPartFlag;
Uint32 NoOfKeyAttr;
Uint32 NoOfAttributes;
Uint32 NoOfNullable;
......
......@@ -105,7 +105,7 @@ class LqhFragReq {
friend bool printLQH_FRAG_REQ(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 24 );
STATIC_CONST( SignalLength = 25 );
enum RequestInfo {
CreateInRunning = 0x8000000,
......@@ -143,6 +143,7 @@ private:
Uint32 maxRowsHigh;
Uint32 minRowsLow;
Uint32 minRowsHigh;
Uint32 forceVarPartFlag;
};
class LqhFragConf {
......
......@@ -29,7 +29,7 @@ class TupFragReq {
friend class Dblqh;
friend class Dbtup;
public:
STATIC_CONST( SignalLength = 17 );
STATIC_CONST( SignalLength = 18 );
private:
Uint32 userPtr;
Uint32 userRef;
......@@ -48,6 +48,7 @@ private:
Uint32 checksumIndicator;
Uint32 globalCheckpointIdIndicator;
Uint32 tablespaceid;
Uint32 forceVarPartFlag;
};
class TupFragConf {
......
......@@ -921,6 +921,14 @@ public:
bool getTemporary();
void setTemporary(bool);
/**
* Only table with varpart do support online add column
* Add property so that table wo/ varsize column(s) still
* allocates varpart-ref, so that later online add column is possible
*/
bool getForceVarPart() const;
void setForceVarPart(bool);
/**
* Check if any of column in bitmaps are disk columns
* returns bitmap of different columns
......
......@@ -26,6 +26,7 @@ DictTabInfo::TableMapping[] = {
DTIMAP(Table, PrimaryTableId, PrimaryTableId),
DTIMAP2(Table, TableLoggedFlag, TableLoggedFlag, 0, 1),
DTIMAP2(Table, TableTemporaryFlag, TableTemporaryFlag, 0, 1),
DTIMAP2(Table, ForceVarPartFlag, ForceVarPartFlag, 0, 1),
DTIMAP2(Table, TableKValue, TableKValue, 6, 6),
DTIMAP2(Table, MinLoadFactor, MinLoadFactor, 0, 90),
DTIMAP2(Table, MaxLoadFactor, MaxLoadFactor, 25, 110),
......@@ -123,6 +124,7 @@ DictTabInfo::Table::init(){
PrimaryTableId = RNIL;
TableLoggedFlag = 1;
TableTemporaryFlag = 0;
ForceVarPartFlag = 0;
NoOfKeyAttr = 0;
NoOfAttributes = 0;
NoOfNullable = 0;
......
......@@ -449,6 +449,8 @@ Dbdict::packTableIntoPages(SimpleProperties::Writer & w,
!!(tablePtr.p->m_bits & TableRecord::TR_RowChecksum));
w.add(DictTabInfo::TableTemporaryFlag,
!!(tablePtr.p->m_bits & TableRecord::TR_Temporary));
w.add(DictTabInfo::ForceVarPartFlag,
!!(tablePtr.p->m_bits & TableRecord::TR_ForceVarPart));
w.add(DictTabInfo::MinLoadFactor, tablePtr.p->minLoadFactor);
w.add(DictTabInfo::MaxLoadFactor, tablePtr.p->maxLoadFactor);
......@@ -5503,8 +5505,8 @@ Dbdict::execADD_FRAGREQ(Signal* signal) {
req->tableType = tabPtr.p->tableType;
req->primaryTableId = tabPtr.p->primaryTableId;
req->tablespace_id= tabPtr.p->m_tablespace_id;
//req->tablespace_id= tablespace_id;
req->logPartId = logPart;
req->forceVarPartFlag = !!(tabPtr.p->m_bits& TableRecord::TR_ForceVarPart);
sendSignal(DBLQH_REF, GSN_LQHFRAGREQ, signal,
LqhFragReq::SignalLength, JBB);
}
......@@ -6119,6 +6121,8 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
(c_tableDesc.RowGCIFlag ? TableRecord::TR_RowGCI : 0);
tablePtr.p->m_bits |=
(c_tableDesc.TableTemporaryFlag ? TableRecord::TR_Temporary : 0);
tablePtr.p->m_bits |=
(c_tableDesc.ForceVarPartFlag ? TableRecord::TR_ForceVarPart : 0);
tablePtr.p->minLoadFactor = c_tableDesc.MinLoadFactor;
tablePtr.p->maxLoadFactor = c_tableDesc.MaxLoadFactor;
tablePtr.p->fragmentType = (DictTabInfo::FragmentType)c_tableDesc.FragmentType;
......
......@@ -236,10 +236,11 @@ public:
/* Is the table logged (i.e. data survives system restart) */
enum Bits
{
TR_Logged = 0x1,
TR_RowGCI = 0x2,
TR_RowChecksum = 0x4,
TR_Temporary = 0x8
TR_Logged = 0x1,
TR_RowGCI = 0x2,
TR_RowChecksum = 0x4,
TR_Temporary = 0x8,
TR_ForceVarPart = 0x10
};
Uint16 m_bits;
......
......@@ -459,7 +459,8 @@ public:
Uint32 maxRowsHigh;
Uint32 minRowsLow;
Uint32 minRowsHigh;
};// Size 128 bytes
Uint32 forceVarPartFlag;
};
typedef Ptr<AddFragRecord> AddFragRecordPtr;
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
......
......@@ -1071,6 +1071,7 @@ void Dblqh::execLQHFRAGREQ(Signal* signal)
Uint32 primaryTableId = req->primaryTableId;
Uint32 tablespace= req->tablespace_id;
Uint32 logPart = req->logPartId;
Uint32 forceVarPartFlag = req->forceVarPartFlag;
if (signal->getLength() < 20)
{
......@@ -1190,6 +1191,7 @@ void Dblqh::execLQHFRAGREQ(Signal* signal)
addfragptr.p->tableType = tableType;
addfragptr.p->primaryTableId = primaryTableId;
addfragptr.p->tablespace_id= tablespace;
addfragptr.p->forceVarPartFlag = forceVarPartFlag;
//
addfragptr.p->tupConnectptr = RNIL;
addfragptr.p->tuxConnectptr = RNIL;
......@@ -1340,6 +1342,7 @@ Dblqh::sendAddFragReq(Signal* signal)
tupFragReq->checksumIndicator = addfragptr.p->checksumIndicator;
tupFragReq->globalCheckpointIdIndicator = addfragptr.p->GCPIndicator;
tupFragReq->tablespaceid = addfragptr.p->tablespace_id;
tupFragReq->forceVarPartFlag = addfragptr.p->forceVarPartFlag;
sendSignal(fragptr.p->tupBlockref, GSN_TUPFRAGREQ,
signal, TupFragReq::SignalLength, JBB);
return;
......
......@@ -703,6 +703,16 @@ NdbDictionary::Table::getRowGCIIndicator() const {
return m_impl.m_row_gci;
}
void
NdbDictionary::Table::setForceVarPart(bool val){
m_impl.m_force_var_part = val;
}
bool
NdbDictionary::Table::getForceVarPart() const {
return m_impl.m_force_var_part;
}
int
NdbDictionary::Table::aggregate(NdbError& error)
{
......
......@@ -2105,6 +2105,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
impl->m_temporary = tableDesc->TableTemporaryFlag;
impl->m_row_gci = tableDesc->RowGCIFlag;
impl->m_row_checksum = tableDesc->RowChecksumFlag;
impl->m_force_var_part = tableDesc->ForceVarPartFlag;
impl->m_kvalue = tableDesc->TableKValue;
impl->m_minLoadFactor = tableDesc->MinLoadFactor;
impl->m_maxLoadFactor = tableDesc->MaxLoadFactor;
......@@ -2569,6 +2570,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpTab->MinRowsLow = (Uint32)(impl.m_min_rows & 0xFFFFFFFF);
tmpTab->DefaultNoPartFlag = impl.m_default_no_part_flag;
tmpTab->LinearHashFlag = impl.m_linear_flag;
tmpTab->ForceVarPartFlag = impl.m_force_var_part;
if (impl.m_ts_name.length())
{
......
......@@ -199,6 +199,7 @@ public:
bool m_temporary;
bool m_row_gci;
bool m_row_checksum;
bool m_force_var_part;
int m_kvalue;
int m_minLoadFactor;
int m_maxLoadFactor;
......
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