mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
tux - remove obsolete signals tux->tup
This commit is contained in:
parent
fcb569f257
commit
43efb3cce8
10 changed files with 5 additions and 593 deletions
|
@ -897,12 +897,9 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
|
|||
#define GSN_TUX_MAINT_CONF 678
|
||||
#define GSN_TUX_MAINT_REF 679
|
||||
|
||||
/*
|
||||
* TUP access
|
||||
*/
|
||||
#define GSN_TUP_READ_ATTRS 680
|
||||
#define GSN_TUP_QUERY_TH 712
|
||||
#define GSN_TUP_STORE_TH 681
|
||||
// not used 680
|
||||
// not used 712
|
||||
// not used 681
|
||||
|
||||
/**
|
||||
* from mgmtsrvr to NDBCNTR
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
/* Copyright (C) 2003 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef TUP_ACCESS_HPP
|
||||
#define TUP_ACCESS_HPP
|
||||
|
||||
#include "SignalData.hpp"
|
||||
|
||||
/*
|
||||
* Direct signals used by ACC and TUX to access the TUP block in the
|
||||
* same thread.
|
||||
*
|
||||
* NOTE: Caller must set errorCode to RNIL. Signal printer uses this to
|
||||
* distinguish between input and output (no better way exists).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Read attributes from any table.
|
||||
*/
|
||||
class TupReadAttrs {
|
||||
friend class Dbtup;
|
||||
friend class Dbacc;
|
||||
friend class Dbtux;
|
||||
friend bool printTUP_READ_ATTRS(FILE*, const Uint32*, Uint32, Uint16);
|
||||
public:
|
||||
enum Flag {
|
||||
/*
|
||||
* Read primary key attributes. No input attribute ids are
|
||||
* specified. Instead TUP fills in both input and output sections.
|
||||
* Tuple version is not used.
|
||||
*/
|
||||
ReadKeys = (1 << 0)
|
||||
};
|
||||
STATIC_CONST( SignalLength = 10 );
|
||||
private:
|
||||
/*
|
||||
* Error code set by TUP. Zero means no error.
|
||||
*/
|
||||
Uint32 errorCode;
|
||||
/*
|
||||
* Request info contains flags (see Flags above).
|
||||
*/
|
||||
Uint32 requestInfo;
|
||||
/*
|
||||
* Table i-value.
|
||||
*/
|
||||
Uint32 tableId;
|
||||
/*
|
||||
* Fragment is given by logical id within the table or by direct
|
||||
* i-value (faster). Unknown values are given as RNIL. On return TUP
|
||||
* fills in both values.
|
||||
*/
|
||||
Uint32 fragId;
|
||||
Uint32 fragPtrI;
|
||||
/*
|
||||
* Logical address ("local key") of "original" tuple (the latest
|
||||
* version) consisting of logical fragment page id and tuple index
|
||||
* within the page (shifted left by 1).
|
||||
*/
|
||||
Uint32 tupAddr;
|
||||
/*
|
||||
* Version of the tuple to read. Not used if ReadKeys.
|
||||
*/
|
||||
Uint32 tupVersion;
|
||||
/*
|
||||
* Real page id and offset of the "original" tuple. Unknown page is
|
||||
* given as RNIL. On return TUP fills in these.
|
||||
*/
|
||||
Uint32 pageId;
|
||||
Uint32 pageOffset;
|
||||
/*
|
||||
* Shared buffer id. Currently must be 0 which means to use rest of
|
||||
* signal data.
|
||||
*/
|
||||
Uint32 bufferId;
|
||||
/*
|
||||
* Shared buffer 0 starts after signal class. Input is number of
|
||||
* attributes and list of attribute ids in AttributeHeader format.
|
||||
* Output is placed after the input and consists of a list of entries
|
||||
* where each entry has an AttributeHeader followed by words of data.
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
* Query status of tuple version. Used by TUX to decide if a tuple
|
||||
* version found in index tree is visible to the transaction.
|
||||
*/
|
||||
class TupQueryTh {
|
||||
friend class Dbtup;
|
||||
friend class Dbtux;
|
||||
friend bool printTUP_QUERY_TH(FILE*, const Uint32*, Uint32, Uint16);
|
||||
public:
|
||||
enum Flag {
|
||||
};
|
||||
STATIC_CONST( SignalLength = 7 );
|
||||
private:
|
||||
/*
|
||||
TUX wants to check if tuple is visible to the scan query.
|
||||
Input data is tuple address (tableId, fragId, tupAddr, tupVersion),
|
||||
and transaction data so that TUP knows how to deduct if tuple is
|
||||
visible (transId1, transId2, savePointId).
|
||||
returnCode is set in return signal to indicate whether tuple is visible.
|
||||
*/
|
||||
union {
|
||||
Uint32 returnCode; // 1 if tuple visible
|
||||
Uint32 tableId;
|
||||
};
|
||||
Uint32 fragId;
|
||||
Uint32 tupAddr;
|
||||
Uint32 tupVersion;
|
||||
Uint32 transId1;
|
||||
Uint32 transId2;
|
||||
Uint32 savePointId;
|
||||
};
|
||||
|
||||
/*
|
||||
* Operate on entire tuple. Used by TUX where the table has a single
|
||||
* Uint32 array attribute representing an index tree node.
|
||||
*
|
||||
* XXX this signal is no longer used by TUX and can be removed
|
||||
*/
|
||||
class TupStoreTh {
|
||||
friend class Dbtup;
|
||||
friend class Dbtux;
|
||||
friend bool printTUP_STORE_TH(FILE*, const Uint32*, Uint32, Uint16);
|
||||
public:
|
||||
enum OpCode {
|
||||
OpUndefined = 0,
|
||||
OpRead = 1,
|
||||
OpInsert = 2,
|
||||
OpUpdate = 3,
|
||||
OpDelete = 4
|
||||
};
|
||||
STATIC_CONST( SignalLength = 12 );
|
||||
private:
|
||||
/*
|
||||
* These are as in TupReadAttrs (except opCode). Version must be
|
||||
* zero. Ordered index tuple (tree node) has only current version.
|
||||
*/
|
||||
Uint32 errorCode;
|
||||
Uint32 opCode;
|
||||
Uint32 tableId;
|
||||
Uint32 fragId;
|
||||
Uint32 fragPtrI;
|
||||
Uint32 tupAddr;
|
||||
Uint32 tupVersion;
|
||||
Uint32 pageId;
|
||||
Uint32 pageOffset;
|
||||
Uint32 bufferId;
|
||||
/*
|
||||
* Data offset and size in words. Applies to both the buffer and the
|
||||
* tuple. Used e.g. to read only node header.
|
||||
*/
|
||||
Uint32 dataOffset;
|
||||
Uint32 dataSize;
|
||||
/*
|
||||
* Shared buffer 0 starts after signal class.
|
||||
*/
|
||||
};
|
||||
|
||||
#endif
|
|
@ -22,7 +22,7 @@ libsignaldataprint_la_SOURCES = \
|
|||
CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \
|
||||
FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \
|
||||
SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \
|
||||
UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.cpp \
|
||||
UtilLock.cpp TuxMaint.cpp AccLock.cpp \
|
||||
LqhTrans.cpp ReadNodesConf.cpp CntrStart.cpp
|
||||
|
||||
include $(top_srcdir)/ndb/config/common.mk.am
|
||||
|
@ -30,3 +30,4 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
|
|||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
#include <signaldata/CntrStart.hpp>
|
||||
#include <signaldata/ReadNodesConf.hpp>
|
||||
#include <signaldata/TuxMaint.hpp>
|
||||
#include <signaldata/TupAccess.hpp>
|
||||
#include <signaldata/AccLock.hpp>
|
||||
|
||||
bool printCONTINUEB(FILE *, const Uint32 *, Uint32, Uint16);
|
||||
|
@ -249,9 +248,6 @@ SignalDataPrintFunctions[] = {
|
|||
,{ GSN_READ_NODESCONF, printREAD_NODES_CONF }
|
||||
|
||||
,{ GSN_TUX_MAINT_REQ, printTUX_MAINT_REQ }
|
||||
,{ GSN_TUP_READ_ATTRS, printTUP_READ_ATTRS }
|
||||
,{ GSN_TUP_QUERY_TH, printTUP_QUERY_TH }
|
||||
,{ GSN_TUP_STORE_TH, printTUP_STORE_TH }
|
||||
,{ GSN_ACC_LOCKREQ, printACC_LOCKREQ }
|
||||
,{ GSN_LQH_TRANSCONF, printLQH_TRANSCONF }
|
||||
};
|
||||
|
|
|
@ -641,9 +641,6 @@ const GsnName SignalNames [] = {
|
|||
,{ GSN_TUX_MAINT_REQ, "TUX_MAINT_REQ" }
|
||||
,{ GSN_TUX_MAINT_CONF, "TUX_MAINT_CONF" }
|
||||
,{ GSN_TUX_MAINT_REF, "TUX_MAINT_REF" }
|
||||
,{ GSN_TUP_READ_ATTRS, "TUP_READ_ATTRS" }
|
||||
,{ GSN_TUP_QUERY_TH, "TUP_QUERY_TH" }
|
||||
,{ GSN_TUP_STORE_TH, "TUP_STORE_TH" }
|
||||
,{ GSN_TUX_BOUND_INFO, "TUX_BOUND_INFO" }
|
||||
,{ GSN_ACC_LOCKREQ, "ACC_LOCKREQ" }
|
||||
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
/* Copyright (C) 2003 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <signaldata/TupAccess.hpp>
|
||||
#include <SignalLoggerManager.hpp>
|
||||
#include <AttributeHeader.hpp>
|
||||
|
||||
bool
|
||||
printTUP_READ_ATTRS(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
|
||||
{
|
||||
const TupReadAttrs* const sig = (const TupReadAttrs*)theData;
|
||||
if (sig->errorCode == RNIL)
|
||||
fprintf(output, " errorCode=RNIL flags=%x\n", sig->requestInfo);
|
||||
else
|
||||
fprintf(output, " errorCode=%u flags=%x\n", sig->errorCode, sig->requestInfo);
|
||||
fprintf(output, " table: id=%u", sig->tableId);
|
||||
fprintf(output, " fragment: id=%u ptr=0x%x\n", sig->fragId, sig->fragPtrI);
|
||||
fprintf(output, " tuple: addr=0x%x version=%u", sig->tupAddr, sig->tupVersion);
|
||||
fprintf(output, " realPage=0x%x offset=%u\n", sig->pageId, sig->pageOffset);
|
||||
const Uint32* buffer = (const Uint32*)sig + TupReadAttrs::SignalLength;
|
||||
Uint32 attrCount = buffer[0];
|
||||
bool readKeys = (sig->requestInfo & TupReadAttrs::ReadKeys);
|
||||
if (sig->errorCode == RNIL && ! readKeys ||
|
||||
sig->errorCode == 0 && readKeys) {
|
||||
fprintf(output, " input: attrCount=%u\n", attrCount);
|
||||
for (unsigned i = 0; i < attrCount; i++) {
|
||||
AttributeHeader ah(buffer[1 + i]);
|
||||
fprintf(output, " %u: attrId=%u\n", i, ah.getAttributeId());
|
||||
}
|
||||
}
|
||||
if (sig->errorCode == 0) {
|
||||
fprintf(output, " output: attrCount=%u\n", attrCount);
|
||||
Uint32 pos = 1 + attrCount;
|
||||
for (unsigned i = 0; i < attrCount; i++) {
|
||||
AttributeHeader ah(buffer[pos++]);
|
||||
fprintf(output, " %u: attrId=%u dataSize=%u\n", i, ah.getAttributeId(), ah.getDataSize());
|
||||
Uint32 next = pos + ah.getDataSize();
|
||||
Uint32 printpos = 0;
|
||||
while (pos < next) {
|
||||
SignalLoggerManager::printDataWord(output, printpos, buffer[pos]);
|
||||
pos++;
|
||||
}
|
||||
if (ah.getDataSize() > 0)
|
||||
fprintf(output, "\n");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
printTUP_QUERY_TH(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
|
||||
{
|
||||
const TupQueryTh* const sig = (const TupQueryTh*)theData;
|
||||
fprintf(output, "tableId = %u, fragId = %u ", sig->tableId, sig->fragId);
|
||||
fprintf(output, "tuple: addr = 0x%x version = %u\n", sig->tupAddr,
|
||||
sig->tupVersion);
|
||||
fprintf(output, "transId1 = 0x%x, transId2 = 0x%x, savePointId = %u\n",
|
||||
sig->transId1, sig->transId2, sig->savePointId);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
printTUP_STORE_TH(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
|
||||
{
|
||||
const TupStoreTh* const sig = (const TupStoreTh*)theData;
|
||||
if (sig->errorCode == RNIL)
|
||||
fprintf(output, " errorCode=RNIL\n");
|
||||
else
|
||||
fprintf(output, " errorCode=%u\n", sig->errorCode);
|
||||
fprintf(output, " table: id=%u", sig->tableId);
|
||||
fprintf(output, " fragment: id=%u ptr=0x%x\n", sig->fragId, sig->fragPtrI);
|
||||
fprintf(output, " tuple: addr=0x%x", sig->tupAddr);
|
||||
if ((sig->tupAddr & 0x1) == 0) {
|
||||
fprintf(output, " fragPage=0x%x index=%u",
|
||||
sig->tupAddr >> MAX_TUPLES_BITS,
|
||||
(sig->tupAddr & ((1 <<MAX_TUPLES_BITS) - 1)) >> 1);
|
||||
fprintf(output, " realPage=0x%x offset=%u\n", sig->pageId, sig->pageOffset);
|
||||
} else {
|
||||
fprintf(output, " cacheId=%u\n",
|
||||
sig->tupAddr >> 1);
|
||||
}
|
||||
if (sig->tupVersion != 0) {
|
||||
fprintf(output, " version=%u ***invalid***\n", sig->tupVersion);
|
||||
}
|
||||
bool showdata = true;
|
||||
switch (sig->opCode) {
|
||||
case TupStoreTh::OpRead:
|
||||
fprintf(output, " operation=Read\n");
|
||||
showdata = false;
|
||||
break;
|
||||
case TupStoreTh::OpInsert:
|
||||
fprintf(output, " operation=Insert\n");
|
||||
break;
|
||||
case TupStoreTh::OpUpdate:
|
||||
fprintf(output, " operation=Update\n");
|
||||
break;
|
||||
case TupStoreTh::OpDelete:
|
||||
fprintf(output, " operation=Delete\n");
|
||||
showdata = false;
|
||||
break;
|
||||
default:
|
||||
fprintf(output, " operation=%u ***invalid***\n", sig->opCode);
|
||||
break;
|
||||
}
|
||||
fprintf(output, " data: offset=%u size=%u", sig->dataOffset, sig->dataSize);
|
||||
if (! showdata) {
|
||||
fprintf(output, " [not printed]\n");
|
||||
} else {
|
||||
fprintf(output, "\n");
|
||||
const Uint32* buffer = (const Uint32*)sig + TupStoreTh::SignalLength;
|
||||
Uint32 pos = 0;
|
||||
while (pos < sig->dataSize)
|
||||
SignalLoggerManager::printDataWord(output, pos, buffer[sig->dataOffset + pos]);
|
||||
if (sig->dataSize > 0)
|
||||
fprintf(output, "\n");
|
||||
}
|
||||
return true;
|
||||
};
|
|
@ -1068,9 +1068,6 @@ private:
|
|||
void execTUP_WRITELOG_REQ(Signal* signal);
|
||||
|
||||
// Ordered index related
|
||||
void execTUP_READ_ATTRS(Signal* signal);
|
||||
void execTUP_QUERY_TH(Signal* signal);
|
||||
void execTUP_STORE_TH(Signal* signal);
|
||||
void execBUILDINDXREQ(Signal* signal);
|
||||
void buildIndex(Signal* signal, Uint32 buildPtrI);
|
||||
void buildIndexReply(Signal* signal, const BuildIndexRec* buildRec);
|
||||
|
|
|
@ -132,9 +132,6 @@ Dbtup::Dbtup(const class Configuration & conf)
|
|||
addRecSignal(GSN_TUP_WRITELOG_REQ, &Dbtup::execTUP_WRITELOG_REQ);
|
||||
|
||||
// Ordered index related
|
||||
addRecSignal(GSN_TUP_READ_ATTRS, &Dbtup::execTUP_READ_ATTRS);
|
||||
addRecSignal(GSN_TUP_QUERY_TH, &Dbtup::execTUP_QUERY_TH);
|
||||
addRecSignal(GSN_TUP_STORE_TH, &Dbtup::execTUP_STORE_TH);
|
||||
addRecSignal(GSN_BUILDINDXREQ, &Dbtup::execBUILDINDXREQ);
|
||||
|
||||
initData();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <AttributeDescriptor.hpp>
|
||||
#include "AttributeOffset.hpp"
|
||||
#include <AttributeHeader.hpp>
|
||||
#include <signaldata/TupAccess.hpp>
|
||||
#include <signaldata/TuxMaint.hpp>
|
||||
|
||||
#define ljam() { jamLine(28000 + __LINE__); }
|
||||
|
@ -245,272 +244,6 @@ Dbtup::tuxQueryTh(Uint32 fragPtrI, Uint32 tupAddr, Uint32 tupVersion, Uint32 tra
|
|||
return false;
|
||||
}
|
||||
|
||||
// deprecated signal interfaces
|
||||
|
||||
void
|
||||
Dbtup::execTUP_READ_ATTRS(Signal* signal)
|
||||
{
|
||||
ljamEntry();
|
||||
TupReadAttrs* const sig = (TupReadAttrs*)signal->getDataPtrSend();
|
||||
TupReadAttrs reqCopy = *sig;
|
||||
TupReadAttrs* const req = &reqCopy;
|
||||
req->errorCode = 0;
|
||||
// get table
|
||||
TablerecPtr tablePtr;
|
||||
tablePtr.i = req->tableId;
|
||||
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
|
||||
// get fragment
|
||||
FragrecordPtr fragPtr;
|
||||
if (req->fragPtrI == RNIL) {
|
||||
ljam();
|
||||
getFragmentrec(fragPtr, req->fragId, tablePtr.p);
|
||||
ndbrequire(fragPtr.i != RNIL);
|
||||
req->fragPtrI = fragPtr.i;
|
||||
} else {
|
||||
fragPtr.i = req->fragPtrI;
|
||||
ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
|
||||
ndbrequire(req->fragId == fragPtr.p->fragmentId);
|
||||
}
|
||||
// get page
|
||||
PagePtr pagePtr;
|
||||
if (req->pageId == RNIL) {
|
||||
ljam();
|
||||
Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
|
||||
Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
|
||||
ndbrequire((pageIndex & 0x1) == 0);
|
||||
// data returned for original tuple
|
||||
req->pageId = getRealpid(fragPtr.p, fragPageId);
|
||||
req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
|
||||
}
|
||||
pagePtr.i = req->pageId;
|
||||
ptrCheckGuard(pagePtr, cnoOfPage, page);
|
||||
Uint32 pageOffset = req->pageOffset;
|
||||
// search for tuple version if not original
|
||||
if (! (req->requestInfo & TupReadAttrs::ReadKeys) &&
|
||||
pagePtr.p->pageWord[pageOffset + 1] != req->tupVersion) {
|
||||
ljam();
|
||||
OperationrecPtr opPtr;
|
||||
opPtr.i = pagePtr.p->pageWord[pageOffset];
|
||||
Uint32 loopGuard = 0;
|
||||
while (true) {
|
||||
ptrCheckGuard(opPtr, cnoOfOprec, operationrec);
|
||||
if (opPtr.p->realPageIdC != RNIL) {
|
||||
pagePtr.i = opPtr.p->realPageIdC;
|
||||
pageOffset = opPtr.p->pageOffsetC;
|
||||
ptrCheckGuard(pagePtr, cnoOfPage, page);
|
||||
if (pagePtr.p->pageWord[pageOffset + 1] == req->tupVersion) {
|
||||
ljam();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ljam();
|
||||
// next means before in event order
|
||||
opPtr.i = opPtr.p->nextActiveOp;
|
||||
ndbrequire(++loopGuard < (1 << ZTUP_VERSION_BITS));
|
||||
}
|
||||
}
|
||||
// shared buffer
|
||||
Uint32* buffer = (Uint32*)sig + TupReadAttrs::SignalLength;
|
||||
// if request is for keys then we create input section
|
||||
if (req->requestInfo & TupReadAttrs::ReadKeys) {
|
||||
ljam();
|
||||
buffer[0] = tablePtr.p->noOfKeyAttr;
|
||||
const Uint32* keyArray = &tableDescriptor[tablePtr.p->readKeyArray].tabDescr;
|
||||
MEMCOPY_NO_WORDS(&buffer[1], keyArray, tablePtr.p->noOfKeyAttr);
|
||||
}
|
||||
Uint32 inBufLen = buffer[0];
|
||||
Uint32* inBuffer = &buffer[1];
|
||||
Uint32* outBuffer = &buffer[1 + inBufLen];
|
||||
Uint32 maxRead = ZATTR_BUFFER_SIZE;
|
||||
// save globals
|
||||
TablerecPtr tabptr_old = tabptr;
|
||||
FragrecordPtr fragptr_old = fragptr;
|
||||
OperationrecPtr operPtr_old = operPtr;
|
||||
// new globals
|
||||
tabptr = tablePtr;
|
||||
fragptr = fragPtr;
|
||||
operPtr.i = RNIL; // XXX check later
|
||||
operPtr.p = NULL;
|
||||
int ret = readAttributes(pagePtr.p, pageOffset, inBuffer, inBufLen, outBuffer, maxRead);
|
||||
// restore globals
|
||||
tabptr = tabptr_old;
|
||||
fragptr = fragptr_old;
|
||||
operPtr = operPtr_old;
|
||||
// check error
|
||||
if ((Uint32)ret == (Uint32)-1) {
|
||||
ljam();
|
||||
req->errorCode = terrorCode;
|
||||
}
|
||||
// copy back
|
||||
*sig = *req;
|
||||
}
|
||||
|
||||
void
|
||||
Dbtup::execTUP_QUERY_TH(Signal* signal)
|
||||
{
|
||||
ljamEntry();
|
||||
Operationrec tempOp;
|
||||
TupQueryTh* const req = (TupQueryTh*)signal->getDataPtrSend();
|
||||
Uint32 tableId = req->tableId;
|
||||
Uint32 fragId = req->fragId;
|
||||
Uint32 tupAddr = req->tupAddr;
|
||||
Uint32 req_tupVersion = req->tupVersion;
|
||||
Uint32 transid1 = req->transId1;
|
||||
Uint32 transid2 = req->transId2;
|
||||
Uint32 savePointId = req->savePointId;
|
||||
Uint32 ret_result = 0;
|
||||
// get table
|
||||
TablerecPtr tablePtr;
|
||||
tablePtr.i = tableId;
|
||||
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
|
||||
// get fragment
|
||||
FragrecordPtr fragPtr;
|
||||
getFragmentrec(fragPtr, fragId, tablePtr.p);
|
||||
ndbrequire(fragPtr.i != RNIL);
|
||||
// get page
|
||||
PagePtr pagePtr;
|
||||
Uint32 fragPageId = tupAddr >> MAX_TUPLES_BITS;
|
||||
Uint32 pageIndex = tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
|
||||
|
||||
tempOp.fragPageId = fragPageId;
|
||||
tempOp.pageIndex = pageIndex;
|
||||
tempOp.transid1 = transid1;
|
||||
tempOp.transid2 = transid2;
|
||||
tempOp.savePointId = savePointId;
|
||||
tempOp.optype = ZREAD;
|
||||
tempOp.dirtyOp = 1;
|
||||
if (getPage(pagePtr, &tempOp, fragPtr.p, tablePtr.p)) {
|
||||
/*
|
||||
We use the normal getPage which will return the tuple to be used
|
||||
for this transaction and savepoint id. If its tuple version equals
|
||||
the requested then we have a visible tuple otherwise not.
|
||||
*/
|
||||
ljam();
|
||||
Uint32 read_tupVersion = pagePtr.p->pageWord[tempOp.pageOffset + 1];
|
||||
if (read_tupVersion == req_tupVersion) {
|
||||
ljam();
|
||||
ret_result = 1;
|
||||
}
|
||||
}
|
||||
req->returnCode = ret_result;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
Dbtup::execTUP_STORE_TH(Signal* signal)
|
||||
{
|
||||
ljamEntry();
|
||||
TupStoreTh* const sig = (TupStoreTh*)signal->getDataPtrSend();
|
||||
TupStoreTh reqCopy = *sig;
|
||||
TupStoreTh* const req = &reqCopy;
|
||||
req->errorCode = 0;
|
||||
ndbrequire(req->tupVersion == 0);
|
||||
// get table
|
||||
TablerecPtr tablePtr;
|
||||
tablePtr.i = req->tableId;
|
||||
ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
|
||||
// offset to attribute 0
|
||||
Uint32 attrDescIndex = tablePtr.p->tabDescriptor + (0 << ZAD_LOG_SIZE);
|
||||
Uint32 attrDataOffset = AttributeOffset::getOffset(tableDescriptor[attrDescIndex + 1].tabDescr);
|
||||
// get fragment
|
||||
FragrecordPtr fragPtr;
|
||||
if (req->fragPtrI == RNIL) {
|
||||
ljam();
|
||||
getFragmentrec(fragPtr, req->fragId, tablePtr.p);
|
||||
ndbrequire(fragPtr.i != RNIL);
|
||||
req->fragPtrI = fragPtr.i;
|
||||
} else {
|
||||
fragPtr.i = req->fragPtrI;
|
||||
ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
|
||||
ndbrequire(req->fragId == fragPtr.p->fragmentId);
|
||||
}
|
||||
// handle each case
|
||||
switch (req->opCode) {
|
||||
case TupStoreTh::OpRead:
|
||||
ljam();
|
||||
{
|
||||
PagePtr pagePtr;
|
||||
if (req->pageId == RNIL) {
|
||||
ljam();
|
||||
Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
|
||||
Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
|
||||
ndbrequire((pageIndex & 0x1) == 0);
|
||||
req->pageId = getRealpid(fragPtr.p, fragPageId);
|
||||
req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
|
||||
}
|
||||
pagePtr.i = req->pageId;
|
||||
ptrCheckGuard(pagePtr, cnoOfPage, page);
|
||||
Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
|
||||
Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
|
||||
ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
|
||||
memcpy(buffer + req->dataOffset, data + req->dataOffset, req->dataSize << 2);
|
||||
}
|
||||
break;
|
||||
case TupStoreTh::OpInsert:
|
||||
ljam();
|
||||
{
|
||||
PagePtr pagePtr;
|
||||
if (! allocTh(fragPtr.p, tablePtr.p, NORMAL_PAGE, signal, req->pageOffset, pagePtr)) {
|
||||
ljam();
|
||||
req->errorCode = terrorCode;
|
||||
break;
|
||||
}
|
||||
req->pageId = pagePtr.i;
|
||||
Uint32 fragPageId = pagePtr.p->pageWord[ZPAGE_FRAG_PAGE_ID_POS];
|
||||
Uint32 pageIndex = ((req->pageOffset - ZPAGE_HEADER_SIZE) / tablePtr.p->tupheadsize) << 1;
|
||||
req->tupAddr = (fragPageId << MAX_TUPLES_BITS) | pageIndex;
|
||||
ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
|
||||
Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
|
||||
Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
|
||||
memcpy(data + req->dataOffset, buffer + req->dataOffset, req->dataSize << 2);
|
||||
}
|
||||
break;
|
||||
case TupStoreTh::OpUpdate:
|
||||
ljam();
|
||||
{
|
||||
PagePtr pagePtr;
|
||||
if (req->pageId == RNIL) {
|
||||
ljam();
|
||||
Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
|
||||
Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
|
||||
ndbrequire((pageIndex & 0x1) == 0);
|
||||
req->pageId = getRealpid(fragPtr.p, fragPageId);
|
||||
req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
|
||||
}
|
||||
pagePtr.i = req->pageId;
|
||||
ptrCheckGuard(pagePtr, cnoOfPage, page);
|
||||
Uint32* data = &pagePtr.p->pageWord[req->pageOffset] + attrDataOffset;
|
||||
Uint32* buffer = (Uint32*)sig + TupStoreTh::SignalLength;
|
||||
ndbrequire(req->dataOffset + req->dataSize <= tablePtr.p->tupheadsize);
|
||||
memcpy(data + req->dataOffset, buffer + req->dataOffset, req->dataSize << 2);
|
||||
}
|
||||
break;
|
||||
case TupStoreTh::OpDelete:
|
||||
ljam();
|
||||
{
|
||||
PagePtr pagePtr;
|
||||
if (req->pageId == RNIL) {
|
||||
ljam();
|
||||
Uint32 fragPageId = req->tupAddr >> MAX_TUPLES_BITS;
|
||||
Uint32 pageIndex = req->tupAddr & ((1 << MAX_TUPLES_BITS ) - 1);
|
||||
ndbrequire((pageIndex & 0x1) == 0);
|
||||
req->pageId = getRealpid(fragPtr.p, fragPageId);
|
||||
req->pageOffset = ZPAGE_HEADER_SIZE + (pageIndex >> 1) * tablePtr.p->tupheadsize;
|
||||
}
|
||||
pagePtr.i = req->pageId;
|
||||
ptrCheckGuard(pagePtr, cnoOfPage, page);
|
||||
freeTh(fragPtr.p, tablePtr.p, signal, pagePtr.p, req->pageOffset);
|
||||
// null location
|
||||
req->tupAddr = (Uint32)-1;
|
||||
req->pageId = RNIL;
|
||||
req->pageOffset = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// copy back
|
||||
*sig = *req;
|
||||
}
|
||||
|
||||
// ordered index build
|
||||
|
||||
//#define TIME_MEASUREMENT
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <signaldata/AlterIndx.hpp>
|
||||
#include <signaldata/DropTab.hpp>
|
||||
#include <signaldata/TuxMaint.hpp>
|
||||
#include <signaldata/TupAccess.hpp>
|
||||
#include <signaldata/AccScan.hpp>
|
||||
#include <signaldata/TuxBound.hpp>
|
||||
#include <signaldata/NextScan.hpp>
|
||||
|
|
Loading…
Reference in a new issue