1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-30 11:22:14 +03:00

wl1540, 1802

Index scan/lookup (only scan specific fragment)


ndb/include/kernel/signaldata/TcIndx.hpp:
  Removed TxIndxReq
ndb/include/ndbapi/NdbDictionary.hpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/include/ndbapi/NdbOperation.hpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/include/util/md5_hash.hpp:
  Added possibility to get all 4 32-bit hash values
ndb/src/common/debugger/signaldata/SignalDataPrint.cpp:
  Removed TxIndxReq
ndb/src/common/debugger/signaldata/TcIndx.cpp:
  Removed TxIndxReq
ndb/src/common/util/md5_hash.cpp:
  Added possibility to get all 4 32-bit hash values
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  removed fragbits from hash value
ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
  removed unused frag offset (k+fragbits)
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  removed unused frag offset (k+fragbits)
ndb/src/kernel/blocks/dbtc/Dbtc.hpp:
  Removed TxIndxReq
  Removed distribution group
  Added possibility for API to set fragment hash value
  Split hashvalue into 2 32bit words
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Removed TxIndxReq
  Removed distribution group
  Added possibility for API to set fragment hash value
  Split hashvalue into 2 32bit words
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
  removed unused frag offset (k+fragbits)
ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp:
  removed unused frag offset (k+fragbits)
ndb/src/ndbapi/NdbApiSignal.cpp:
  Removed TxIndxReq
ndb/src/ndbapi/NdbDictionary.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbIndexOperation.cpp:
  Removed TxIndxReq
ndb/src/ndbapi/NdbOperation.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbOperationDefine.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbOperationExec.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/src/ndbapi/NdbOperationSearch.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/test/src/HugoOperations.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
ndb/test/src/NdbSchemaOp.cpp:
  Removed 
  1) Tuple key
  2) Distribution group
  3) index only storage
This commit is contained in:
unknown
2004-10-31 22:21:51 +01:00
parent bc26963aa1
commit 397a2a17bc
25 changed files with 160 additions and 786 deletions

View File

