📄 suma.hpp
字号:
/* 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 SUMA_H#define SUMA_H#include <ndb_limits.h>#include <SimulatedBlock.hpp>#include <NodeBitmask.hpp>#include <SLList.hpp>#include <DLList.hpp>#include <KeyTable.hpp>#include <DataBuffer.hpp>#include <SignalCounter.hpp>#include <AttributeHeader.hpp>#include <AttributeList.hpp>#include <signaldata/UtilSequence.hpp>#include <signaldata/SumaImpl.hpp>class SumaParticipant : public SimulatedBlock {protected: SumaParticipant(const Configuration & conf); virtual ~SumaParticipant(); BLOCK_DEFINES(SumaParticipant); protected: /** * Private interface */ void execSUB_CREATE_REQ(Signal* signal); void execSUB_REMOVE_REQ(Signal* signal); void execSUB_START_REQ(Signal* signal); void execSUB_STOP_REQ(Signal* signal); void execSUB_SYNC_REQ(Signal* signal); void execSUB_ABORT_SYNC_REQ(Signal* signal); void execSUB_STOP_CONF(Signal* signal); void execSUB_STOP_REF(Signal* signal); /** * Dict interface */ void execLIST_TABLES_REF(Signal* signal); void execLIST_TABLES_CONF(Signal* signal); void execGET_TABINFOREF(Signal* signal); void execGET_TABINFO_CONF(Signal* signal);#if 0 void execGET_TABLEID_CONF(Signal* signal); void execGET_TABLEID_REF(Signal* signal);#endif /** * Scan interface */ void execSCAN_HBREP(Signal* signal); void execSCAN_FRAGREF(Signal* signal); void execSCAN_FRAGCONF(Signal* signal); void execTRANSID_AI(Signal* signal); void execSUB_SYNC_CONTINUE_REF(Signal* signal); void execSUB_SYNC_CONTINUE_CONF(Signal* signal); /** * Trigger logging */ void execTRIG_ATTRINFO(Signal* signal); void execFIRE_TRIG_ORD(Signal* signal); void execSUB_GCP_COMPLETE_REP(Signal* signal); void runSUB_GCP_COMPLETE_ACC(Signal* signal); /** * DIH signals */ void execDI_FCOUNTREF(Signal* signal); void execDI_FCOUNTCONF(Signal* signal); void execDIGETPRIMREF(Signal* signal); void execDIGETPRIMCONF(Signal* signal); /** * Trigger administration */ void execCREATE_TRIG_REF(Signal* signal); void execCREATE_TRIG_CONF(Signal* signal); void execDROP_TRIG_REF(Signal* signal); void execDROP_TRIG_CONF(Signal* signal); /** * continueb */ void execCONTINUEB(Signal* signal);public: typedef DataBuffer<15> TableList; union FragmentDescriptor { struct { Uint16 m_fragmentNo; Uint16 m_nodeId; } m_fragDesc; Uint32 m_dummy; }; /** * Used when sending SCAN_FRAG */ union AttributeDescriptor { struct { Uint16 attrId; Uint16 unused; } m_attrDesc; Uint32 m_dummy; }; struct Table { Table() { m_tableId = ~0; } void release(SumaParticipant&); union { Uint32 m_tableId; Uint32 key; }; Uint32 m_schemaVersion; Uint32 m_hasTriggerDefined[3]; // Insert/Update/Delete Uint32 m_triggerIds[3]; // Insert/Update/Delete /** * Default order in which to ask for attributes during scan * 1) Fixed, not nullable * 2) Rest */ DataBuffer<15>::Head m_attributes; // Attribute id's /** * Fragments */ DataBuffer<15>::Head m_fragments; // Fragment descriptors /** * Hash table stuff */ Uint32 nextHash; union { Uint32 prevHash; Uint32 nextPool; }; Uint32 hashValue() const { return m_tableId; } bool equal(const Table& rec) const { return m_tableId == rec.m_tableId; } }; typedef Ptr<Table> TablePtr; /** * Subscriptions */ struct SyncRecord { SyncRecord(SumaParticipant& s, DataBuffer<15>::DataBufferPool & p) : m_locked(false), m_tableList(p), suma(s)#ifdef ERROR_INSERT , cerrorInsert(s.cerrorInsert)#endif {} void release(); Uint32 m_subscriptionPtrI; bool m_locked; bool m_doSendSyncData; bool m_error; TableList m_tableList; // Tables to sync (snapshoted at beginning) TableList::DataBufferIterator m_tableList_it; /** * Sync meta */ void startMeta(Signal*); void nextMeta(Signal*); void completeMeta(Signal*); /** * Create triggers */ Uint32 m_latestTriggerId; void startTrigger(Signal* signal); void nextTrigger(Signal* signal); void completeTrigger(Signal* signal); void createAttributeMask(AttributeMask&, Table*); /** * Drop triggers */ void startDropTrigger(Signal* signal); void nextDropTrigger(Signal* signal); void completeDropTrigger(Signal* signal); /** * Sync data */ Uint32 m_currentTable; // Index in m_tableList Uint32 m_currentFragment; // Index in tabPtr.p->m_fragments DataBuffer<15>::Head m_attributeList; // Attribute if other than default DataBuffer<15>::Head m_tabList; // tables if other than default Uint32 m_currentTableId; // Current table Uint32 m_currentNoOfAttributes; // No of attributes for current table void startScan(Signal*); void nextScan(Signal*); bool getNextFragment(TablePtr * tab, FragmentDescriptor * fd); void completeScan(Signal*); SumaParticipant & suma;#ifdef ERROR_INSERT UintR &cerrorInsert;#endif BlockNumber number() const { return suma.number(); } void progError(int line, int cause, const char * extra) { suma.progError(line, cause, extra); } void runLIST_TABLES_CONF(Signal* signal); void runGET_TABINFO_CONF(Signal* signal); void runGET_TABINFOREF(Signal* signal); void runDI_FCOUNTCONF(Signal* signal); void runDIGETPRIMCONF(Signal* signal); void runCREATE_TRIG_CONF(Signal* signal); void runDROP_TRIG_CONF(Signal* signal); void runDROP_TRIG_REF(Signal* signal); void runDropTrig(Signal* signal, Uint32 triggerId, Uint32 tableId); Uint32 ptrI; union { Uint32 nextPool; Uint32 nextList; }; }; friend struct SyncRecord; struct Subscription { Uint32 m_subscriberRef; Uint32 m_subscriberData; Uint32 m_senderRef; Uint32 m_senderData; Uint32 m_subscriptionId; Uint32 m_subscriptionKey; Uint32 m_subscriptionType; Uint32 m_coordinatorRef; Uint32 m_syncPtrI; // Active sync operation Uint32 m_nSubscribers; bool m_markRemove; Uint32 nextHash; union { Uint32 prevHash; Uint32 nextPool; }; Uint32 hashValue() const { return m_subscriptionId + m_subscriptionKey; } bool equal(const Subscription & s) const { return m_subscriptionId == s.m_subscriptionId && m_subscriptionKey == s.m_subscriptionKey; } /** * The following holds the table names of tables included * in the subscription. */ // TODO we've got to fix this, this is to inefficient. Tomas char m_tables[MAX_TABLES];#if 0 char m_tableNames[MAX_TABLES][MAX_TAB_NAME_SIZE];#endif /** * "Iterator" used to iterate through m_tableNames */ Uint32 m_maxTables; Uint32 m_currentTable; }; typedef Ptr<Subscription> SubscriptionPtr; struct Subscriber { Uint32 m_senderRef; Uint32 m_senderData; Uint32 m_subscriberRef; Uint32 m_subscriberData; Uint32 m_subPtrI; //reference to subscription Uint32 m_firstGCI; // first GCI to send Uint32 m_lastGCI; // last acnowledged GCI Uint32 nextList; union { Uint32 nextPool; Uint32 prevList; }; }; typedef Ptr<Subscriber> SubscriberPtr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -