mariadb/ndb/include/ndbapi/NdbReceiver.hpp

145 lines
3.5 KiB
C++
Raw Normal View History

/* 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 NdbReceiver_H
#define NdbReceiver_H
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
#include <ndb_types.h>
class Ndb;
class NdbReceiver
{
2004-05-26 13:24:14 +02:00
friend class Ndb;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbConnection;
public:
enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1,
NDB_SCANRECEIVER = 2,
NDB_INDEX_OPERATION = 3
};
NdbReceiver(Ndb *aNdb);
void init(ReceiverType type, void* owner);
2004-05-26 13:24:14 +02:00
void release();
~NdbReceiver();
Uint32 getId(){
return m_id;
}
ReceiverType getType(){
return m_type;
}
2004-05-26 13:24:14 +02:00
inline NdbConnection * getTransaction();
void* getOwner(){
return m_owner;
}
bool checkMagicNumber() const;
2004-05-26 13:24:14 +02:00
inline void next(NdbReceiver* next) { m_next = next;}
inline NdbReceiver* next() { return m_next; }
private:
Uint32 theMagicNumber;
Ndb* m_ndb;
Uint32 m_id;
2004-05-26 13:24:14 +02:00
Uint32 m_tcPtrI;
Uint32 m_key_info;
ReceiverType m_type;
void* m_owner;
2004-05-26 13:24:14 +02:00
NdbReceiver* m_next;
/**
* At setup
*/
class NdbRecAttr * getValue(const class NdbColumnImpl*, char * user_dst_ptr);
void do_get_value(NdbReceiver*, Uint32 rows, Uint32 key_size);
void prepareSend();
First step for WL 2025 Not yet fully working Scan reads work fine, not scan updates ndb/include/kernel/ndb_limits.h: Introducing a new parameter plus increasing the max no of parallel operations per scan in LQH, first step in WL 2025 ndb/include/kernel/signaldata/ScanFrag.hpp: Only need one clientOpPtr Concurrency is batch_size to use in this scan batch_byte_size is max no of bytes sent in a batch first_batch_size is the batch size in the first batch ndb/include/kernel/signaldata/ScanTab.hpp: apiOperationPtr is sent as long signal data batch_byte_size and first_batch_size is needed for further transport to LQH batch size can now be bigger than before ndb/include/kernel/signaldata/TcKeyReq.hpp: More concurrency means more size for scanInfo also in TCKEYREQ ndb/include/ndbapi/NdbReceiver.hpp: New subroutine to caclculate batch size and similar parameters ndb/include/ndbapi/NdbScanOperation.hpp: batch size calculated before sending, not necessary to store anymore ndb/src/common/debugger/signaldata/ScanTab.cpp: Updated signal printer for SCAN_TABREQ ndb/src/kernel/blocks/backup/Backup.cpp: Fixes to make it compile, not fixed for BACKUP being useful yet ndb/src/kernel/blocks/dblqh/Dblqh.hpp: Removed parameters no longer needed and added some new ones. ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Fix for cmaxAccOps that was using the wrong constant Removed old code New SCAN_FRAGREQ signal ndb/src/kernel/blocks/dbtc/Dbtc.hpp: New variables Removed dead code ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: New SCAN_TABREQ, SCAN_FRAGREQ, SCAN_FRAGCONF and SCAN_TABCONF Fixed some error handling to be more efficient ndb/src/kernel/blocks/suma/Suma.cpp: Fixes to make it compile, not yet usable for SUMA features ndb/src/kernel/vm/Configuration.cpp: Fix for wrong constant ndb/src/ndbapi/NdbApiSignal.cpp: Fix for not using constants ndb/src/ndbapi/NdbApiSignal.hpp: Added possibility to get signal sending node from signal ndb/src/ndbapi/NdbConnectionScan.cpp: Moved declaration ndb/src/ndbapi/NdbReceiver.cpp: New routine to calculate batch_size etc. ndb/src/ndbapi/NdbScanOperation.cpp: Various fixes for sending SCAN_TABREQ and other stuff
2004-08-09 17:43:15 +02:00
void calculate_batch_size(Uint32, Uint32, Uint32&, Uint32&, Uint32&);
2004-05-26 13:24:14 +02:00
int execKEYINFO20(Uint32 info, const Uint32* ptr, Uint32 len);
int execTRANSID_AI(const Uint32* ptr, Uint32 len);
int execTCOPCONF(Uint32 len);
int execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows);
class NdbRecAttr* theFirstRecAttr;
class NdbRecAttr* theCurrentRecAttr;
class NdbRecAttr** m_rows;
Uint32 m_list_index; // When using multiple
Uint32 m_current_row;
Uint32 m_result_rows;
Uint32 m_defined_rows;
Uint32 m_expected_result_length;
Uint32 m_received_result_length;
bool nextResult() const { return m_current_row < m_result_rows; }
void copyout(NdbReceiver&);
};
#ifdef NDB_NO_DROPPED_SIGNAL
#include <stdlib.h>
#endif
inline
bool
NdbReceiver::checkMagicNumber() const {
bool retVal = (theMagicNumber == 0x11223344);
#ifdef NDB_NO_DROPPED_SIGNAL
if(!retVal){
abort();
}
#endif
return retVal;
}
2004-05-26 13:24:14 +02:00
inline
void
NdbReceiver::prepareSend(){
m_current_row = 0;
m_received_result_length = 0;
m_expected_result_length = 0;
theCurrentRecAttr = theFirstRecAttr;
}
inline
int
NdbReceiver::execTCOPCONF(Uint32 len){
Uint32 tmp = m_received_result_length;
m_expected_result_length = len;
return (tmp == len ? 1 : 0);
}
inline
int
NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
m_tcPtrI = tcPtrI;
m_result_rows = rows;
Uint32 tmp = m_received_result_length;
m_expected_result_length = len;
return (tmp == len ? 1 : 0);
}
#endif
#endif