@@ -18,379 +18,7 @@
#define TC_INDX_H
#include "SignalData.hpp"
class TcIndxReq {
/**
* Reciver(s)
*/
friend class Dbtc; // Reciver
/**
* Sender(s)
*/
friend class NdbIndexOperation;
/**
* For printing
*/
friend bool printTCINDXREQ(FILE *, const Uint32 *, Uint32, Uint16);
public:
/**
* Length of signal
*/
STATIC_CONST( StaticLength = 8 );
STATIC_CONST( SignalLength = 25 );
STATIC_CONST( MaxKeyInfo = 8 );
STATIC_CONST( MaxAttrInfo = 5 );
private:
enum CommitType {
CommitIfFailFree = 0,
TryCommit = 1,
CommitAsMuchAsPossible = 2
};
/**
* DATA VARIABLES
*/
//-------------------------------------------------------------
// Unconditional part. First 8 words
//-------------------------------------------------------------
UintR apiConnectPtr; // DATA 0
UintR senderData; // DATA 1
UintR attrLen; // DATA 2 (including API Version)
UintR indexId; // DATA 3
UintR requestInfo; // DATA 4
UintR indexSchemaVersion; // DATA 5
UintR transId1; // DATA 6
UintR transId2; // DATA 7
//-------------------------------------------------------------
// Conditional part. Those four words will be sent only if their
// indicator is set.
//-------------------------------------------------------------
UintR scanInfo; // DATA 8
UintR distrGroupHashValue; // DATA 9
UintR distributionKeySize; // DATA 10
UintR storedProcId; // DATA 11
//-------------------------------------------------------------
// Variable sized key and attrinfo part. Those will be placed to
// pack the signal in an appropriate manner.
//-------------------------------------------------------------
UintR keyInfo[MaxKeyInfo]; // DATA 12 - 19
UintR attrInfo[MaxAttrInfo]; // DATA 20 - 24
static Uint8 getAPIVersion(const UintR & attrLen);
/**
* Get:ers for requestInfo
*/
static Uint8 getCommitFlag(const UintR & requestInfo);
static Uint8 getCommitType(const UintR & requestInfo);
static Uint8 getStartFlag(const UintR & requestInfo);
static Uint8 getSimpleFlag(const UintR & requestInfo);
static Uint8 getDirtyFlag(const UintR & requestInfo);
static Uint8 getInterpretedFlag(const UintR & requestInfo);
static Uint8 getDistributionGroupFlag(const UintR & requestInfo);
static Uint8 getDistributionGroupTypeFlag(const UintR & requestInfo);
static Uint8 getDistributionKeyFlag(const UintR & requestInfo);
static Uint8 getScanIndFlag(const UintR & requestInfo);
static Uint8 getOperationType(const UintR & requestInfo);
static Uint16 getIndexLength(const UintR & requestInfo);
static Uint8 getAIInTcIndxReq(const UintR & requestInfo);
/**
* Get:ers for scanInfo
*/
static void setAPIVersion(UintR & attrLen, Uint16 apiVersion);
/**
* Set:ers for requestInfo
*/
static void clearRequestInfo(UintR & requestInfo);
static void setCommitType(UintR & requestInfo, Uint32 type);
static void setCommitFlag(UintR & requestInfo, Uint32 flag);
static void setStartFlag(UintR & requestInfo, Uint32 flag);
static void setSimpleFlag(UintR & requestInfo, Uint32 flag);
static void setDirtyFlag(UintR & requestInfo, Uint32 flag);
static void setInterpretedFlag(UintR & requestInfo, Uint32 flag);
static void setDistributionGroupFlag(UintR & requestInfo, Uint32 flag);
static void setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag);
static void setDistributionKeyFlag(UintR & requestInfo, Uint32 flag);
static void setScanIndFlag(UintR & requestInfo, Uint32 flag);
static void setOperationType(UintR & requestInfo, Uint32 type);
static void setIndexLength(UintR & requestInfo, Uint32 len);
static void setAIInTcIndxReq(UintR & requestInfo, Uint32 len);
/**
* Set:ers for scanInfo
*/
};
#define API_VER_NO_SHIFT (16)
#define API_VER_NO_MASK (65535)
/**
* Request Info
*
a = Attr Info in TCINDXREQ - 3 Bits -> Max 7 (Bit 16-18)
b = Distribution Key Ind - 1 Bit 2
c = Commit Indicator - 1 Bit 4
d = Dirty Indicator - 1 Bit 0
e = Scan Indicator - 1 Bit 14
g = Distribution Group Ind - 1 Bit 1
i = Interpreted Indicator - 1 Bit 15
k = Index lengt - 12 Bits -> Max 4095 (Bit 20 - 31)
o = Operation Type - 3 Bits -> Max 7 (Bit 5-7)
p = Simple Indicator - 1 Bit 8
s = Start Indicator - 1 Bit 11
t = Distribution GroupType - 1 Bit 3
y = Commit Type - 2 Bit 12-13
x = Last Op in execute - 1 Bit 19
1111111111222222222233
01234567890123456789012345678901
dgbtcooop syyeiaaa-kkkkkkkkkkkk
*/
#define COMMIT_SHIFT (4)
#define START_SHIFT (11)
#define SIMPLE_SHIFT (8)
#define DIRTY_SHIFT (0)
#define INTERPRETED_SHIFT (15)
#define DISTR_GROUP_SHIFT (1)
#define DISTR_GROUP_TYPE_SHIFT (3)
#define DISTR_KEY_SHIFT (2)
#define SCAN_SHIFT (14)
#define OPERATION_SHIFT (5)
#define OPERATION_MASK (7)
#define AINFO_SHIFT (16)
#define AINFO_MASK (7)
#define INDEX_LEN_SHIFT (20)
#define INDEX_LEN_MASK (4095)
#define COMMIT_TYPE_SHIFT (12)
#define COMMIT_TYPE_MASK (3)
#define LAST_OP_IN_EXEC_SHIFT (19)
/**
* Scan Info
*
1111111111222222222233
01234567890123456789012345678901
*/
inline
Uint8
TcIndxReq::getCommitFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> COMMIT_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getCommitType(const UintR & requestInfo){
return (Uint8)((requestInfo >> COMMIT_TYPE_SHIFT) & COMMIT_TYPE_MASK);
}
inline
Uint8
TcIndxReq::getStartFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> START_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getSimpleFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> SIMPLE_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getDirtyFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> DIRTY_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getInterpretedFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> INTERPRETED_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getDistributionGroupFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> DISTR_GROUP_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getDistributionGroupTypeFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> DISTR_GROUP_TYPE_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getDistributionKeyFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> DISTR_KEY_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getScanIndFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> SCAN_SHIFT) & 1);
}
inline
Uint8
TcIndxReq::getOperationType(const UintR & requestInfo){
return (Uint8)((requestInfo >> OPERATION_SHIFT) & OPERATION_MASK);
}
inline
Uint16
TcIndxReq::getIndexLength(const UintR & requestInfo){
return (Uint16)((requestInfo >> INDEX_LEN_SHIFT) & INDEX_LEN_MASK);
}
inline
Uint8
TcIndxReq::getAIInTcIndxReq(const UintR & requestInfo){
return (Uint8)((requestInfo >> AINFO_SHIFT) & AINFO_MASK);
}
inline
void
TcIndxReq::clearRequestInfo(UintR & requestInfo){
requestInfo = 0;
}
inline
void
TcIndxReq::setCommitType(UintR & requestInfo, Uint32 type){
ASSERT_MAX(type, COMMIT_TYPE_MASK, "TcIndxReq::setCommitType");
requestInfo |= (type << COMMIT_TYPE_SHIFT);
}
inline
void
TcIndxReq::setCommitFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setCommitFlag");
requestInfo &= ~(1 << COMMIT_SHIFT);
requestInfo |= (flag << COMMIT_SHIFT);
}
inline
void
TcIndxReq::setStartFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setStartFlag");
requestInfo &= ~(1 << START_SHIFT);
requestInfo |= (flag << START_SHIFT);
}
inline
void
TcIndxReq::setSimpleFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setSimpleFlag");
requestInfo &= ~(1 << SIMPLE_SHIFT);
requestInfo |= (flag << SIMPLE_SHIFT);
}
inline
void
TcIndxReq::setDirtyFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setDirtyFlag");
requestInfo &= ~(1 << DIRTY_SHIFT);
requestInfo |= (flag << DIRTY_SHIFT);
}
inline
void
TcIndxReq::setInterpretedFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setInterpretedFlag");
requestInfo &= ~(1 << INTERPRETED_SHIFT);
requestInfo |= (flag << INTERPRETED_SHIFT);
}
inline
void
TcIndxReq::setDistributionGroupTypeFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setDistributionGroupTypeFlag");
requestInfo &= ~(1 << DISTR_GROUP_TYPE_SHIFT);
requestInfo |= (flag << DISTR_GROUP_TYPE_SHIFT);
}
inline
void
TcIndxReq::setDistributionGroupFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setDistributionGroupFlag");
requestInfo &= ~(1 << DISTR_GROUP_SHIFT);
requestInfo |= (flag << DISTR_GROUP_SHIFT);
}
inline
void
TcIndxReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setDistributionKeyFlag");
requestInfo &= ~(1 << DISTR_KEY_SHIFT);
requestInfo |= (flag << DISTR_KEY_SHIFT);
}
inline
void
TcIndxReq::setScanIndFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "TcIndxReq::setScanIndFlag");
requestInfo &= ~(1 << SCAN_SHIFT);
requestInfo |= (flag << SCAN_SHIFT);
}
inline
void
TcIndxReq::setOperationType(UintR & requestInfo, Uint32 type){
ASSERT_MAX(type, OPERATION_MASK, "TcIndxReq::setOperationType");
requestInfo |= (type << OPERATION_SHIFT);
}
inline
void
TcIndxReq::setIndexLength(UintR & requestInfo, Uint32 len){
ASSERT_MAX(len, INDEX_LEN_MASK, "TcIndxReq::setKeyLength");
requestInfo |= (len << INDEX_LEN_SHIFT);
}
inline
void
TcIndxReq::setAIInTcIndxReq(UintR & requestInfo, Uint32 len){
ASSERT_MAX(len, AINFO_MASK, "TcIndxReq::setAIInTcIndxReq");
requestInfo |= (len << AINFO_SHIFT);
}
inline
Uint8
TcIndxReq::getAPIVersion(const UintR & anAttrLen){
return (Uint16)((anAttrLen >> API_VER_NO_SHIFT) & API_VER_NO_MASK);
}
inline
void
TcIndxReq::setAPIVersion(UintR & anAttrLen, Uint16 apiVersion){
// ASSERT_MAX(apiVersion, API_VER_NO_MASK, "TcIndxReq::setAPIVersion");
anAttrLen |= (apiVersion << API_VER_NO_SHIFT);
}
#include "TcKeyReq.hpp"
class TcIndxConf {

View File

@@ -371,16 +371,6 @@ public:
/** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void setTupleKey(bool);
bool getTupleKey() const;
void setDistributionGroup(bool, int bits = 16);
bool getDistributionGroup() const;
int getDistributionGroupBits() const;
void setIndexOnlyStorage(bool);
bool getIndexOnlyStorage() const;
const Table * getBlobTable() const;
/**

View File

@@ -719,6 +719,12 @@ public:
LockMode getLockMode() const { return theLockMode; }
/**
* Set/get distribution key
*/
void setDistributionKey(Uint32 key);
Uint32 getDistributionKey() const;
protected:
/******************************************************************************
* These are the methods used to create and delete the NdbOperation objects.
@@ -893,8 +899,7 @@ protected:
Uint32 theMagicNumber; // Magic number to verify that object
// is correct
Uint32 theScanInfo; // Scan info bits (take over flag etc)
Uint32 theDistrKeySize; // Distribution Key size if used
Uint32 theDistributionGroup; // Distribution Group if used
Uint32 theDistributionKey; // Distribution Key size if used
Uint32 theSubroutineSize; // Size of subroutines for interpretation
Uint32 theInitialReadSize; // Size of initial reads for interpretation
@@ -907,8 +912,6 @@ protected:
Uint8 theSimpleIndicator; // Indicator of whether simple operation
Uint8 theDirtyIndicator; // Indicator of whether dirty operation
Uint8 theInterpretIndicator; // Indicator of whether interpreted operation
Uint8 theDistrGroupIndicator; // Indicates whether distribution grp is used
Uint8 theDistrGroupType; // Type of distribution group used
Uint8 theDistrKeyIndicator; // Indicates whether distr. key is used
Uint16 m_tcReqGSN;

View File

@@ -20,6 +20,15 @@
#include <ndb_types.h>
// External declaration of hash function
Uint32 md5_hash(const Uint64* keybuf, Uint32 no_of_32_words);
void md5_hash(Uint32 result[4], const Uint64* keybuf, Uint32 no_of_32_words);
inline
Uint32
md5_hash(const Uint64* keybuf, Uint32 no_of_32_words)
{
Uint32 result[4];
md5_hash(result, keybuf, no_of_32_words);
return result[0];
}
#endif

View File

@@ -138,14 +138,10 @@ SignalDataPrintFunctions[] = {
{ GSN_ALTER_INDX_REQ, printALTER_INDX_REQ },
{ GSN_ALTER_INDX_CONF, printALTER_INDX_CONF },
{ GSN_ALTER_INDX_REF, printALTER_INDX_REF },
{ GSN_TCINDXREQ, printTCINDXREQ },
{ GSN_TCINDXCONF, printTCINDXCONF },
{ GSN_TCINDXREF, printTCINDXREF },
{ GSN_INDXKEYINFO, printINDXKEYINFO },
{ GSN_INDXATTRINFO, printINDXATTRINFO },
//{ GSN_TCINDXNEXTREQ, printTCINDXNEXTREQ },
//{ GSN_TCINDEXNEXTCONF, printTCINDEXNEXTCONF },
//{ GSN_TCINDEXNEXREF, printTCINDEXNEXREF },
{ GSN_FSAPPENDREQ, printFSAPPENDREQ },
{ GSN_BACKUP_REQ, printBACKUP_REQ },
{ GSN_BACKUP_DATA, printBACKUP_DATA },

View File

@@ -18,91 +18,6 @@
#include <signaldata/TcKeyReq.hpp>
#include <BlockNumbers.h>
bool
printTCINDXREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
const TcIndxReq * const sig = (TcIndxReq *) theData;
UintR requestInfo = sig->requestInfo;
UintR scanInfo = sig->scanInfo;
fprintf(output, " apiConnectPtr: H\'%.8x, senderData: H\'%.8x\n",
sig->apiConnectPtr, sig->senderData);
fprintf(output, " Operation: %s, Flags: ",
sig->getOperationType(requestInfo) == ZREAD ? "Read" :
sig->getOperationType(requestInfo) == ZREAD_EX ? "Read-Ex" :
sig->getOperationType(requestInfo) == ZUPDATE ? "Update" :
sig->getOperationType(requestInfo) == ZINSERT ? "Insert" :
sig->getOperationType(requestInfo) == ZDELETE ? "Delete" :
sig->getOperationType(requestInfo) == ZWRITE ? "Write" :
"Unknown");
{
if(sig->getDirtyFlag(requestInfo)){
fprintf(output, "Dirty ");
}
if(sig->getStartFlag(requestInfo)){
fprintf(output, "Start ");
}
if (TcKeyReq::getExecuteFlag(sig->requestInfo)) {
fprintf(output, "Execute ");
}
if(sig->getCommitFlag(requestInfo)){
fprintf(output, "Commit, Type = ");
UintR TcommitType = sig->getCommitType(requestInfo);
if (TcommitType == TcIndxReq::CommitIfFailFree) {
fprintf(output, "FailFree ");
} else if (TcommitType == TcIndxReq::TryCommit) {
fprintf(output, "TryCommit ");
} else if (TcommitType == TcIndxReq::CommitAsMuchAsPossible) {
fprintf(output, "Always ");
}//if
}
if(sig->getSimpleFlag(requestInfo)){
fprintf(output, "Simple ");
}
if(sig->getInterpretedFlag(requestInfo)){
fprintf(output, "Interpreted ");
}
if(sig->getDistributionGroupFlag(requestInfo)){
fprintf(output, "DGroup = %d ", sig->distrGroupHashValue);
}
if(sig->getDistributionKeyFlag(sig->requestInfo)){
fprintf(output, "DKey = %d ", sig->distributionKeySize);
}
fprintf(output, "\n");
}
const int indexLen = sig->getIndexLength(requestInfo);
const int attrInThis = sig->getAIInTcIndxReq(requestInfo);
fprintf(output,
" indexLen: %d, attrLen: %d, AI in this: %d, indexId: %d, "
"indexSchemaVer: %d, API Ver: %d\n",
indexLen, sig->attrLen, attrInThis,
sig->indexId, sig->indexSchemaVersion, sig->getAPIVersion(scanInfo));
fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n -- Variable Data --\n",
sig->transId1, sig->transId2);
Uint32 restLen = (len - 8);
const Uint32 * rest = &sig->scanInfo;
while(restLen >= 7){
fprintf(output,
" H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
rest[0], rest[1], rest[2], rest[3],
rest[4], rest[5], rest[6]);
restLen -= 7;
rest += 7;
}
if(restLen > 0){
for(Uint32 i = 0; i<restLen; i++)
fprintf(output, " H\'%.8x", rest[i]);
fprintf(output, "\n");
}
return true;
}
bool
printTCINDXCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){

View File

@@ -75,7 +75,7 @@ void byteReverse(unsigned char *buf, unsigned longs)
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void MD5Transform(Uint32 buf[4], Uint32 const in[16])
static void MD5Transform(Uint32 buf[4], Uint32 const in[16])
{
register Uint32 a, b, c, d;
@@ -162,13 +162,13 @@ void MD5Transform(Uint32 buf[4], Uint32 const in[16])
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
Uint32 md5_hash(const Uint64* keybuf, Uint32 no_of_32_words)
void md5_hash(Uint32 result[4], const Uint64* keybuf, Uint32 no_of_32_words)
{
/*
* This is the external interface of the module
* It is assumed that keybuf is placed on 8 byte
* alignment.
*/
/**
* This is the external interface of the module
* It is assumed that keybuf is placed on 8 byte
* alignment.
*/
Uint32 i;
Uint32 buf[4];
Uint64 transform64_buf[8];
@@ -230,6 +230,10 @@ Uint32 md5_hash(const Uint64* keybuf, Uint32 no_of_32_words)
byteReverse((unsigned char *)transform32_buf, 16);
MD5Transform(buf, transform32_buf);
}
return buf[0];
result[0] = buf[0];
result[1] = buf[1];
result[2] = buf[2];
result[3] = buf[3];
}

View File

@@ -4097,8 +4097,8 @@ Dbdict::execADD_FRAGREQ(Signal* signal) {
req->maxLoadFactor = tabPtr.p->maxLoadFactor;
req->minLoadFactor = tabPtr.p->minLoadFactor;
req->kValue = tabPtr.p->kValue;
req->lh3DistrBits = lhDistrBits;
req->lh3PageBits = lhPageBits;
req->lh3DistrBits = 0; //lhDistrBits;
req->lh3PageBits = 0; //lhPageBits;
req->noOfAttributes = tabPtr.p->noOfAttributes;
req->noOfNullAttributes = tabPtr.p->noOfNullAttr;
req->noOfPagesToPreAllocate = 0;

View File

@@ -861,10 +861,6 @@ public:
* heard of.
*/
Uint8 fragDistributionKey;
/**
* Used to calculate which local fragment to use.
*/
Uint8 hashCheckBit;
/**
* The identity of the next local checkpoint this fragment
* should perform.

View File

@@ -1099,7 +1099,6 @@ void Dblqh::execACCFRAGCONF(Signal* signal)
Uint32 fragId2 = signal->theData[3];
Uint32 accFragPtr1 = signal->theData[4];
Uint32 accFragPtr2 = signal->theData[5];
Uint32 hashCheckBit = signal->theData[6];
ptrCheckGuard(addfragptr, caddfragrecFileSize, addFragRecord);
ndbrequire(addfragptr.p->addfragStatus == AddFragRecord::ACC_ADDFRAG);
@@ -1110,7 +1109,6 @@ void Dblqh::execACCFRAGCONF(Signal* signal)
ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
fragptr.p->accFragptr[0] = accFragPtr1;
fragptr.p->accFragptr[1] = accFragPtr2;
fragptr.p->hashCheckBit = hashCheckBit;
addfragptr.p->addfragStatus = AddFragRecord::WAIT_TWO_TUP;
sendAddFragReq(signal);
@@ -13372,7 +13370,6 @@ void Dblqh::execSR_FRAGIDCONF(Signal* signal)
ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
fragptr.p->accFragptr[0] = srFragidConf->fragPtr[0];
fragptr.p->accFragptr[1] = srFragidConf->fragPtr[1];
fragptr.p->hashCheckBit = srFragidConf->hashCheckBit;
Uint32 noLocFrag = srFragidConf->noLocFrag;
ndbrequire(noLocFrag == 2);
Uint32 fragid[2];

View File

@@ -561,7 +561,7 @@ public:
Uint32 expectedTransIdAI;
AttributeBuffer transIdAI; // For accumulating TransId_AI
TcIndxReq tcIndxReq;
TcKeyReq tcIndxReq;
UintR connectionIndex;
UintR indexReadTcConnect; //
@@ -897,11 +897,11 @@ public:
UintR hashValue; /* THE HASH VALUE USED TO LOCATE FRAGMENT */
Uint8 distributionKeyIndicator;
Uint8 distributionGroupIndicator;
Uint8 distributionGroupType;
Uint8 unused1;
Uint8 unused2;
Uint8 lenAiInTckeyreq; /* LENGTH OF ATTRIBUTE INFORMATION IN TCKEYREQ */
Uint8 distributionKey;
Uint8 fragmentDistributionKey; /* DIH generation no */
/**
* EXECUTION MODE OF OPERATION
@@ -925,9 +925,9 @@ public:
// Second 16 byte cache line in second 64 byte cache
// line. Diverse use.
//---------------------------------------------------
UintR distributionGroup;
UintR distributionKey;
UintR nextCacheRec;
UintR distributionKeySize;
UintR unused3;
Uint32 scanInfo;
//---------------------------------------------------

View File

@@ -2250,29 +2250,17 @@ void Dbtc::hash(Signal* signal)
ti += 4;
}//while
}//if
UintR ThashValue;
UintR TdistrHashValue;
ThashValue = md5_hash((Uint64*)&Tdata32[0], (UintR)regCachePtr->keylen);
Uint32 tmp[4];
md5_hash(tmp, (Uint64*)&Tdata32[0], (UintR)regCachePtr->keylen);
if (regCachePtr->distributionGroupIndicator == 1) {
if (regCachePtr->distributionGroupType == 1) {
jam();
TdistrHashValue = (regCachePtr->distributionGroup << 6);
} else {
jam();
Tdata32[0] = regCachePtr->distributionGroup;
TdistrHashValue = md5_hash((Uint64*)&Tdata32[0], (UintR)1);
}//if
} else if (regCachePtr->distributionKeyIndicator == 1) {
thashValue = tmp[0];
if (regCachePtr->distributionKeyIndicator == 1) {
jam();
TdistrHashValue = md5_hash((Uint64*)&Tdata32[0],
(UintR)regCachePtr->distributionKeySize);
tdistrHashValue = regCachePtr->distributionKey;
} else {
jam();
TdistrHashValue = ThashValue;
tdistrHashValue = tmp[1];
}//if
thashValue = ThashValue;
tdistrHashValue = TdistrHashValue;
}//Dbtc::hash()
/*
@@ -2666,18 +2654,13 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint8 TSimpleFlag = tcKeyReq->getSimpleFlag(Treqinfo);
Uint8 TDirtyFlag = tcKeyReq->getDirtyFlag(Treqinfo);
Uint8 TInterpretedFlag = tcKeyReq->getInterpretedFlag(Treqinfo);
Uint8 TDistrGroupFlag = tcKeyReq->getDistributionGroupFlag(Treqinfo);
Uint8 TDistrGroupTypeFlag = tcKeyReq->getDistributionGroupTypeFlag(Treqinfo);
Uint8 TDistrKeyFlag = tcKeyReq->getDistributionKeyFlag(Treqinfo);
Uint8 TexecuteFlag = TexecFlag;
regCachePtr->opSimple = TSimpleFlag;
regCachePtr->opExec = TInterpretedFlag;
regTcPtr->dirtyOp = TDirtyFlag;
regCachePtr->distributionGroupIndicator = TDistrGroupFlag;
regCachePtr->distributionGroupType = TDistrGroupTypeFlag;
regCachePtr->distributionKeyIndicator = TDistrKeyFlag;
regCachePtr->distributionKeyIndicator = TDistrKeyFlag;
//-------------------------------------------------------------
// The next step is to read the upto three conditional words.
@@ -2686,7 +2669,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint32* TOptionalDataPtr = (Uint32*)&tcKeyReq->scanInfo;
{
Uint32 TDistrGHIndex = tcKeyReq->getScanIndFlag(Treqinfo);
Uint32 TDistrKeyIndex = TDistrGHIndex + TDistrGroupFlag;
Uint32 TDistrKeyIndex = TDistrGHIndex;
Uint32 TscanNode = tcKeyReq->getTakeOverScanNode(TOptionalDataPtr[0]);
Uint32 TscanInfo = tcKeyReq->getTakeOverScanInfo(TOptionalDataPtr[0]);
@@ -2695,8 +2678,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
regCachePtr->scanNode = TscanNode;
regCachePtr->scanInfo = TscanInfo;
regCachePtr->distributionGroup = TOptionalDataPtr[TDistrGHIndex];
regCachePtr->distributionKeySize = TOptionalDataPtr[TDistrKeyIndex];
regCachePtr->distributionKey = TOptionalDataPtr[TDistrKeyIndex];
TkeyIndex = TDistrKeyIndex + TDistrKeyFlag;
}
@@ -2957,7 +2939,7 @@ void Dbtc::tckeyreq050Lab(Signal* signal)
tnoOfBackup = tnodeinfo & 3;
tnoOfStandby = (tnodeinfo >> 8) & 3;
regCachePtr->distributionKey = (tnodeinfo >> 16) & 255;
regCachePtr->fragmentDistributionKey = (tnodeinfo >> 16) & 255;
if (Toperation == ZREAD) {
if (Tdirty == 1) {
jam();
@@ -3127,7 +3109,7 @@ void Dbtc::sendlqhkeyreq(Signal* signal,
/* ---------------------------------------------------------------------- */
// Bit16 == 0 since StoredProcedures are not yet supported.
/* ---------------------------------------------------------------------- */
LqhKeyReq::setDistributionKey(tslrAttrLen, regCachePtr->distributionKey);
LqhKeyReq::setDistributionKey(tslrAttrLen, regCachePtr->fragmentDistributionKey);
LqhKeyReq::setScanTakeOverFlag(tslrAttrLen, regCachePtr->scanTakeOverInd);
Tdata10 = 0;
@@ -11060,7 +11042,7 @@ void Dbtc::execTCINDXREQ(Signal* signal)
{
jamEntry();
TcIndxReq * const tcIndxReq = (TcIndxReq *)signal->getDataPtr();
TcKeyReq * const tcIndxReq = (TcKeyReq *)signal->getDataPtr();
const UintR TapiIndex = tcIndxReq->apiConnectPtr;
Uint32 tcIndxRequestInfo = tcIndxReq->requestInfo;
Uint32 startFlag = tcIndxReq->getStartFlag(tcIndxRequestInfo);
@@ -11111,7 +11093,7 @@ void Dbtc::execTCINDXREQ(Signal* signal)
// If operation is readTupleExclusive or updateTuple then read index
// table with exclusive lock
Uint32 indexLength = TcIndxReq::getIndexLength(tcIndxRequestInfo);
Uint32 indexLength = TcKeyReq::getKeyLength(tcIndxRequestInfo);
Uint32 attrLength = tcIndxReq->attrLen;
indexOp->expectedKeyInfo = indexLength;
Uint32 includedIndexLength = MIN(indexLength, indexBufSize);
@@ -11524,7 +11506,7 @@ void Dbtc::execTCKEYREF(Signal* signal)
// Send TCINDXREF
jam();
TcIndxReq * const tcIndxReq = &indexOp->tcIndxReq;
TcKeyReq * const tcIndxReq = &indexOp->tcIndxReq;
TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend();
ndbassert(regApiPtr->noIndexOp);
@@ -11719,7 +11701,7 @@ void Dbtc::readIndexTable(Signal* signal,
(Operation_t)TcKeyReq::getOperationType(tcKeyRequestInfo);
// Find index table
if ((indexData = c_theIndexes.getPtr(indexOp->tcIndxReq.indexId)) == NULL) {
if ((indexData = c_theIndexes.getPtr(indexOp->tcIndxReq.tableId)) == NULL) {
jam();
// Failed to find index record
TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend();
@@ -11736,7 +11718,7 @@ void Dbtc::readIndexTable(Signal* signal,
tcKeyReq->transId2 = transId2;
tcKeyReq->tableId = indexData->indexId;
tcKeyLength += MIN(keyLength, keyBufSize);
tcKeyReq->tableSchemaVersion = indexOp->tcIndxReq.indexSchemaVersion;
tcKeyReq->tableSchemaVersion = indexOp->tcIndxReq.tableSchemaVersion;
TcKeyReq::setOperationType(tcKeyRequestInfo,
opType == ZREAD ? ZREAD : ZREAD_EX);
TcKeyReq::setAIInTcKeyReq(tcKeyRequestInfo, 1); // Allways send one AttrInfo
@@ -11828,7 +11810,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
Uint32 keyBufSize = 8; // Maximum for key in TCKEYREQ
Uint32 attrBufSize = 5;
Uint32 dataPos = 0;
TcIndxReq * const tcIndxReq = &indexOp->tcIndxReq;
TcKeyReq * const tcIndxReq = &indexOp->tcIndxReq;
TcKeyReq * const tcKeyReq = (TcKeyReq *)signal->getDataPtrSend();
Uint32 * dataPtr = &tcKeyReq->scanInfo;
Uint32 tcKeyLength = TcKeyReq::StaticLength;
@@ -11839,7 +11821,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
bool moreKeyData = indexOp->transIdAI.first(aiIter);
// Find index table
if ((indexData = c_theIndexes.getPtr(tcIndxReq->indexId)) == NULL) {
if ((indexData = c_theIndexes.getPtr(tcIndxReq->tableId)) == NULL) {
jam();
// Failed to find index record
TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend();

View File

@@ -449,7 +449,7 @@ private:
State m_state;
DictTabInfo::TableType m_tableType;
Uint32 m_tableId;
Uint16 m_fragOff; // offset for duplicate fragId bits
Uint16 unused;
Uint16 m_numFrags;
Uint32 m_fragId[MaxIndexFragments];
Uint32 m_fragPtrI[MaxIndexFragments];
@@ -475,7 +475,7 @@ private:
struct Frag {
Uint32 m_tableId; // copy from index level
Uint32 m_indexId;
Uint16 m_fragOff;
Uint16 unused;
Uint16 m_fragId;
Uint32 m_descPage; // copy from index level
Uint16 m_descOff;
@@ -1072,7 +1072,6 @@ inline
Dbtux::Frag::Frag(ArrayPool<ScanOp>& scanOpPool) :
m_tableId(RNIL),
m_indexId(RNIL),
m_fragOff(ZNIL),
m_fragId(ZNIL),
m_descPage(RNIL),
m_descOff(0),

View File

@@ -74,7 +74,6 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
new (fragPtr.p) Frag(c_scanOpPool);
fragPtr.p->m_tableId = req->primaryTableId;
fragPtr.p->m_indexId = req->tableId;
fragPtr.p->m_fragOff = req->fragOff;
fragPtr.p->m_fragId = req->fragId;
fragPtr.p->m_numAttrs = req->noOfAttr;
fragPtr.p->m_storeNullKey = true; // not yet configurable
@@ -102,7 +101,6 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
indexPtr.p->m_state = Index::Defining;
indexPtr.p->m_tableType = (DictTabInfo::TableType)req->tableType;
indexPtr.p->m_tableId = req->primaryTableId;
indexPtr.p->m_fragOff = req->fragOff;
indexPtr.p->m_numAttrs = req->noOfAttr;
indexPtr.p->m_storeNullKey = true; // not yet configurable
// allocate attribute descriptors
@@ -118,7 +116,6 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
indexPtr.p->m_state == Index::Defining &&
indexPtr.p->m_tableType == (DictTabInfo::TableType)req->tableType &&
indexPtr.p->m_tableId == req->primaryTableId &&
indexPtr.p->m_fragOff == req->fragOff &&
indexPtr.p->m_numAttrs == req->noOfAttr);
}
// copy metadata address to each fragment

View File

@@ -213,7 +213,7 @@ NdbApiSignal::setSignal(int aNdbSignalType)
theTrace = TestOrd::TraceAPI;
theReceiversBlockNumber = DBTC;
theVerId_signalNumber = GSN_TCINDXREQ;
theLength = TcIndxReq::SignalLength;
theLength = TcKeyReq::SignalLength;
}
break;

View File

@@ -176,16 +176,6 @@ NdbDictionary::Column::getPrimaryKey() const {
return m_impl.m_pk;
}
void
NdbDictionary::Column::setTupleKey(bool val){
m_impl.m_tupleKey = val;
}
bool
NdbDictionary::Column::getTupleKey() const {
return m_impl.m_tupleKey;
}
void
NdbDictionary::Column::setDistributionKey(bool val){
m_impl.m_distributionKey = val;
@@ -196,32 +186,6 @@ NdbDictionary::Column::getDistributionKey() const{
return m_impl.m_distributionKey;
}
void
NdbDictionary::Column::setDistributionGroup(bool val, int bits){
m_impl.m_distributionGroup = val;
m_impl.m_distributionGroupBits = bits;
}
bool
NdbDictionary::Column::getDistributionGroup() const {
return m_impl.m_distributionGroup;
}
int
NdbDictionary::Column::getDistributionGroupBits() const{
return m_impl.m_distributionGroupBits;
}
void
NdbDictionary::Column::setIndexOnlyStorage(bool val){
m_impl.m_indexOnly = val;
}
bool
NdbDictionary::Column::getIndexOnlyStorage() const {
return m_impl.m_indexOnly;
}
const NdbDictionary::Table *
NdbDictionary::Column::getBlobTable() const {
NdbTableImpl * t = m_impl.m_blobTable;

View File

@@ -69,12 +69,8 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col)
m_scale = col.m_scale;
m_length = col.m_length;
m_pk = col.m_pk;
m_tupleKey = col.m_tupleKey;
m_distributionKey = col.m_distributionKey;
m_distributionGroup = col.m_distributionGroup;
m_distributionGroupBits = col.m_distributionGroupBits;
m_nullable = col.m_nullable;
m_indexOnly = col.m_indexOnly;
m_autoIncrement = col.m_autoIncrement;
m_autoIncrementInitialValue = col.m_autoIncrementInitialValue;
m_defaultValue = col.m_defaultValue;
@@ -154,11 +150,7 @@ NdbColumnImpl::init(Type t)
}
m_pk = false;
m_nullable = false;
m_tupleKey = false;
m_indexOnly = false;
m_distributionKey = false;
m_distributionGroup = false;
m_distributionGroupBits = 8;
m_keyInfoPos = 0;
// next 2 are set at run time
m_attrSize = 0;
@@ -188,22 +180,9 @@ NdbColumnImpl::equal(const NdbColumnImpl& col) const
return false;
}
if(m_pk){
if(m_tupleKey != col.m_tupleKey){
return false;
}
if(m_indexOnly != col.m_indexOnly){
return false;
}
if(m_distributionKey != col.m_distributionKey){
return false;
}
if(m_distributionGroup != col.m_distributionGroup){
return false;
}
if(m_distributionGroup &&
(m_distributionGroupBits != col.m_distributionGroupBits)){
return false;
}
}
if (m_precision != col.m_precision ||
m_scale != col.m_scale ||
@@ -1287,12 +1266,8 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
col->m_arraySize = attrDesc.AttributeArraySize;
col->m_pk = attrDesc.AttributeKeyFlag;
col->m_tupleKey = 0;
col->m_distributionKey = attrDesc.AttributeDKey;
col->m_distributionGroup = attrDesc.AttributeDGroup;
col->m_distributionGroupBits = 16;
col->m_nullable = attrDesc.AttributeNullableFlag;
col->m_indexOnly = (attrDesc.AttributeStoredInd ? false : true);
col->m_autoIncrement = (attrDesc.AttributeAutoIncrement ? true : false);
col->m_autoIncrementInitialValue = ~0;
col->m_defaultValue.assign(attrDesc.AttributeDefaultValue);
@@ -1528,11 +1503,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
BaseString::snprintf(tmpAttr.AttributeName, sizeof(tmpAttr.AttributeName),
col->m_name.c_str());
tmpAttr.AttributeId = i;
tmpAttr.AttributeKeyFlag = col->m_pk || col->m_tupleKey;
tmpAttr.AttributeKeyFlag = col->m_pk;
tmpAttr.AttributeNullableFlag = col->m_nullable;
tmpAttr.AttributeStoredInd = (col->m_indexOnly ? 0 : 1);
tmpAttr.AttributeStoredInd = 1;
tmpAttr.AttributeDKey = col->m_distributionKey;
tmpAttr.AttributeDGroup = col->m_distributionGroup;
tmpAttr.AttributeDGroup = 0;
tmpAttr.AttributeExtType =
getKernelConstant(col->m_type,
@@ -2030,10 +2005,6 @@ NdbDictInterface::createIndex(Ndb & ndb,
// Copy column definition
*impl.m_columns[i] = *col;
if(col->m_pk && col->m_indexOnly){
m_error.code = 4245;
return -1;
}
// index key type check
if (it == DictTabInfo::UniqueHashIndex &&
! NdbSqlUtil::usable_in_hash_index(col->m_type, col->m_cs) ||

View File

@@ -63,12 +63,8 @@ public:
CHARSET_INFO * m_cs; // not const in MySQL
bool m_pk;
bool m_tupleKey;
bool m_distributionKey;
bool m_distributionGroup;
int m_distributionGroupBits;
bool m_nullable;
bool m_indexOnly;
bool m_autoIncrement;
Uint64 m_autoIncrementInitialValue;
BaseString m_defaultValue;

View File

@@ -78,10 +78,10 @@ NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
for (int j=0; j<3; j++)
m_theIndexDefined[i][j] = false;
TcIndxReq * const tcIndxReq = CAST_PTR(TcIndxReq, theTCREQ->getDataPtrSend());
tcIndxReq->scanInfo = 0;
theKEYINFOptr = &tcIndxReq->keyInfo[0];
theATTRINFOptr = &tcIndxReq->attrInfo[0];
TcKeyReq * tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());
tcKeyReq->scanInfo = 0;
theKEYINFOptr = &tcKeyReq->keyInfo[0];
theATTRINFOptr = &tcKeyReq->attrInfo[0];
return 0;
}
@@ -313,33 +313,13 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
}//if
#endif
int tDistrKey = tAttrInfo->m_distributionKey;
int tDistrGroup = tAttrInfo->m_distributionGroup;
OperationType tOpType = theOperationType;
if ((tDistrKey != 1) && (tDistrGroup != 1)) {
if ((tDistrKey != 1)) {
;
} else if (tDistrKey == 1) {
theDistrKeySize += totalSizeInWords;
theDistrKeyIndicator = 1;
} else {
Uint32 TsizeInBytes = sizeInBytes;
Uint32 TbyteOrderFix = 0;
char* TcharByteOrderFix = (char*)&TbyteOrderFix;
if (tAttrInfo->m_distributionGroupBits == 8) {
char tFirstChar = aValue[TsizeInBytes - 2];
char tSecondChar = aValue[TsizeInBytes - 2];
TcharByteOrderFix[0] = tFirstChar;
TcharByteOrderFix[1] = tSecondChar;
TcharByteOrderFix[2] = 0x30;
TcharByteOrderFix[3] = 0x30;
theDistrGroupType = 0;
} else {
TbyteOrderFix = ((aValue[TsizeInBytes - 2] - 0x30) * 10)
+ (aValue[TsizeInBytes - 1] - 0x30);
theDistrGroupType = 1;
}//if
theDistributionGroup = TbyteOrderFix;
theDistrGroupIndicator = 1;
}//if
/** TODO DISTKEY */
theDistrKeyIndicator = 1;
}
/**************************************************************************
* If the operation is an insert request and the attribute is stored then
* we also set the value in the stored part through putting the
@@ -347,29 +327,27 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
*************************************************************************/
if ((tOpType == InsertRequest) ||
(tOpType == WriteRequest)) {
if (!tAttrInfo->m_indexOnly){
// invalid data can crash kernel
if (cs != NULL &&
(*cs->cset->well_formed_len)(cs,
aValueToWrite,
aValueToWrite + sizeInBytes,
sizeInBytes) != sizeInBytes)
goto equal_error4;
Uint32 ahValue;
Uint32 sz = totalSizeInWords;
AttributeHeader::init(&ahValue, tAttrId, sz);
insertATTRINFO( ahValue );
insertATTRINFOloop((Uint32*)aValueToWrite, sizeInWords);
if (bitsInLastWord != 0) {
tData = *(Uint32*)(aValueToWrite + (sizeInWords << 2));
tData = convertEndian(tData);
tData = tData & ((1 << bitsInLastWord) - 1);
tData = convertEndian(tData);
insertATTRINFO( tData );
}//if
// invalid data can crash kernel
if (cs != NULL &&
(*cs->cset->well_formed_len)(cs,
aValueToWrite,
aValueToWrite + sizeInBytes,
sizeInBytes) != sizeInBytes)
goto equal_error4;
Uint32 ahValue;
Uint32 sz = totalSizeInWords;
AttributeHeader::init(&ahValue, tAttrId, sz);
insertATTRINFO( ahValue );
insertATTRINFOloop((Uint32*)aValueToWrite, sizeInWords);
if (bitsInLastWord != 0) {
tData = *(Uint32*)(aValueToWrite + (sizeInWords << 2));
tData = convertEndian(tData);
tData = tData & ((1 << bitsInLastWord) - 1);
tData = convertEndian(tData);
insertATTRINFO( tData );
}//if
}//if
/**************************************************************************
* Store the Key information in the TCINDXREQ and INDXKEYINFO signals.
*************************************************************************/
@@ -468,7 +446,7 @@ int NdbIndexOperation::executeCursor(int aProcessorId)
void
NdbIndexOperation::setLastFlag(NdbApiSignal* signal, Uint32 lastFlag)
{
TcIndxReq * const req = CAST_PTR(TcIndxReq, signal->getDataPtrSend());
TcKeyReq * const req = CAST_PTR(TcKeyReq, signal->getDataPtrSend());
TcKeyReq::setExecuteFlag(req->requestInfo, lastFlag);
}
@@ -512,18 +490,18 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
// We start by filling in the first 8 unconditional words of the
// TCINDXREQ signal.
//-------------------------------------------------------------
TcIndxReq * const tcIndxReq =
CAST_PTR(TcIndxReq, theTCREQ->getDataPtrSend());
TcKeyReq * tcKeyReq =
CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());
Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len;
Uint32 tIndexId = m_theIndex->m_indexId;
Uint32 tSchemaVersion = m_theIndex->m_version;
tcIndxReq->apiConnectPtr = aTC_ConnectPtr;
tcIndxReq->senderData = ptr2int();
tcIndxReq->attrLen = tTotalCurrAI_Len;
tcIndxReq->indexId = tIndexId;
tcIndxReq->indexSchemaVersion = tSchemaVersion;
tcKeyReq->apiConnectPtr = aTC_ConnectPtr;
tcKeyReq->senderData = ptr2int();
tcKeyReq->attrLen = tTotalCurrAI_Len;
tcKeyReq->tableId = tIndexId;
tcKeyReq->tableSchemaVersion = tSchemaVersion;
tTransId1 = (Uint32) aTransactionId;
tTransId2 = (Uint32) (aTransactionId >> 32);
@@ -551,59 +529,53 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
Uint8 tSimpleState = tReadInd & tSimpleAlt;
//theNdbCon->theSimpleState = tSimpleState;
tcIndxReq->transId1 = tTransId1;
tcIndxReq->transId2 = tTransId2;
tcKeyReq->transId1 = tTransId1;
tcKeyReq->transId2 = tTransId2;
tReqInfo = 0;
if (tTotalCurrAI_Len <= TcIndxReq::MaxAttrInfo) {
tcIndxReq->setAIInTcIndxReq(tReqInfo, tTotalCurrAI_Len);
if (tTotalCurrAI_Len <= TcKeyReq::MaxAttrInfo) {
tcKeyReq->setAIInTcKeyReq(tReqInfo, tTotalCurrAI_Len);
} else {
tcIndxReq->setAIInTcIndxReq(tReqInfo, TcIndxReq::MaxAttrInfo);
tcKeyReq->setAIInTcKeyReq(tReqInfo, TcKeyReq::MaxAttrInfo);
}//if
tcIndxReq->setSimpleFlag(tReqInfo, tSimpleIndicator);
tcIndxReq->setCommitFlag(tReqInfo, tCommitIndicator);
tcIndxReq->setStartFlag(tReqInfo, tStartIndicator);
tcKeyReq->setSimpleFlag(tReqInfo, tSimpleIndicator);
tcKeyReq->setCommitFlag(tReqInfo, tCommitIndicator);
tcKeyReq->setStartFlag(tReqInfo, tStartIndicator);
const Uint8 tInterpretIndicator = theInterpretIndicator;
tcIndxReq->setInterpretedFlag(tReqInfo, tInterpretIndicator);
tcKeyReq->setInterpretedFlag(tReqInfo, tInterpretIndicator);
Uint8 tDirtyIndicator = theDirtyIndicator;
OperationType tOperationType = theOperationType;
Uint32 tIndexLen = m_theIndexLen;
Uint8 abortOption = theNdbCon->m_abortOption;
tcIndxReq->setDirtyFlag(tReqInfo, tDirtyIndicator);
tcIndxReq->setOperationType(tReqInfo, tOperationType);
tcIndxReq->setIndexLength(tReqInfo, tIndexLen);
tcIndxReq->setCommitType(tReqInfo, abortOption);
tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator);
tcKeyReq->setOperationType(tReqInfo, tOperationType);
tcKeyReq->setKeyLength(tReqInfo, tIndexLen);
tcKeyReq->setAbortOption(tReqInfo, abortOption);
Uint8 tDistrKeyIndicator = theDistrKeyIndicator;
Uint8 tDistrGroupIndicator = theDistrGroupIndicator;
Uint8 tDistrGroupType = theDistrGroupType;
Uint8 tScanIndicator = theScanInfo & 1;
tcIndxReq->setDistributionGroupFlag(tReqInfo, tDistrGroupIndicator);
tcIndxReq->setDistributionGroupTypeFlag(tReqInfo, tDistrGroupType);
tcIndxReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator);
tcIndxReq->setScanIndFlag(tReqInfo, tScanIndicator);
tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator);
tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator);
tcIndxReq->requestInfo = tReqInfo;
tcKeyReq->requestInfo = tReqInfo;
//-------------------------------------------------------------
// The next step is to fill in the upto three conditional words.
//-------------------------------------------------------------
Uint32* tOptionalDataPtr = &tcIndxReq->scanInfo;
Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo;
Uint32 tDistrGHIndex = tScanIndicator;
Uint32 tDistrKeyIndex = tDistrGHIndex + tDistrGroupIndicator;
Uint32 tDistrKeyIndex = tDistrGHIndex;
Uint32 tScanInfo = theScanInfo;
Uint32 tDistributionGroup = theDistributionGroup;
Uint32 tDistrKeySize = theDistrKeySize;
Uint32 tDistrKey = theDistributionKey;
tOptionalDataPtr[0] = tScanInfo;
tOptionalDataPtr[tDistrGHIndex] = tDistributionGroup;
tOptionalDataPtr[tDistrKeyIndex] = tDistrKeySize;
tOptionalDataPtr[tDistrKeyIndex] = tDistrKey;
//-------------------------------------------------------------
// The next is step is to compress the key data part of the
@@ -611,10 +583,10 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
//-------------------------------------------------------------
Uint32 tKeyIndex = tDistrKeyIndex + tDistrKeyIndicator;
Uint32* tKeyDataPtr = &tOptionalDataPtr[tKeyIndex];
Uint32 Tdata1 = tcIndxReq->keyInfo[0];
Uint32 Tdata2 = tcIndxReq->keyInfo[1];
Uint32 Tdata3 = tcIndxReq->keyInfo[2];
Uint32 Tdata4 = tcIndxReq->keyInfo[3];
Uint32 Tdata1 = tcKeyReq->keyInfo[0];
Uint32 Tdata2 = tcKeyReq->keyInfo[1];
Uint32 Tdata3 = tcKeyReq->keyInfo[2];
Uint32 Tdata4 = tcKeyReq->keyInfo[3];
Uint32 Tdata5;
tKeyDataPtr[0] = Tdata1;
@@ -622,10 +594,10 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
tKeyDataPtr[2] = Tdata3;
tKeyDataPtr[3] = Tdata4;
if (tIndexLen > 4) {
Tdata1 = tcIndxReq->keyInfo[4];
Tdata2 = tcIndxReq->keyInfo[5];
Tdata3 = tcIndxReq->keyInfo[6];
Tdata4 = tcIndxReq->keyInfo[7];
Tdata1 = tcKeyReq->keyInfo[4];
Tdata2 = tcKeyReq->keyInfo[5];
Tdata3 = tcKeyReq->keyInfo[6];
Tdata4 = tcKeyReq->keyInfo[7];
tKeyDataPtr[4] = Tdata1;
tKeyDataPtr[5] = Tdata2;
@@ -639,12 +611,12 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
//-------------------------------------------------------------
Uint32 tAttrInfoIndex;
if (tIndexLen > TcIndxReq::MaxKeyInfo) {
if (tIndexLen > TcKeyReq::MaxKeyInfo) {
/**
* Set transid and TC connect ptr in the INDXKEYINFO signals
*/
NdbApiSignal* tSignal = theFirstKEYINFO;
Uint32 remainingKey = tIndexLen - TcIndxReq::MaxKeyInfo;
Uint32 remainingKey = tIndexLen - TcKeyReq::MaxKeyInfo;
do {
Uint32* tSigDataPtr = tSignal->getDataPtrSend();
@@ -665,7 +637,7 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
}
tSignal = tnextSignal;
} while (tSignal != NULL);
tAttrInfoIndex = tKeyIndex + TcIndxReq::MaxKeyInfo;
tAttrInfoIndex = tKeyIndex + TcKeyReq::MaxKeyInfo;
} else {
tAttrInfoIndex = tKeyIndex + tIndexLen;
}//if
@@ -675,14 +647,14 @@ NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId)
// above.
//-------------------------------------------------------------
Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex];
Tdata1 = tcIndxReq->attrInfo[0];
Tdata2 = tcIndxReq->attrInfo[1];
Tdata3 = tcIndxReq->attrInfo[2];
Tdata4 = tcIndxReq->attrInfo[3];
Tdata5 = tcIndxReq->attrInfo[4];
Tdata1 = tcKeyReq->attrInfo[0];
Tdata2 = tcKeyReq->attrInfo[1];
Tdata3 = tcKeyReq->attrInfo[2];
Tdata4 = tcKeyReq->attrInfo[3];
Tdata5 = tcKeyReq->attrInfo[4];
theTCREQ->setLength(tcIndxReq->getAIInTcIndxReq(tReqInfo) +
tAttrInfoIndex + TcIndxReq::StaticLength);
theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) +
tAttrInfoIndex + TcKeyReq::StaticLength);
tAIDataPtr[0] = Tdata1;
tAIDataPtr[1] = Tdata2;
tAIDataPtr[2] = Tdata3;

View File

@@ -73,8 +73,6 @@ NdbOperation::NdbOperation(Ndb* aNdb) :
theStatus(Init),
theMagicNumber(0xFE11D0),
theScanInfo(0),
theDistrKeySize(0),
theDistributionGroup(0),
m_tcReqGSN(GSN_TCKEYREQ),
m_keyInfoGSN(GSN_KEYINFO),
m_attrInfoGSN(GSN_ATTRINFO),
@@ -150,8 +148,6 @@ NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){
theTupKeyLen = 0;
theNoOfTupKeyDefined = 0;
theDistrKeySize = 0;
theDistributionGroup = 0;
theTotalCurrAI_Len = 0;
theAI_LenInCurrAI = 0;
@@ -160,8 +156,6 @@ NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){
theSimpleIndicator = 0;
theDirtyIndicator = 0;
theInterpretIndicator = 0;
theDistrGroupIndicator= 0;
theDistrGroupType = 0;
theDistrKeyIndicator = 0;
theScanInfo = 0;
theTotalNrOfKeyWordInSignal = 8;

View File

@@ -350,7 +350,6 @@ NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue)
{
NdbRecAttr* tRecAttr;
if ((tAttrInfo != NULL) &&
(!tAttrInfo->m_indexOnly) &&
(theStatus != Init)){
if (theStatus != GetValue) {
if (theInterpretIndicator == 1) {
@@ -398,10 +397,6 @@ NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue)
setErrorCodeAbort(4004);
return NULL;
}//if
if (tAttrInfo->m_indexOnly){
setErrorCodeAbort(4208);
return NULL;
}//if
}//if
setErrorCodeAbort(4200);
return NULL;

View File

@@ -202,12 +202,8 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId)
tcKeyReq->setAbortOption(tReqInfo, abortOption);
Uint8 tDistrKeyIndicator = theDistrKeyIndicator;
Uint8 tDistrGroupIndicator = theDistrGroupIndicator;
Uint8 tDistrGroupType = theDistrGroupType;
Uint8 tScanIndicator = theScanInfo & 1;
tcKeyReq->setDistributionGroupFlag(tReqInfo, tDistrGroupIndicator);
tcKeyReq->setDistributionGroupTypeFlag(tReqInfo, tDistrGroupType);
tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator);
tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator);
@@ -218,15 +214,13 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId)
//-------------------------------------------------------------
Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo;
Uint32 tDistrGHIndex = tScanIndicator;
Uint32 tDistrKeyIndex = tDistrGHIndex + tDistrGroupIndicator;
Uint32 tDistrKeyIndex = tDistrGHIndex;
Uint32 tScanInfo = theScanInfo;
Uint32 tDistributionGroup = theDistributionGroup;
Uint32 tDistrKeySize = theDistrKeySize;
Uint32 tDistrKey = theDistributionKey;
tOptionalDataPtr[0] = tScanInfo;
tOptionalDataPtr[tDistrGHIndex] = tDistributionGroup;
tOptionalDataPtr[tDistrKeyIndex] = tDistrKeySize;
tOptionalDataPtr[tDistrKeyIndex] = tDistrKey;
//-------------------------------------------------------------
// The next is step is to compress the key data part of the

View File

@@ -191,33 +191,13 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
#endif
int tDistrKey = tAttrInfo->m_distributionKey;
int tDistrGroup = tAttrInfo->m_distributionGroup;
OperationType tOpType = theOperationType;
if ((tDistrKey != 1) && (tDistrGroup != 1)) {
if ((tDistrKey != 1)) {
;
} else if (tDistrKey == 1) {
theDistrKeySize += totalSizeInWords;
theDistrKeyIndicator = 1;
} else {
Uint32 TsizeInBytes = sizeInBytes;
Uint32 TbyteOrderFix = 0;
char* TcharByteOrderFix = (char*)&TbyteOrderFix;
if (tAttrInfo->m_distributionGroupBits == 8) {
char tFirstChar = aValue[TsizeInBytes - 2];
char tSecondChar = aValue[TsizeInBytes - 2];
TcharByteOrderFix[0] = tFirstChar;
TcharByteOrderFix[1] = tSecondChar;
TcharByteOrderFix[2] = 0x30;
TcharByteOrderFix[3] = 0x30;
theDistrGroupType = 0;
} else {
TbyteOrderFix = ((aValue[TsizeInBytes - 2] - 0x30) * 10)
+ (aValue[TsizeInBytes - 1] - 0x30);
theDistrGroupType = 1;
}//if
theDistributionGroup = TbyteOrderFix;
theDistrGroupIndicator = 1;
}//if
/** TODO DISTKEY */
theDistrKeyIndicator = 1;
}
/******************************************************************************
* If the operation is an insert request and the attribute is stored then
* we also set the value in the stored part through putting the
@@ -225,26 +205,24 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
*****************************************************************************/
if ((tOpType == InsertRequest) ||
(tOpType == WriteRequest)) {
if (!tAttrInfo->m_indexOnly){
// invalid data can crash kernel
if (cs != NULL &&
(*cs->cset->well_formed_len)(cs,
aValueToWrite,
aValueToWrite + sizeInBytes,
sizeInBytes) != sizeInBytes)
goto equal_error4;
Uint32 ahValue;
const Uint32 sz = totalSizeInWords;
AttributeHeader::init(&ahValue, tAttrId, sz);
insertATTRINFO( ahValue );
insertATTRINFOloop((Uint32*)aValueToWrite, sizeInWords);
if (bitsInLastWord != 0) {
tData = *(Uint32*)(aValueToWrite + (sizeInWords << 2));
tData = convertEndian(tData);
tData = tData & ((1 << bitsInLastWord) - 1);
tData = convertEndian(tData);
insertATTRINFO( tData );
}//if
// invalid data can crash kernel
if (cs != NULL &&
(*cs->cset->well_formed_len)(cs,
aValueToWrite,
aValueToWrite + sizeInBytes,
sizeInBytes) != sizeInBytes)
goto equal_error4;
Uint32 ahValue;
const Uint32 sz = totalSizeInWords;
AttributeHeader::init(&ahValue, tAttrId, sz);
insertATTRINFO( ahValue );
insertATTRINFOloop((Uint32*)aValueToWrite, sizeInWords);
if (bitsInLastWord != 0) {
tData = *(Uint32*)(aValueToWrite + (sizeInWords << 2));
tData = convertEndian(tData);
tData = tData & ((1 << bitsInLastWord) - 1);
tData = convertEndian(tData);
insertATTRINFO( tData );
}//if
}//if

View File

@@ -456,11 +456,6 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
int check = 0;
const NdbDictionary::Column* attr = tab.getColumn(attrId);
if (attr->getTupleKey()){
// Don't set values for TupleId PKs
return check;
}
switch (attr->getType()){
case NdbDictionary::Column::Char:
case NdbDictionary::Column::Varchar:

View File

@@ -158,7 +158,6 @@ NdbSchemaOp::createAttribute( const char* anAttrName,
col.setPrimaryKey(false);
col.setDistributionKey(aDistributionKeyFlag);
col.setDistributionGroup(aDistributionGroupFlag,aDistributionGroupNoOfBits);
col.setAutoIncrement(aAutoIncrement);
col.setDefaultValue(aDefaultValue != 0 ? aDefaultValue : "");