24 #include <ndb_limits.h>
25 #include <trigger_definitions.h>
27 #include <DLHashTable.hpp>
28 #include <DLFifoList.hpp>
30 #include <KeyTable.hpp>
31 #include <KeyTable2.hpp>
32 #include <KeyTable2Ref.hpp>
33 #include <SimulatedBlock.hpp>
34 #include <SimpleProperties.hpp>
35 #include <SignalCounter.hpp>
36 #include <Bitmask.hpp>
37 #include <AttributeList.hpp>
38 #include <signaldata/GetTableId.hpp>
39 #include <signaldata/GetTabInfo.hpp>
40 #include <signaldata/DictTabInfo.hpp>
41 #include <signaldata/CreateTable.hpp>
42 #include <signaldata/CreateTab.hpp>
43 #include <signaldata/DropTable.hpp>
44 #include <signaldata/DropTab.hpp>
45 #include <signaldata/AlterTable.hpp>
46 #include <signaldata/AlterTab.hpp>
47 #include <signaldata/ListTables.hpp>
48 #include <signaldata/CreateIndx.hpp>
49 #include <signaldata/CreateIndxImpl.hpp>
50 #include <signaldata/DropIndx.hpp>
51 #include <signaldata/DropIndxImpl.hpp>
52 #include <signaldata/AlterIndx.hpp>
53 #include <signaldata/AlterIndxImpl.hpp>
54 #include <signaldata/BuildIndx.hpp>
55 #include <signaldata/BuildIndxImpl.hpp>
56 #include <signaldata/IndexStatSignal.hpp>
57 #include <signaldata/UtilPrepare.hpp>
58 #include <signaldata/CreateEvnt.hpp>
59 #include <signaldata/CreateTrig.hpp>
60 #include <signaldata/CreateTrigImpl.hpp>
61 #include <signaldata/DropTrig.hpp>
62 #include <signaldata/DropTrigImpl.hpp>
63 #include <signaldata/DictLock.hpp>
64 #include <signaldata/DictTakeover.hpp>
65 #include <signaldata/SumaImpl.hpp>
66 #include <signaldata/CreateHashMap.hpp>
67 #include <signaldata/HashMapImpl.hpp>
68 #include "SchemaFile.hpp"
69 #include <blocks/mutexes.hpp>
70 #include <SafeCounter.hpp>
71 #include <RequestTracker.hpp>
73 #include <signaldata/CreateFilegroupImpl.hpp>
74 #include <signaldata/DropFilegroupImpl.hpp>
76 #include <signaldata/DictSignal.hpp>
77 #include <signaldata/SchemaTransImpl.hpp>
78 #include <LockQueue.hpp>
79 #include <signaldata/CopyData.hpp>
80 #include <signaldata/NodeFailRep.hpp>
81 #include <signaldata/CreateNodegroup.hpp>
82 #include <signaldata/DropNodegroup.hpp>
83 #include <signaldata/CreateNodegroupImpl.hpp>
84 #include <signaldata/DropNodegroupImpl.hpp>
92 #define ZPACK_TABLE_INTO_PAGES 0
93 #define ZSEND_GET_TAB_RESPONSE 3
94 #define ZWAIT_SUBSTARTSTOP 4
95 #define ZDICT_TAKEOVER_REQ 5
97 #define ZCOMMIT_WAIT_GCI 6
98 #define ZINDEX_STAT_BG_PROCESS 7
103 #define ZNOMOREPHASES 255
108 #define ZSCHEMA_WORDS 4
113 #define ZBAT_SCHEMA_FILE 0 //Variable number of page for NDBFS
114 #define ZBAT_TABLE_FILE 1 //Variable number of page for NDBFS
115 #define ZPAGE_HEADER_SIZE 32
116 #define ZPOS_PAGE_SIZE 16
117 #define ZPOS_CHECKSUM 17
118 #define ZPOS_VERSION 18
119 #define ZPOS_PAGE_HEADER_SIZE 19
124 #define ZFS_CONNECT_SIZE 4
125 #define ZSIZE_OF_PAGES_IN_WORDS 8192
126 #define ZLOG_SIZE_OF_PAGES_IN_WORDS 13
127 #define ZMAX_PAGES_OF_TABLE_DEFINITION \
128 ((ZPAGE_HEADER_SIZE + MAX_WORDS_META_FILE + ZSIZE_OF_PAGES_IN_WORDS - 1) / \
129 ZSIZE_OF_PAGES_IN_WORDS)
135 #define ZNUMBER_OF_PAGES (2 * ZMAX_PAGES_OF_TABLE_DEFINITION)
140 #define ZNODE_FAILURE_ERROR 704
146 #define EVENT_SYSTEM_TABLE_LENGTH 9
147 #define EVENT_SYSTEM_TABLE_ATTRIBUTE_MASK2_ID 8
150 char NAME[MAX_TAB_NAME_SIZE];
154 char TABLE_NAME[MAX_TAB_NAME_SIZE];
155 Uint32 ATTRIBUTE_MASK[MAXNROFATTRIBUTESINWORDS_OLD];
160 Uint32 ATTRIBUTE_MASK2[(MAX_ATTRIBUTES_IN_TABLE / 32) + 1];
191 Uint32 attributeDescriptor;
207 const char * m_name_ptr;
219 Uint32 hashValue()
const {
return attributeName.hashValue();}
221 if(obj.hashValue() == hashValue()){
222 ConstRope r(* m_key.m_pool, obj.attributeName);
223 return r.compare(m_key.m_name_ptr, m_key.m_name_len) == 0;
231 RSS_AP_SNAPSHOT(c_attributeRecordPool);
251 Uint32 hashMapObjectId;
252 Uint32 hashMapVersion;
264 Uint32 primaryTableId;
267 DictTabInfo::FragmentType fragmentType;
270 Uint32 gciTableCreated;
277 TR_RowChecksum = 0x4,
279 TR_ForceVarPart = 0x10
281 Uint8 m_extra_row_gci_bits;
282 Uint8 m_extra_row_author_bits;
286 Uint16 noOfAttributes;
319 bool defaultNoPartFlag;
339 bool isTable()
const;
340 bool isIndex()
const;
341 bool isUniqueIndex()
const;
342 bool isNonUniqueIndex()
const;
343 bool isHashIndex()
const;
344 bool isOrderedIndex()
const;
358 Uint32 m_read_locked;
376 Uint32 buildTriggerId;
387 Uint32 insertTriggerId;
388 Uint32 updateTriggerId;
389 Uint32 deleteTriggerId;
390 } m_upgrade_trigger_handling;
399 Uint32 fragmentCount;
400 Uint32 m_tablespace_id;
404 Uint32 nextList, prevList;
409 Uint8 singleUserMode;
417 Uint16 indexStatFragId;
418 Uint16 indexStatNodeId;
421 Uint32 indexStatBgRequest;
426 RSS_AP_SNAPSHOT(c_tableRecordPool);
435 Uint16 c_fragData[MAX_NDB_PARTITIONS];
436 Uint32 c_fragData_align32[1];
438 Uint32 c_tsIdData[2*MAX_NDB_PARTITIONS];
488 Uint32 c_maxNoOfTriggers;
491 RSS_AP_SNAPSHOT(c_triggerRecordPool);
499 OPEN_WRITE_SCHEMA = 1,
501 CLOSE_WRITE_SCHEMA = 3,
502 OPEN_READ_SCHEMA1 = 4,
503 OPEN_READ_SCHEMA2 = 5,
506 CLOSE_READ_SCHEMA = 8,
507 OPEN_READ_TAB_FILE1 = 9,
508 OPEN_READ_TAB_FILE2 = 10,
511 CLOSE_READ_TAB_FILE = 13,
512 OPEN_WRITE_TAB_FILE = 14,
514 CLOSE_WRITE_TAB_FILE = 16
540 NDB_MASTER_TAKEOVER = 3
548 RS_PARTIAL_ROLLBACK = 1,
549 RS_PARTIAL_ROLLFORWARD = 2
551 RecoveryState recoveryState;
562 Uint32 start_op_state;
577 Uint32 word[NDB_SF_PAGE_SIZE_IN_WORDS];
597 Uint32 m_filegroup_id;
608 Uint32 nextHash, prevHash;
610 Uint32 hashValue()
const {
return key;}
611 bool equal(
const File& obj)
const {
return key == obj.key;}
632 Uint32 m_extent_size;
633 Uint32 m_default_logfile_group_id;
637 Uint32 m_undo_buffer_size;
649 Uint32 hashValue()
const {
return key;}
650 bool equal(
const Filegroup& obj)
const {
return key == obj.key;}
661 RopePool c_rope_pool;
662 RSS_AP_SNAPSHOT(c_rope_pool);
676 const char * m_name_ptr;
685 Uint32 hashValue()
const {
return m_name.hashValue();}
687 if(obj.hashValue() == hashValue()){
689 return r.compare(m_key.m_name_ptr, m_key.m_name_len) == 0;
696 Uint32 m_op_ref_count;
698 void print(NdbOut&)
const;
706 RSS_AP_SNAPSHOT(c_obj_pool);
710 return get_object(name, Uint32(strlen(name) + 1));
713 DictObject * get_object(
const char * name, Uint32 len){
714 return get_object(name, len, Rope::hash(name, len));
717 DictObject * get_object(
const char * name, Uint32 len, Uint32 hash);
720 bool get_object(DictObjectPtr& obj_ptr,
const char * name){
721 return get_object(obj_ptr, name, Uint32(strlen(name) + 1));
724 bool get_object(DictObjectPtr& obj_ptr,
const char * name, Uint32 len){
725 return get_object(obj_ptr, name, len, Rope::hash(name, len));
728 bool get_object(DictObjectPtr&,
const char* name, Uint32 len, Uint32 hash);
730 void release_object(Uint32 obj_ptr_i){
731 release_object(obj_ptr_i, c_obj_pool.
getPtr(obj_ptr_i));
734 void release_object(Uint32 obj_ptr_i,
DictObject* obj_ptr_p);
736 void increase_ref_count(Uint32 obj_ptr_i);
737 void decrease_ref_count(Uint32 obj_ptr_i);
747 void execDICTSTARTREQ(
Signal* signal);
749 void execGET_TABINFOREQ(
Signal* signal);
750 void execGET_TABLEDID_REQ(
Signal* signal);
751 void execGET_TABINFO_REF(
Signal* signal);
752 void execGET_TABINFO_CONF(
Signal* signal);
753 void execCONTINUEB(
Signal* signal);
755 void execDUMP_STATE_ORD(
Signal* signal);
756 void execDBINFO_SCANREQ(
Signal* signal);
757 void execHOT_SPAREREP(
Signal* signal);
758 void execDIADDTABCONF(
Signal* signal);
759 void execDIADDTABREF(
Signal* signal);
760 void execTAB_COMMITCONF(
Signal* signal);
761 void execTAB_COMMITREF(
Signal* signal);
762 void execGET_SCHEMA_INFOREQ(
Signal* signal);
763 void execSCHEMA_INFO(
Signal* signal);
764 void execSCHEMA_INFOCONF(
Signal* signal);
765 void execREAD_NODESCONF(
Signal* signal);
766 void execFSCLOSECONF(
Signal* signal);
767 void execFSOPENCONF(
Signal* signal);
768 void execFSOPENREF(
Signal* signal);
769 void execFSREADCONF(
Signal* signal);
770 void execFSREADREF(
Signal* signal);
771 void execFSWRITECONF(
Signal* signal);
772 void execNDB_STTOR(
Signal* signal);
773 void execREAD_CONFIG_REQ(
Signal* signal);
774 void execSTTOR(
Signal* signal);
775 void execTC_SCHVERCONF(
Signal* signal);
776 void execNODE_FAILREP(
Signal* signal);
780 void execINCL_NODEREQ(
Signal* signal);
781 void execAPI_FAILREQ(
Signal* signal);
783 void execWAIT_GCP_REF(
Signal* signal);
784 void execWAIT_GCP_CONF(
Signal* signal);
786 void execLIST_TABLES_REQ(
Signal* signal);
789 void execCREATE_INDX_REQ(
Signal* signal);
790 void execCREATE_INDX_IMPL_CONF(
Signal* signal);
791 void execCREATE_INDX_IMPL_REF(
Signal* signal);
793 void execALTER_INDX_REQ(
Signal* signal);
794 void execALTER_INDX_CONF(
Signal* signal);
795 void execALTER_INDX_REF(
Signal* signal);
796 void execALTER_INDX_IMPL_CONF(
Signal* signal);
797 void execALTER_INDX_IMPL_REF(
Signal* signal);
799 void execCREATE_TABLE_CONF(
Signal* signal);
800 void execCREATE_TABLE_REF(
Signal* signal);
802 void execDROP_INDX_REQ(
Signal* signal);
803 void execDROP_INDX_IMPL_CONF(
Signal* signal);
804 void execDROP_INDX_IMPL_REF(
Signal* signal);
806 void execDROP_TABLE_CONF(
Signal* signal);
807 void execDROP_TABLE_REF(
Signal* signal);
809 void execBUILDINDXREQ(
Signal* signal);
810 void execBUILDINDXCONF(
Signal* signal);
811 void execBUILDINDXREF(
Signal* signal);
812 void execBUILD_INDX_IMPL_CONF(
Signal* signal);
813 void execBUILD_INDX_IMPL_REF(
Signal* signal);
815 void execBACKUP_LOCK_TAB_REQ(
Signal*);
818 void execUTIL_PREPARE_CONF(
Signal* signal);
819 void execUTIL_PREPARE_REF (
Signal* signal);
820 void execUTIL_EXECUTE_CONF(
Signal* signal);
821 void execUTIL_EXECUTE_REF (
Signal* signal);
822 void execUTIL_RELEASE_CONF(
Signal* signal);
823 void execUTIL_RELEASE_REF (
Signal* signal);
827 void execCREATE_EVNT_REQ (
Signal* signal);
828 void execCREATE_EVNT_CONF(
Signal* signal);
829 void execCREATE_EVNT_REF (
Signal* signal);
831 void execDROP_EVNT_REQ (
Signal* signal);
833 void execSUB_START_REQ (
Signal* signal);
834 void execSUB_START_CONF (
Signal* signal);
835 void execSUB_START_REF (
Signal* signal);
837 void execSUB_STOP_REQ (
Signal* signal);
838 void execSUB_STOP_CONF (
Signal* signal);
839 void execSUB_STOP_REF (
Signal* signal);
843 void execCREATE_SUBID_CONF(
Signal* signal);
844 void execCREATE_SUBID_REF (
Signal* signal);
846 void execSUB_CREATE_CONF(
Signal* signal);
847 void execSUB_CREATE_REF (
Signal* signal);
849 void execSUB_REMOVE_REQ(
Signal* signal);
850 void execSUB_REMOVE_CONF(
Signal* signal);
851 void execSUB_REMOVE_REF(
Signal* signal);
854 void execCREATE_TRIG_REQ(
Signal* signal);
855 void execCREATE_TRIG_CONF(
Signal* signal);
856 void execCREATE_TRIG_REF(
Signal* signal);
857 void execALTER_TRIG_REQ(
Signal* signal);
858 void execALTER_TRIG_CONF(
Signal* signal);
859 void execALTER_TRIG_REF(
Signal* signal);
860 void execDROP_TRIG_REQ(
Signal* signal);
861 void execDROP_TRIG_CONF(
Signal* signal);
862 void execDROP_TRIG_REF(
Signal* signal);
864 void execCREATE_TRIG_IMPL_CONF(
Signal* signal);
865 void execCREATE_TRIG_IMPL_REF(
Signal* signal);
866 void execDROP_TRIG_IMPL_CONF(
Signal* signal);
867 void execDROP_TRIG_IMPL_REF(
Signal* signal);
869 void execDROP_TABLE_REQ(
Signal* signal);
871 void execPREP_DROP_TAB_REQ(
Signal* signal);
872 void execPREP_DROP_TAB_REF(
Signal* signal);
873 void execPREP_DROP_TAB_CONF(
Signal* signal);
875 void execDROP_TAB_REF(
Signal* signal);
876 void execDROP_TAB_CONF(
Signal* signal);
878 void execCREATE_TABLE_REQ(
Signal* signal);
879 void execALTER_TABLE_REQ(
Signal* signal);
881 Uint32 get_fragmentation(
Signal*, Uint32 tableId);
882 Uint32 create_fragmentation(
Signal* signal, TableRecordPtr,
883 const Uint16*, Uint32 cnt,
885 void execCREATE_FRAGMENTATION_REQ(
Signal*);
886 void execCREATE_FRAGMENTATION_REF(
Signal*);
887 void execCREATE_FRAGMENTATION_CONF(
Signal*);
888 void execCREATE_TAB_REQ(
Signal* signal);
889 void execADD_FRAGREQ(
Signal* signal);
890 void execLQHFRAGREF(
Signal* signal);
891 void execLQHFRAGCONF(
Signal* signal);
892 void execLQHADDATTREF(
Signal* signal);
893 void execLQHADDATTCONF(
Signal* signal);
894 void execCREATE_TAB_REF(
Signal* signal);
895 void execCREATE_TAB_CONF(
Signal* signal);
896 void execALTER_TAB_REF(
Signal* signal);
897 void execALTER_TAB_CONF(
Signal* signal);
898 void execALTER_TABLE_REF(
Signal* signal);
899 void execALTER_TABLE_CONF(
Signal* signal);
900 bool check_ndb_versions()
const;
901 int check_sender_version(
const Signal* signal, Uint32 version)
const;
904 void execCREATE_FILE_REQ(
Signal* signal);
905 void execCREATE_FILEGROUP_REQ(
Signal* signal);
906 void execDROP_FILE_REQ(
Signal* signal);
907 void execDROP_FILEGROUP_REQ(
Signal* signal);
910 void execCREATE_FILE_IMPL_REF(
Signal* signal);
911 void execCREATE_FILE_IMPL_CONF(
Signal* signal);
912 void execCREATE_FILEGROUP_IMPL_REF(
Signal* signal);
913 void execCREATE_FILEGROUP_IMPL_CONF(
Signal* signal);
914 void execDROP_FILE_IMPL_REF(
Signal* signal);
915 void execDROP_FILE_IMPL_CONF(
Signal* signal);
916 void execDROP_FILEGROUP_IMPL_REF(
Signal* signal);
917 void execDROP_FILEGROUP_IMPL_CONF(
Signal* signal);
919 void execSCHEMA_TRANS_BEGIN_REQ(
Signal* signal);
920 void execSCHEMA_TRANS_BEGIN_CONF(
Signal* signal);
921 void execSCHEMA_TRANS_BEGIN_REF(
Signal* signal);
922 void execSCHEMA_TRANS_END_REQ(
Signal* signal);
923 void execSCHEMA_TRANS_END_CONF(
Signal* signal);
924 void execSCHEMA_TRANS_END_REF(
Signal* signal);
925 void execSCHEMA_TRANS_END_REP(
Signal* signal);
926 void execSCHEMA_TRANS_IMPL_REQ(
Signal* signal);
927 void execSCHEMA_TRANS_IMPL_CONF(
Signal* signal);
928 void execSCHEMA_TRANS_IMPL_REF(
Signal* signal);
930 void execDICT_LOCK_REQ(
Signal* signal);
931 void execDICT_UNLOCK_ORD(
Signal* signal);
933 void execDICT_TAKEOVER_REQ(
Signal* signal);
934 void execDICT_TAKEOVER_REF(
Signal* signal);
935 void execDICT_TAKEOVER_CONF(
Signal* signal);
938 void execINDEX_STAT_REQ(
Signal* signal);
939 void execINDEX_STAT_CONF(
Signal* signal);
940 void execINDEX_STAT_REF(
Signal* signal);
941 void execINDEX_STAT_IMPL_CONF(
Signal* signal);
942 void execINDEX_STAT_IMPL_REF(
Signal* signal);
943 void execINDEX_STAT_REP(
Signal* signal);
953 struct SendSchemaRecord {
962 Uint32 noOfWordsCurrentlySent;
963 Uint32 noOfSignalsSentSinceDelay;
967 SendSchemaRecord c_sendSchemaRecord;
973 struct ReadTableRecord {
984 ReadTableRecord c_readTableRecord;
990 struct WriteTableRecord {
996 Uint32 noOfTableFilesHandled;
1000 enum TableWriteState {
1002 WRITE_ADD_TABLE_MASTER = 1,
1003 WRITE_ADD_TABLE_SLAVE = 2,
1004 WRITE_RESTART_FROM_MASTER = 3,
1005 WRITE_RESTART_FROM_OWN = 4,
1008 TableWriteState tableWriteState;
1009 Callback m_callback;
1011 WriteTableRecord c_writeTableRecord;
1017 struct ReadSchemaRecord {
1025 enum SchemaReadState {
1027 INITIAL_READ_HEAD = 1,
1030 SchemaReadState schemaReadState;
1032 ReadSchemaRecord c_readSchemaRecord;
1038 struct WriteSchemaRecord {
1048 Uint32 noOfSchemaFilesHandled;
1051 Callback m_callback;
1053 WriteSchemaRecord c_writeSchemaRecord;
1059 struct RestartRecord {
1061 Uint32 gciToRestart;
1067 BlockReference returnBlockRef;
1068 Uint32 m_senderData;
1072 const char * m_start_banner;
1073 const char * m_end_banner;
1079 RestartRecord c_restartRecord;
1085 struct RetrieveRecord {
1086 RetrieveRecord(){ noOfWaiters = 0;}
1097 BlockReference blockRef;
1100 Uint32 m_senderData;
1105 Uint32 m_table_type;
1108 Uint32 retrievePage;
1111 Uint32 retrievedNoOfPages;
1114 Uint32 retrievedNoOfWords;
1124 Uint32 schemaTransId;
1127 RetrieveRecord c_retrieveRecord;
1141 struct SchemaRecord {
1144 NEW_SCHEMA_FILE = 0,
1152 Uint32 oldSchemaPage;
1154 Callback m_callback;
1156 SchemaRecord c_schemaRecord;
1162 struct XSchemaFile {
1167 XSchemaFile c_schemaFile[2];
1169 void initSchemaFile(XSchemaFile *, Uint32 firstPage, Uint32 lastPage,
1171 void resizeSchemaFile(XSchemaFile * xsf, Uint32 noOfPages);
1172 void computeChecksum(XSchemaFile *, Uint32 pageNo);
1173 bool validateChecksum(
const XSchemaFile *);
1178 Uint32 computeChecksum(
const Uint32 * src, Uint32 len);
1184 Uint16 c_masterNodeId;
1189 Uint16 c_numberNode;
1190 Uint16 c_noHotSpareNodes;
1191 Uint16 c_noNodesFailed;
1200 enum PackTableState {
1207 Uint32 c_startPhase;
1208 Uint32 c_restartType;
1209 bool c_initialStart;
1210 bool c_systemRestart;
1212 bool c_initialNodeRestart;
1213 Uint32 c_tabinfoReceived;
1218 struct ParseDictTabInfoRecord {
1219 ParseDictTabInfoRecord() { tablePtr.setNull();}
1220 DictTabInfo::RequestType requestType;
1226 TableRecordPtr tablePtr;
1231 template <U
int32 sz>
1236 Rope r_dst(c_rope_pool, rh_dst);
1238 ndbrequire(r_src.size() <= sz);
1240 bool ok = r_dst.assign(buf, r_src.size());
1245 template <U
int32 sz>
1249 static char buf[2][sz];
1252 char* str = buf[i++ % 2];
1264 struct OpRecordCommon {
1269 Uint32 hashValue()
const {
1272 bool equal(
const OpRecordCommon&
rec)
const {
1273 return key == rec.key;
1296 char errorObjectName[MAX_TAB_NAME_SIZE];
1304 errorObjectName[0] = 0;
1306 void print(NdbOut&)
const;
1308 ErrorInfo& operator=(
const ErrorInfo&);
1311 void setError(ErrorInfo&,
1317 const char * name = 0);
1319 void setError(ErrorInfo&,
1324 void setError(ErrorInfo&,
const ErrorInfo&);
1325 void setError(ErrorInfo&,
const ParseDictTabInfoRecord&);
1327 void setError(SchemaOpPtr, Uint32
code, Uint32 line, Uint32 nodeId = 0);
1328 void setError(SchemaOpPtr,
const ErrorInfo&);
1330 void setError(SchemaTransPtr, Uint32
code, Uint32 line, Uint32 nodeId = 0);
1331 void setError(SchemaTransPtr,
const ErrorInfo&);
1333 void setError(TxHandlePtr, Uint32
code, Uint32 line, Uint32 nodeId = 0);
1334 void setError(TxHandlePtr,
const ErrorInfo&);
1336 template <
class Ref>
1338 setError(ErrorInfo& e,
const Ref* ref) {
1339 setError(e, ref->errorCode, ref->errorLine, ref->errorNodeId);
1342 template <
class Ref>
1344 getError(
const ErrorInfo& e, Ref* ref) {
1345 ref->errorCode = e.errorCode;
1346 ref->errorLine = e.errorLine;
1347 ref->errorNodeId = e.errorNodeId;
1348 ref->masterNodeId = c_masterNodeId;
1351 bool hasError(
const ErrorInfo&);
1353 void resetError(ErrorInfo&);
1354 void resetError(SchemaOpPtr);
1355 void resetError(SchemaTransPtr);
1356 void resetError(TxHandlePtr);
1361 const char m_opType[4];
1362 Uint32 m_impl_req_gsn;
1363 Uint32 m_impl_req_length;
1366 bool (
Dbdict::*m_seize)(SchemaOpPtr);
1367 void (
Dbdict::*m_release)(SchemaOpPtr);
1373 void (
Dbdict::*m_reply)(
Signal*, SchemaOpPtr, ErrorInfo);
1385 static const OpInfo* g_opInfoList[];
1386 const OpInfo* findOpInfo(Uint32 gsn);
1397 const OpInfo& m_opInfo;
1400 Uint32*
const m_impl_req_data;
1405 OpRec(
const OpInfo& info, Uint32* impl_req_data) :
1407 m_impl_req_data(impl_req_data) {
1409 memcpy(m_opType, m_opInfo.m_opType, 4);
1421 enum { OpSectionSegmentSize = 127 };
1426 OpSectionBuffer::Head
1427 OpSectionBufferHead;
1429 OpSectionBuffer::DataBufferPool
1430 OpSectionBufferPool;
1433 OpSectionBufferConstIterator;
1435 OpSectionBufferPool c_opSectionBufferPool;
1438 OpSectionBufferHead m_head;
1439 Uint32 getSize()
const {
1440 return m_head.getSize();
1445 bool copyIn(OpSection&,
const Uint32* src, Uint32 srcSize);
1447 bool copyOut(
const OpSection&, Uint32* dst, Uint32 dstSize);
1448 bool copyOut(OpSectionBuffer & buffer, OpSectionBufferConstIterator & iter,
1449 Uint32 * dst, Uint32 len);
1450 void release(OpSection&);
1460 OS_PARSE_MASTER = 1,
1465 OS_ABORTING_PREPARE = 6,
1466 OS_ABORTED_PREPARE = 7,
1467 OS_ABORTING_PARSE = 8,
1480 static Uint32 weight(Uint32 state) {
1481 switch ((OpState) state) {
1484 case OS_PARSE_MASTER:
1494 case OS_ABORTING_PREPARE:
1496 case OS_ABORTED_PREPARE:
1498 case OS_ABORTING_PARSE:
1516 Uint32 m_base_op_ptr_i;
1519 Uint32 hashValue()
const {
1522 bool equal(
const SchemaOp&
rec)
const {
1523 return op_key == rec.op_key;
1531 Uint32 m_clientData;
1534 Uint32 m_requestInfo;
1537 SchemaTransPtr m_trans_ptr;
1540 OpRecPtr m_oprec_ptr;
1543 OpSection m_section[3];
1547 Callback m_callback;
1550 SchemaOpPtr m_oplnk_ptr;
1551 SchemaOpPtr m_opbck_ptr;
1557 Uint32 m_orig_entry_id;
1561 enum { DICT_MAGIC = 0xd1c70001 };
1569 m_trans_ptr.setNull();
1570 m_oprec_ptr.setNull();
1572 m_callback.m_callbackFunction = 0;
1573 m_callback.m_callbackData = 0;
1574 m_oplnk_ptr.setNull();
1575 m_opbck_ptr.setNull();
1577 m_base_op_ptr_i = RNIL;
1579 m_orig_entry_id = RNIL;
1580 m_orig_entry.init();
1583 SchemaOp(Uint32 the_op_key) {
1584 op_key = the_op_key;
1588 void print(NdbOut&)
const;
1595 const OpInfo& getOpInfo(SchemaOpPtr op_ptr);
1601 setOpRec(SchemaOpPtr op_ptr,
const Ptr<T> t_ptr) {
1602 OpRecPtr& oprec_ptr = op_ptr.p->m_oprec_ptr;
1603 ndbrequire(!t_ptr.isNull());
1604 oprec_ptr.i = t_ptr.i;
1605 oprec_ptr.p =
static_cast<OpRec*
>(t_ptr.p);
1606 ndbrequire(memcmp(t_ptr.p->m_opType, T::g_opInfo.m_opType, 4) == 0);
1611 getOpRec(SchemaOpPtr op_ptr,
Ptr<T>& t_ptr) {
1612 OpRecPtr oprec_ptr = op_ptr.p->m_oprec_ptr;
1613 ndbrequire(!oprec_ptr.isNull());
1614 t_ptr.i = oprec_ptr.i;
1615 t_ptr.p =
static_cast<T*
>(oprec_ptr.p);
1616 ndbrequire(memcmp(t_ptr.p->m_opType, T::g_opInfo.m_opType, 4) == 0);
1623 seizeOpRec(SchemaOpPtr op_ptr) {
1624 OpRecPtr& oprec_ptr = op_ptr.p->m_oprec_ptr;
1627 if (pool.
seize(t_ptr)) {
1629 setOpRec<T>(op_ptr, t_ptr);
1632 oprec_ptr.setNull();
1638 releaseOpRec(SchemaOpPtr op_ptr) {
1639 OpRecPtr& oprec_ptr = op_ptr.p->m_oprec_ptr;
1642 getOpRec<T>(op_ptr, t_ptr);
1644 oprec_ptr.setNull();
1649 bool seizeSchemaOp(SchemaOpPtr& op_ptr, Uint32 op_key,
const OpInfo& info);
1653 seizeSchemaOp(SchemaOpPtr& op_ptr, Uint32 op_key) {
1654 return seizeSchemaOp(op_ptr, op_key, T::g_opInfo);
1659 seizeSchemaOp(SchemaOpPtr& op_ptr,
Ptr<T>& t_ptr, Uint32 op_key) {
1660 if (seizeSchemaOp<T>(op_ptr, op_key)) {
1661 getOpRec<T>(op_ptr, t_ptr);
1669 seizeSchemaOp(SchemaOpPtr& op_ptr) {
1674 (getOwnNodeId() << 24) +
1675 ((c_opRecordSequence + 1) & 0x00FFFFFF);
1676 if (seizeSchemaOp<T>(op_ptr, op_key)) {
1677 c_opRecordSequence++;
1685 seizeSchemaOp(SchemaOpPtr& op_ptr,
Ptr<T>& t_ptr) {
1686 if (seizeSchemaOp<T>(op_ptr)) {
1687 getOpRec<T>(op_ptr, t_ptr);
1693 bool findSchemaOp(SchemaOpPtr& op_ptr, Uint32 op_key);
1697 findSchemaOp(SchemaOpPtr& op_ptr,
Ptr<T>& t_ptr, Uint32 op_key) {
1698 if (findSchemaOp(op_ptr, op_key)) {
1699 getOpRec(op_ptr, t_ptr);
1705 void releaseSchemaOp(SchemaOpPtr& op_ptr);
1708 const OpSection& getOpSection(SchemaOpPtr, Uint32 ss_no);
1709 bool saveOpSection(SchemaOpPtr,
SectionHandle&, Uint32 ss_no);
1711 void releaseOpSection(SchemaOpPtr, Uint32 ss_no);
1714 void addSchemaOp(SchemaTransPtr, SchemaOpPtr&);
1716 void updateSchemaOpStep(SchemaTransPtr, SchemaOpPtr);
1720 bool hasDictObject(SchemaOpPtr);
1721 void getDictObject(SchemaOpPtr, DictObjectPtr&);
1722 void linkDictObject(SchemaOpPtr op_ptr, DictObjectPtr obj_ptr);
1723 void unlinkDictObject(SchemaOpPtr op_ptr);
1724 void seizeDictObject(SchemaOpPtr, DictObjectPtr&,
const RopeHandle& name);
1725 bool findDictObject(SchemaOpPtr, DictObjectPtr&,
const char* name);
1726 bool findDictObject(SchemaOpPtr, DictObjectPtr&, Uint32 obj_ptr_i);
1727 void releaseDictObject(SchemaOpPtr);
1728 void findDictObjectOp(SchemaOpPtr&, DictObjectPtr);
1734 struct TransClient {
1754 struct SchemaTrans {
1766 TS_FLUSH_PREPARE = 6,
1768 TS_ABORTING_PREPARE = 8,
1769 TS_ABORTING_PARSE = 9,
1770 TS_FLUSH_COMMIT = 10,
1772 TS_FLUSH_COMPLETE = 12,
1778 static Uint32 weight(Uint32 state) {
1784 switch ((TransState) state) {
1795 case TS_ROLLBACK_SP:
1797 case TS_FLUSH_PREPARE:
1801 case TS_ABORTING_PREPARE:
1803 case TS_ABORTING_PARSE:
1805 case TS_FLUSH_COMMIT:
1809 case TS_FLUSH_COMPLETE:
1823 Uint32 hashValue()
const {
1826 bool equal(
const SchemaTrans&
rec)
const {
1827 return trans_key == rec.trans_key;
1835 BlockReference m_masterRef;
1838 Uint32 m_requestInfo;
1840 BlockReference m_clientRef;
1843 TransClient::State m_clientState;
1844 Uint32 m_clientFlags;
1845 Uint32 m_takeOverTxKey;
1851 Uint32 m_curr_op_ptr_i;
1855 enum TakeoverRecoveryState
1858 TRS_ROLLFORWARD = 1,
1861 Uint32 m_master_recovery_state;
1864 Uint32 m_rollforward_op;
1865 Uint32 m_rollforward_op_state;
1866 Uint32 m_rollback_op;
1867 Uint32 m_rollback_op_state;
1868 Uint32 m_lowest_trans_state;
1869 Uint32 m_highest_trans_state;
1871 bool check_partial_rollforward;
1873 bool ressurected_op;
1879 Callback m_callback;
1889 bool m_flush_prepare;
1890 bool m_flush_commit;
1891 bool m_flush_complete;
1893 bool m_wait_gcp_on_commit;
1896 enum { DICT_MAGIC = 0xd1c70002 };
1900 m_state = TS_INITIAL;
1906 m_clientState = TransClient::StateUndef;
1908 m_takeOverTxKey = 0;
1909 bzero(&m_lockReq,
sizeof(m_lockReq));
1910 m_callback.m_callbackFunction = 0;
1911 m_callback.m_callbackData = 0;
1914 m_flush_prepare =
false;
1915 m_flush_commit =
false;
1916 m_flush_complete =
false;
1917 m_flush_end =
false;
1918 m_wait_gcp_on_commit =
true;
1921 SchemaTrans(Uint32 the_trans_key) {
1922 trans_key = the_trans_key;
1926 void print(NdbOut&)
const;
1930 Uint32 check_read_obj(Uint32 objId, Uint32 transId = 0);
1932 Uint32 check_write_obj(Uint32 objId, Uint32 transId = 0);
1933 Uint32 check_write_obj(Uint32, Uint32, SchemaFile::EntryState, ErrorInfo&);
1938 Uint32 c_schemaTransCount;
1940 bool seizeSchemaTrans(SchemaTransPtr&, Uint32 trans_key);
1941 bool seizeSchemaTrans(SchemaTransPtr&);
1942 bool findSchemaTrans(SchemaTransPtr&, Uint32 trans_key);
1943 void releaseSchemaTrans(SchemaTransPtr&);
1946 void createSubOps(
Signal*, SchemaOpPtr,
bool first =
false);
1947 void abortSubOps(
Signal*, SchemaOpPtr, ErrorInfo);
1949 void trans_recv_reply(
Signal*, SchemaTransPtr);
1950 void trans_start_recv_reply(
Signal*, SchemaTransPtr);
1951 void trans_parse_recv_reply(
Signal*, SchemaTransPtr);
1953 void trans_prepare_start(
Signal*, SchemaTransPtr);
1954 void trans_prepare_first(
Signal*, SchemaTransPtr);
1955 void trans_prepare_recv_reply(
Signal*, SchemaTransPtr);
1956 void trans_prepare_next(
Signal*, SchemaTransPtr, SchemaOpPtr);
1957 void trans_prepare_done(
Signal*, SchemaTransPtr);
1959 void trans_abort_prepare_start(
Signal*, SchemaTransPtr);
1960 void trans_abort_prepare_recv_reply(
Signal*, SchemaTransPtr);
1961 void trans_abort_prepare_next(
Signal*, SchemaTransPtr, SchemaOpPtr);
1962 void trans_abort_prepare_done(
Signal*, SchemaTransPtr);
1964 void trans_abort_parse_start(
Signal*, SchemaTransPtr);
1965 void trans_abort_parse_recv_reply(
Signal*, SchemaTransPtr);
1966 void trans_abort_parse_next(
Signal*, SchemaTransPtr, SchemaOpPtr);
1967 void trans_abort_parse_done(
Signal*, SchemaTransPtr);
1969 void trans_rollback_sp_start(
Signal* signal, SchemaTransPtr);
1970 void trans_rollback_sp_recv_reply(
Signal* signal, SchemaTransPtr);
1971 void trans_rollback_sp_next(
Signal* signal, SchemaTransPtr, SchemaOpPtr);
1972 void trans_rollback_sp_done(
Signal* signal, SchemaTransPtr, SchemaOpPtr);
1974 void trans_commit_start(
Signal*, SchemaTransPtr);
1975 void trans_commit_wait_gci(
Signal*);
1976 void trans_commit_mutex_locked(
Signal*, Uint32, Uint32);
1977 void trans_commit_first(
Signal*, SchemaTransPtr);
1978 void trans_commit_recv_reply(
Signal*, SchemaTransPtr);
1979 void trans_commit_next(
Signal*, SchemaTransPtr, SchemaOpPtr);
1980 void trans_commit_done(
Signal* signal, SchemaTransPtr);
1981 void trans_commit_mutex_unlocked(
Signal*, Uint32, Uint32);
1983 void trans_complete_start(
Signal* signal, SchemaTransPtr);
1984 void trans_complete_first(
Signal* signal, SchemaTransPtr);
1985 void trans_complete_next(
Signal*, SchemaTransPtr, SchemaOpPtr);
1986 void trans_complete_recv_reply(
Signal*, SchemaTransPtr);
1987 void trans_complete_done(
Signal*, SchemaTransPtr);
1989 void trans_end_start(
Signal* signal, SchemaTransPtr);
1990 void trans_end_recv_reply(
Signal*, SchemaTransPtr);
1992 void trans_log(SchemaTransPtr);
1993 Uint32 trans_log_schema_op(SchemaOpPtr,
1997 void trans_log_schema_op_abort(SchemaOpPtr);
1998 void trans_log_schema_op_complete(SchemaOpPtr);
2000 void handle_master_takeover(
Signal*);
2001 void check_takeover_replies(
Signal*);
2002 void trans_recover(
Signal*, SchemaTransPtr);
2003 void check_partial_trans_abort_prepare_next(SchemaTransPtr,
2006 void check_partial_trans_abort_parse_next(SchemaTransPtr,
2009 void check_partial_trans_complete_start(SchemaTransPtr,
NdbNodeBitmask &);
2010 void check_partial_trans_commit_start(SchemaTransPtr,
NdbNodeBitmask &);
2011 void check_partial_trans_commit_next(SchemaTransPtr,
2014 void check_partial_trans_end_recv_reply(SchemaTransPtr);
2017 void recvTransReq(
Signal*);
2018 void recvTransParseReq(
Signal*, SchemaTransPtr,
2019 Uint32 op_key,
const OpInfo& info,
2020 Uint32 requestInfo);
2021 void runTransSlave(
Signal*, SchemaTransPtr);
2022 void update_op_state(SchemaOpPtr);
2023 void sendTransConf(
Signal*, SchemaOpPtr);
2024 void sendTransConf(
Signal*, SchemaTransPtr);
2025 void sendTransConfRelease(
Signal*, SchemaTransPtr);
2026 void sendTransRef(
Signal*, SchemaOpPtr);
2027 void sendTransRef(
Signal*, SchemaTransPtr);
2032 void slave_writeSchema_conf(
Signal*, Uint32, Uint32);
2033 void slave_commit_mutex_locked(
Signal*, Uint32, Uint32);
2034 void slave_commit_mutex_unlocked(
Signal*, Uint32, Uint32);
2037 void sendTransClientReply(
Signal*, SchemaTransPtr);
2040 void handleTransSlaveFail(
Signal*, Uint32 failedNode);
2048 template <
class T,
class Req,
class ImplReq>
2050 startClientReq(SchemaOpPtr& op_ptr,
Ptr<T>& t_ptr,
2051 const Req* req, ImplReq*& impl_req, ErrorInfo& error)
2053 SchemaTransPtr trans_ptr;
2055 const Uint32 requestInfo = req->requestInfo;
2056 const Uint32 requestType = DictSignal::getRequestType(requestInfo);
2057 const Uint32 requestExtra = DictSignal::getRequestExtra(requestInfo);
2058 const bool localTrans = (requestInfo & DictSignal::RF_LOCAL_TRANS);
2060 if (getOwnNodeId() != c_masterNodeId && !localTrans) {
2062 setError(error, SchemaTransImplRef::NotMaster, __LINE__);
2066 if (!findSchemaTrans(trans_ptr, req->transKey)) {
2068 setError(error, SchemaTransImplRef::InvalidTransKey, __LINE__);
2072 if (trans_ptr.p->m_transId != req->transId) {
2074 setError(error, SchemaTransImplRef::InvalidTransId, __LINE__);
2078 if (!seizeSchemaOp(op_ptr, t_ptr)) {
2080 setError(error, SchemaTransImplRef::TooManySchemaOps, __LINE__);
2084 trans_ptr.p->m_clientState = TransClient::ParseReq;
2086 DictSignal::setRequestExtra(op_ptr.p->m_requestInfo, requestExtra);
2087 DictSignal::addRequestFlags(op_ptr.p->m_requestInfo, requestInfo);
2090 addSchemaOp(trans_ptr, op_ptr);
2093 impl_req = &t_ptr.p->m_request;
2095 impl_req->senderRef = reference();
2096 impl_req->senderData = op_ptr.p->op_key;
2097 impl_req->requestType = requestType;
2100 op_ptr.p->m_clientRef = req->clientRef;
2101 op_ptr.p->m_clientData = req->clientData;
2112 template <
class Conf>
2114 handleDictConf(
Signal* signal,
const Conf* conf) {
2115 D(
"handleDictConf" << V(conf->senderData));
2116 ndbrequire(signal->getNoOfSections() == 0);
2119 bool ok = findCallback(callback, conf->senderData);
2121 execute(signal, callback, 0);
2124 template <
class Ref>
2126 handleDictRef(
Signal* signal,
const Ref* ref) {
2127 D(
"handleDictRef" << V(ref->senderData) << V(ref->errorCode));
2128 ndbrequire(signal->getNoOfSections() == 0);
2131 bool ok = findCallback(callback, ref->senderData);
2133 ndbrequire(ref->errorCode != 0);
2134 execute(signal, callback, ref->errorCode);
2158 Uint32 hashValue()
const {
2161 bool equal(
const TxHandle&
rec)
const {
2162 return tx_key == rec.tx_key;
2165 Uint32 m_requestInfo;
2171 TransClient::State m_clientState;
2172 Uint32 m_clientFlags;
2173 BlockReference m_takeOverRef;
2174 Uint32 m_takeOverTransId;
2176 Callback m_callback;
2180 enum { DICT_MAGIC = 0xd1c70003 };
2188 m_clientState = TransClient::StateUndef;
2191 m_takeOverTransId = 0;
2192 m_callback.m_callbackFunction = 0;
2193 m_callback.m_callbackData = 0;
2197 TxHandle(Uint32 the_tx_key) {
2198 tx_key = the_tx_key;
2201 void print(NdbOut&)
const;
2208 bool seizeTxHandle(TxHandlePtr&);
2209 bool findTxHandle(TxHandlePtr&, Uint32 tx_key);
2210 void releaseTxHandle(TxHandlePtr&);
2212 void beginSchemaTrans(
Signal*, TxHandlePtr);
2213 void endSchemaTrans(
Signal*, TxHandlePtr, Uint32
flags = 0);
2215 void handleApiFail(
Signal*, Uint32 failedApiNode);
2216 void takeOverTransClient(
Signal*, SchemaTransPtr);
2217 void runTransClientTakeOver(
Signal*, Uint32 tx_key, Uint32
ret);
2218 void finishApiFail(
Signal*, TxHandlePtr tx_ptr);
2219 void apiFailBlockHandling(
Signal*, Uint32 failedApiNode);
2226 bool findCallback(Callback& callback, Uint32 any_key);
2230 struct CreateTableRec :
public OpRec {
2231 static const OpInfo g_opInfo;
2235 return dict->c_createTableRecPool;
2244 Uint32 m_tabInfoPtrI;
2245 Uint32 m_fragmentsPtrI;
2248 Uint32 m_dihAddFragPtr;
2249 Uint32 m_lqhFragPtr;
2252 Callback m_callback;
2255 bool m_abortPrepareDone;
2258 OpRec(g_opInfo, (Uint32*)&m_request) {
2259 memset(&m_request, 0,
sizeof(m_request));
2260 m_tabInfoPtrI = RNIL;
2261 m_fragmentsPtrI = RNIL;
2262 m_dihAddFragPtr = RNIL;
2263 m_lqhFragPtr = RNIL;
2264 m_abortPrepareDone =
false;
2268 void print(NdbOut&)
const;
2276 bool createTable_seize(SchemaOpPtr);
2277 void createTable_release(SchemaOpPtr);
2279 void createTable_parse(
Signal*,
bool master,
2281 bool createTable_subOps(
Signal*, SchemaOpPtr);
2282 void createTable_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2284 void createTable_prepare(
Signal*, SchemaOpPtr);
2285 void createTable_commit(
Signal*, SchemaOpPtr);
2286 void createTable_complete(
Signal*, SchemaOpPtr);
2288 void createTable_abortParse(
Signal*, SchemaOpPtr);
2289 void createTable_abortPrepare(
Signal*, SchemaOpPtr);
2292 void createTab_writeTableConf(
Signal*, Uint32 op_key, Uint32
ret);
2293 void createTab_local(
Signal*, SchemaOpPtr, OpSection fragSec, Callback*);
2294 void createTab_dih(
Signal*, SchemaOpPtr);
2295 void createTab_localComplete(
Signal*, Uint32 op_key, Uint32
ret);
2298 void createTab_activate(
Signal*, SchemaOpPtr, Callback*);
2299 void createTab_alterComplete(
Signal*, Uint32 op_key, Uint32
ret);
2302 void createTable_abortLocalConf(
Signal*, Uint32 aux_op_key, Uint32
ret);
2306 struct DropTableRec :
public OpRec {
2307 static const OpInfo g_opInfo;
2311 return dict->c_dropTableRecPool;
2320 enum { BlockCount = 5 };
2321 Uint32 m_blockNo[BlockCount];
2322 Callback m_callback;
2325 OpRec(g_opInfo, (Uint32*)&m_request) {
2326 memset(&m_request, 0,
sizeof(m_request));
2331 void print(NdbOut&)
const;
2339 bool dropTable_seize(SchemaOpPtr);
2340 void dropTable_release(SchemaOpPtr);
2342 void dropTable_parse(
Signal*,
bool master,
2344 bool dropTable_subOps(
Signal*, SchemaOpPtr);
2345 void dropTable_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2347 void dropTable_prepare(
Signal*, SchemaOpPtr);
2348 void dropTable_commit(
Signal*, SchemaOpPtr);
2349 void dropTable_complete(
Signal*, SchemaOpPtr);
2351 void dropTable_abortParse(
Signal*, SchemaOpPtr);
2352 void dropTable_abortPrepare(
Signal*, SchemaOpPtr);
2355 void dropTable_backup_mutex_locked(
Signal*, Uint32 op_key, Uint32
ret);
2358 void dropTable_commit_nextStep(
Signal*, SchemaOpPtr);
2359 void dropTable_commit_fromLocal(
Signal*, Uint32 op_key, Uint32 errorCode);
2360 void dropTable_commit_done(
Signal*, SchemaOpPtr);
2363 void dropTable_complete_nextStep(
Signal*, SchemaOpPtr);
2364 void dropTable_complete_fromLocal(
Signal*, Uint32 op_key);
2365 void dropTable_complete_done(
Signal*, Uint32 op_key, Uint32
ret);
2369 struct AlterTableRec :
public OpRec {
2370 static const OpInfo g_opInfo;
2374 return dict->c_alterTableRecPool;
2380 Uint32 m_newAttrData[2 * MAX_ATTRIBUTES_IN_TABLE];
2386 TableRecordPtr m_tablePtr;
2387 TableRecordPtr m_newTablePtr;
2388 Uint32 m_newTable_realObjectId;
2395 Uint32 m_dihAddFragPtr;
2396 Uint32 m_lqhFragPtr;
2399 enum { BlockCount = 3 };
2400 Uint32 m_blockNo[BlockCount];
2401 Uint32 m_blockIndex;
2404 bool m_sub_reorg_commit;
2405 bool m_sub_reorg_complete;
2406 bool m_sub_add_frag;
2407 Uint32 m_sub_add_frag_index_ptr;
2409 bool m_sub_copy_data;
2410 bool m_sub_suma_enable;
2411 bool m_sub_suma_filter;
2414 OpRec(g_opInfo, (Uint32*)&m_request) {
2415 memset(&m_request, 0,
sizeof(m_request));
2416 memset(&m_newAttrData, 0,
sizeof(m_newAttrData));
2417 m_tablePtr.setNull();
2418 m_newTablePtr.setNull();
2419 m_dihAddFragPtr = RNIL;
2420 m_lqhFragPtr = RNIL;
2421 m_blockNo[0] = DBLQH;
2422 m_blockNo[1] = DBDIH;
2423 m_blockNo[2] = DBTC;
2425 m_sub_add_frag_index_ptr = RNIL;
2426 m_sub_add_frag =
false;
2427 m_sub_reorg_commit =
false;
2428 m_sub_reorg_complete =
false;
2429 m_sub_trigger =
false;
2430 m_sub_copy_data =
false;
2431 m_sub_suma_enable =
false;
2432 m_sub_suma_filter =
false;
2435 void print(NdbOut&)
const;
2443 bool alterTable_seize(SchemaOpPtr);
2444 void alterTable_release(SchemaOpPtr);
2446 void alterTable_parse(
Signal*,
bool master,
2448 bool alterTable_subOps(
Signal*, SchemaOpPtr);
2449 void alterTable_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2451 void alterTable_prepare(
Signal*, SchemaOpPtr);
2452 void alterTable_commit(
Signal*, SchemaOpPtr);
2453 void alterTable_complete(
Signal*, SchemaOpPtr);
2455 void alterTable_abortParse(
Signal*, SchemaOpPtr);
2456 void alterTable_abortPrepare(
Signal*, SchemaOpPtr);
2458 void alterTable_toCopyData(
Signal* signal, SchemaOpPtr op_ptr);
2459 void alterTable_fromCopyData(
Signal*, Uint32 op_key, Uint32
ret);
2462 void alterTable_backup_mutex_locked(
Signal*, Uint32 op_key, Uint32
ret);
2463 void alterTable_toLocal(
Signal*, SchemaOpPtr);
2464 void alterTable_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
2466 void alterTable_toAlterIndex(
Signal*, SchemaOpPtr);
2467 void alterTable_fromAlterIndex(
Signal*, Uint32 op_key, Uint32
ret);
2469 void alterTable_toReorgTable(
Signal*, SchemaOpPtr, Uint32 step);
2470 void alterTable_fromReorgTable(
Signal*, Uint32 op_key, Uint32
ret);
2472 void alterTable_toCreateTrigger(
Signal* signal, SchemaOpPtr op_ptr);
2473 void alterTable_fromCreateTrigger(
Signal*, Uint32 op_key, Uint32
ret);
2475 void alterTable_toSumaSync(
Signal* signal, SchemaOpPtr op_ptr, Uint32);
2478 void alterTable_toCommitComplete(
Signal*, SchemaOpPtr, Uint32 = ~Uint32(0));
2479 void alterTable_fromCommitComplete(
Signal*, Uint32 op_key, Uint32
ret);
2480 void alterTab_writeTableConf(
Signal*, Uint32 op_key, Uint32
ret);
2483 void alterTable_abortToLocal(
Signal*, SchemaOpPtr);
2484 void alterTable_abortFromLocal(
Signal*, Uint32 op_key, Uint32
ret);
2486 Uint32 check_supported_add_fragment(Uint16*,
const Uint16*);
2487 Uint32 check_supported_reorg(Uint32, Uint32);
2495 } AttributeMap[MAX_ATTRIBUTES_IN_INDEX];
2497 struct CreateIndexRec :
public OpRec {
2499 char m_indexName[MAX_TAB_NAME_SIZE];
2502 AttributeMap m_attrMap;
2504 Uint32 m_fragmentType;
2505 Uint32 m_indexKeyLength;
2508 static const OpInfo g_opInfo;
2512 return dict->c_createIndexRecPool;
2516 bool m_sub_create_table;
2517 bool m_sub_alter_index;
2520 OpRec(g_opInfo, (Uint32*)&m_request) {
2521 memset(&m_request, 0,
sizeof(m_request));
2522 memset(m_indexName, 0,
sizeof(m_indexName));
2523 memset(&m_attrList, 0,
sizeof(m_attrList));
2525 memset(m_attrMap, 0,
sizeof(m_attrMap));
2528 m_indexKeyLength = 0;
2529 m_sub_create_table =
false;
2530 m_sub_alter_index =
false;
2533 void print(NdbOut&)
const;
2541 bool createIndex_seize(SchemaOpPtr);
2542 void createIndex_release(SchemaOpPtr);
2544 void createIndex_parse(
Signal*,
bool master,
2546 bool createIndex_subOps(
Signal*, SchemaOpPtr);
2547 void createIndex_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2549 void createIndex_prepare(
Signal*, SchemaOpPtr);
2550 void createIndex_commit(
Signal*, SchemaOpPtr);
2551 void createIndex_complete(
Signal*, SchemaOpPtr);
2553 void createIndex_abortParse(
Signal*, SchemaOpPtr);
2554 void createIndex_abortPrepare(
Signal*, SchemaOpPtr);
2557 void createIndex_toCreateTable(
Signal*, SchemaOpPtr);
2558 void createIndex_fromCreateTable(
Signal*, Uint32 op_key, Uint32
ret);
2559 void createIndex_toAlterIndex(
Signal*, SchemaOpPtr);
2560 void createIndex_fromAlterIndex(
Signal*, Uint32 op_key, Uint32
ret);
2564 struct DropIndexRec :
public OpRec {
2568 static const OpInfo g_opInfo;
2572 return dict->c_dropIndexRecPool;
2576 bool m_sub_alter_index;
2577 bool m_sub_drop_table;
2580 OpRec(g_opInfo, (Uint32*)&m_request) {
2581 memset(&m_request, 0,
sizeof(m_request));
2582 m_sub_alter_index =
false;
2583 m_sub_drop_table =
false;
2586 void print(NdbOut&)
const;
2594 bool dropIndex_seize(SchemaOpPtr);
2595 void dropIndex_release(SchemaOpPtr);
2597 void dropIndex_parse(
Signal*,
bool master,
2599 bool dropIndex_subOps(
Signal*, SchemaOpPtr);
2600 void dropIndex_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2602 void dropIndex_prepare(
Signal*, SchemaOpPtr);
2603 void dropIndex_commit(
Signal*, SchemaOpPtr);
2604 void dropIndex_complete(
Signal*, SchemaOpPtr);
2606 void dropIndex_abortParse(
Signal*, SchemaOpPtr);
2607 void dropIndex_abortPrepare(
Signal*, SchemaOpPtr);
2610 void dropIndex_toDropTable(
Signal*, SchemaOpPtr);
2611 void dropIndex_fromDropTable(
Signal*, Uint32 op_key, Uint32
ret);
2612 void dropIndex_toAlterIndex(
Signal*, SchemaOpPtr);
2613 void dropIndex_fromAlterIndex(
Signal*, Uint32 op_key, Uint32
ret);
2617 struct TriggerTmpl {
2618 const char* nameFormat;
2622 static const TriggerTmpl g_hashIndexTriggerTmpl[1];
2623 static const TriggerTmpl g_orderedIndexTriggerTmpl[1];
2624 static const TriggerTmpl g_buildIndexConstraintTmpl[1];
2625 static const TriggerTmpl g_reorgTriggerTmpl[1];
2627 struct AlterIndexRec :
public OpRec {
2633 static const OpInfo g_opInfo;
2637 return dict->c_alterIndexRecPool;
2641 const TriggerTmpl* m_triggerTmpl;
2643 bool m_sub_build_index;
2644 bool m_sub_index_stat_dml;
2645 bool m_sub_index_stat_mon;
2648 bool m_tc_index_done;
2651 Uint32 m_dihAddFragPtr;
2652 Uint32 m_lqhFragPtr;
2655 OpRec(g_opInfo, (Uint32*)&m_request) {
2656 memset(&m_request, 0,
sizeof(m_request));
2657 memset(&m_attrList, 0,
sizeof(m_attrList));
2660 m_sub_trigger =
false;
2661 m_sub_build_index =
false;
2662 m_sub_index_stat_dml =
false;
2663 m_sub_index_stat_mon =
false;
2664 m_tc_index_done =
false;
2668 void print(NdbOut&)
const;
2676 bool alterIndex_seize(SchemaOpPtr);
2677 void alterIndex_release(SchemaOpPtr);
2679 void alterIndex_parse(
Signal*,
bool master,
2681 bool alterIndex_subOps(
Signal*, SchemaOpPtr);
2682 void alterIndex_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2684 void alterIndex_prepare(
Signal*, SchemaOpPtr);
2685 void alterIndex_commit(
Signal*, SchemaOpPtr);
2686 void alterIndex_complete(
Signal*, SchemaOpPtr);
2688 void alterIndex_abortParse(
Signal*, SchemaOpPtr);
2689 void alterIndex_abortPrepare(
Signal*, SchemaOpPtr);
2692 void set_index_stat_frag(
Signal*, TableRecordPtr indexPtr);
2695 void alterIndex_toCreateTrigger(
Signal*, SchemaOpPtr);
2696 void alterIndex_atCreateTrigger(
Signal*, SchemaOpPtr);
2697 void alterIndex_fromCreateTrigger(
Signal*, Uint32 op_key, Uint32
ret);
2698 void alterIndex_toDropTrigger(
Signal*, SchemaOpPtr);
2699 void alterIndex_atDropTrigger(
Signal*, SchemaOpPtr);
2700 void alterIndex_fromDropTrigger(
Signal*, Uint32 op_key, Uint32
ret);
2701 void alterIndex_toBuildIndex(
Signal*, SchemaOpPtr);
2702 void alterIndex_fromBuildIndex(
Signal*, Uint32 op_key, Uint32
ret);
2703 void alterIndex_toIndexStat(
Signal*, SchemaOpPtr);
2704 void alterIndex_fromIndexStat(
Signal*, Uint32 op_key, Uint32
ret);
2707 void alterIndex_toCreateLocal(
Signal*, SchemaOpPtr);
2708 void alterIndex_toDropLocal(
Signal*, SchemaOpPtr);
2709 void alterIndex_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
2711 void alterIndex_toAddPartitions(
Signal*, SchemaOpPtr);
2712 void alterIndex_fromAddPartitions(
Signal*, Uint32 op_key, Uint32
ret);
2715 void alterIndex_abortFromLocal(
Signal*, Uint32 op_key, Uint32
ret);
2722 struct BuildIndexRec :
public OpRec {
2723 static const OpInfo g_opInfo;
2727 return dict->c_buildIndexRecPool;
2733 FragAttributeList m_tableKeyList;
2737 const TriggerTmpl* m_triggerTmpl;
2738 Uint32 m_subOpCount;
2739 Uint32 m_subOpIndex;
2745 OpRec(g_opInfo, (Uint32*)&m_request) {
2746 memset(&m_request, 0,
sizeof(m_request));
2747 memset(&m_indexKeyList, 0,
sizeof(m_indexKeyList));
2748 memset(&m_tableKeyList, 0,
sizeof(m_tableKeyList));
2761 bool buildIndex_seize(SchemaOpPtr);
2762 void buildIndex_release(SchemaOpPtr);
2764 void buildIndex_parse(
Signal*,
bool master,
2766 bool buildIndex_subOps(
Signal*, SchemaOpPtr);
2767 void buildIndex_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2769 void buildIndex_prepare(
Signal*, SchemaOpPtr);
2770 void buildIndex_commit(
Signal*, SchemaOpPtr);
2771 void buildIndex_complete(
Signal*, SchemaOpPtr);
2773 void buildIndex_abortParse(
Signal*, SchemaOpPtr);
2774 void buildIndex_abortPrepare(
Signal*, SchemaOpPtr);
2777 void buildIndex_toCreateConstraint(
Signal*, SchemaOpPtr);
2778 void buildIndex_atCreateConstraint(
Signal*, SchemaOpPtr);
2779 void buildIndex_fromCreateConstraint(
Signal*, Uint32 op_key, Uint32
ret);
2781 void buildIndex_toBuildIndex(
Signal*, SchemaOpPtr);
2782 void buildIndex_fromBuildIndex(
Signal*, Uint32 op_key, Uint32
ret);
2784 void buildIndex_toDropConstraint(
Signal*, SchemaOpPtr);
2785 void buildIndex_atDropConstraint(
Signal*, SchemaOpPtr);
2786 void buildIndex_fromDropConstraint(
Signal*, Uint32 op_key, Uint32
ret);
2789 void buildIndex_toLocalBuild(
Signal*, SchemaOpPtr);
2790 void buildIndex_fromLocalBuild(
Signal*, Uint32 op_key, Uint32
ret);
2793 void buildIndex_toLocalOnline(
Signal*, SchemaOpPtr);
2794 void buildIndex_fromLocalOnline(
Signal*, Uint32 op_key, Uint32
ret);
2798 struct IndexStatRec :
public OpRec {
2799 static const OpInfo g_opInfo;
2803 return dict->c_indexStatRecPool;
2809 const TriggerTmpl* m_triggerTmpl;
2810 Uint32 m_subOpCount;
2811 Uint32 m_subOpIndex;
2814 OpRec(g_opInfo, (Uint32*)&m_request) {
2815 memset(&m_request, 0,
sizeof(m_request));
2824 Uint32 c_indexStatAutoCreate;
2825 Uint32 c_indexStatAutoUpdate;
2826 Uint32 c_indexStatBgId;
2829 bool indexStat_seize(SchemaOpPtr);
2830 void indexStat_release(SchemaOpPtr);
2832 void indexStat_parse(
Signal*,
bool master,
2834 bool indexStat_subOps(
Signal*, SchemaOpPtr);
2835 void indexStat_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2837 void indexStat_prepare(
Signal*, SchemaOpPtr);
2838 void indexStat_commit(
Signal*, SchemaOpPtr);
2839 void indexStat_complete(
Signal*, SchemaOpPtr);
2841 void indexStat_abortParse(
Signal*, SchemaOpPtr);
2842 void indexStat_abortPrepare(
Signal*, SchemaOpPtr);
2845 void indexStat_toIndexStat(
Signal*, SchemaOpPtr, Uint32 requestType);
2846 void indexStat_fromIndexStat(
Signal*, Uint32 op_key, Uint32
ret);
2849 void indexStat_toLocalStat(
Signal*, SchemaOpPtr);
2850 void indexStat_fromLocalStat(
Signal*, Uint32 op_key, Uint32
ret);
2853 void indexStatBg_process(
Signal*);
2854 void indexStatBg_fromBeginTrans(
Signal*, Uint32 tx_key, Uint32
ret);
2855 void indexStatBg_fromIndexStat(
Signal*, Uint32 tx_key, Uint32
ret);
2856 void indexStatBg_fromEndTrans(
Signal*, Uint32 tx_key, Uint32
ret);
2857 void indexStatBg_sendContinueB(
Signal*);
2861 struct HashMapRecord {
2870 Uint32 m_object_version;
2884 Uint32 hashValue()
const {
return key;}
2885 bool equal(
const HashMapRecord& obj)
const {
return key == obj.key;}
2892 HashMap_pool c_hash_map_pool;
2893 HashMap_hash c_hash_map_hash;
2894 RSS_AP_SNAPSHOT(c_hash_map_pool);
2895 RSS_AP_SNAPSHOT(g_hash_map);
2897 struct CreateHashMapRec :
public OpRec {
2898 static const OpInfo g_opInfo;
2902 return dict->c_createHashMapRecPool;
2907 CreateHashMapRec() :
2908 OpRec(g_opInfo, (Uint32*)&m_request) {
2909 memset(&m_request, 0,
sizeof(m_request));
2915 void execCREATE_HASH_MAP_REQ(
Signal* signal);
2918 bool createHashMap_seize(SchemaOpPtr);
2919 void createHashMap_release(SchemaOpPtr);
2921 void createHashMap_parse(
Signal*,
bool master,
2923 bool createHashMap_subOps(
Signal*, SchemaOpPtr);
2924 void createHashMap_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2926 void createHashMap_prepare(
Signal*, SchemaOpPtr);
2927 void createHashMap_writeObjConf(
Signal* signal, Uint32, Uint32);
2928 void createHashMap_commit(
Signal*, SchemaOpPtr);
2929 void createHashMap_complete(
Signal*, SchemaOpPtr);
2931 void createHashMap_abortParse(
Signal*, SchemaOpPtr);
2932 void createHashMap_abortPrepare(
Signal*, SchemaOpPtr);
2938 struct CopyDataRec :
public OpRec {
2939 static const OpInfo g_opInfo;
2943 return dict->c_copyDataRecPool;
2949 OpRec(g_opInfo, (Uint32*)&m_request) {
2950 memset(&m_request, 0,
sizeof(m_request));
2956 void execCOPY_DATA_REQ(
Signal* signal);
2957 void execCOPY_DATA_REF(
Signal* signal);
2958 void execCOPY_DATA_CONF(
Signal* signal);
2959 void execCOPY_DATA_IMPL_REF(
Signal* signal);
2960 void execCOPY_DATA_IMPL_CONF(
Signal* signal);
2963 bool copyData_seize(SchemaOpPtr);
2964 void copyData_release(SchemaOpPtr);
2966 void copyData_parse(
Signal*,
bool master,
2968 bool copyData_subOps(
Signal*, SchemaOpPtr);
2969 void copyData_reply(
Signal*, SchemaOpPtr, ErrorInfo);
2971 void copyData_prepare(
Signal*, SchemaOpPtr);
2972 void copyData_fromLocal(
Signal*, Uint32, Uint32);
2973 void copyData_commit(
Signal*, SchemaOpPtr);
2974 void copyData_complete(
Signal*, SchemaOpPtr);
2976 void copyData_abortParse(
Signal*, SchemaOpPtr);
2977 void copyData_abortPrepare(
Signal*, SchemaOpPtr);
2982 struct OpSignalUtil : OpRecordCommon{
2983 Callback m_callback;
2991 struct OpSubEvent : OpRecordCommon {
2993 Uint32 m_senderData;
2997 Uint32 m_subscriptionId;
2998 Uint32 m_subscriptionKey;
2999 Uint32 m_subscriberRef;
3000 Uint32 m_subscriberData;
3001 Uint8 m_buckets_per_ng[256];
3013 struct OpCreateEvent : OpRecordCommon {
3025 CreateEvntReq::RequestType m_requestType;
3033 memset(&m_request, 0,
sizeof(m_request));
3034 m_requestType = CreateEvntReq::RT_UNDEFINED;
3035 m_errorCode = CreateEvntRef::NoError;
3041 m_errorCode = CreateEvntRef::NoError;
3044 m_requestType = req->getRequestType();
3047 return m_errorCode != CreateEvntRef::NoError;
3050 if (ref != 0 && ! hasError()) {
3051 m_errorCode = ref->getErrorCode();
3052 m_errorLine = ref->getErrorLine();
3053 m_errorNode = ref->getErrorNode();
3063 struct OpDropEvent : OpRecordCommon {
3075 memset(&m_request, 0,
sizeof(m_request));
3087 return m_errorCode != 0;
3090 if (ref != 0 && ! hasError()) {
3091 m_errorCode = ref->getErrorCode();
3092 m_errorLine = ref->getErrorLine();
3093 m_errorNode = ref->getErrorNode();
3100 struct CreateTriggerRec :
public OpRec {
3101 static const OpInfo g_opInfo;
3105 return dict->c_createTriggerRecPool;
3110 char m_triggerName[MAX_TAB_NAME_SIZE];
3116 Uint32 m_block_list[1];
3118 CreateTriggerRec() :
3119 OpRec(g_opInfo, (Uint32*)&m_request) {
3120 memset(&m_request, 0,
sizeof(m_request));
3121 memset(m_triggerName, 0,
sizeof(m_triggerName));
3133 bool createTrigger_seize(SchemaOpPtr);
3134 void createTrigger_release(SchemaOpPtr);
3136 void createTrigger_parse(
Signal*,
bool master,
3138 void createTrigger_parse_endpoint(
Signal*, SchemaOpPtr op_ptr, ErrorInfo&);
3139 bool createTrigger_subOps(
Signal*, SchemaOpPtr);
3140 void createTrigger_toCreateEndpoint(
Signal*, SchemaOpPtr,
3141 CreateTrigReq::EndpointFlag);
3142 void createTrigger_fromCreateEndpoint(
Signal*, Uint32, Uint32);
3143 void createTrigger_create_drop_trigger_operation(
Signal*,SchemaOpPtr,
3146 void createTrigger_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3148 void createTrigger_prepare(
Signal*, SchemaOpPtr);
3149 void createTrigger_prepare_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
3150 void createTrigger_commit(
Signal*, SchemaOpPtr);
3151 void createTrigger_commit_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
3152 void createTrigger_complete(
Signal*, SchemaOpPtr);
3154 void createTrigger_abortParse(
Signal*, SchemaOpPtr);
3155 void createTrigger_abortPrepare(
Signal*, SchemaOpPtr);
3156 void createTrigger_abortPrepare_fromLocal(
Signal*, Uint32, Uint32);
3157 void send_create_trig_req(
Signal*, SchemaOpPtr);
3161 struct DropTriggerRec :
public OpRec {
3162 static const OpInfo g_opInfo;
3166 return dict->c_dropTriggerRecPool;
3171 char m_triggerName[MAX_TAB_NAME_SIZE];
3176 Uint32 m_block_list[1];
3179 OpRec(g_opInfo, (Uint32*)&m_request) {
3180 memset(&m_request, 0,
sizeof(m_request));
3181 memset(m_triggerName, 0,
sizeof(m_triggerName));
3192 bool dropTrigger_seize(SchemaOpPtr);
3193 void dropTrigger_release(SchemaOpPtr);
3195 void dropTrigger_parse(
Signal*,
bool master,
3197 void dropTrigger_parse_endpoint(
Signal*, SchemaOpPtr op_ptr, ErrorInfo&);
3198 bool dropTrigger_subOps(
Signal*, SchemaOpPtr);
3199 void dropTrigger_toDropEndpoint(
Signal*, SchemaOpPtr,
3200 DropTrigReq::EndpointFlag);
3201 void dropTrigger_fromDropEndpoint(
Signal*, Uint32, Uint32);
3202 void dropTrigger_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3204 void dropTrigger_prepare(
Signal*, SchemaOpPtr);
3205 void dropTrigger_commit(
Signal*, SchemaOpPtr);
3206 void dropTrigger_commit_fromLocal(
Signal*, Uint32, Uint32);
3207 void dropTrigger_complete(
Signal*, SchemaOpPtr);
3209 void dropTrigger_abortParse(
Signal*, SchemaOpPtr);
3210 void dropTrigger_abortPrepare(
Signal*, SchemaOpPtr);
3212 void send_drop_trig_req(
Signal*, SchemaOpPtr);
3217 struct CreateFilegroupRec :
public OpRec {
3218 bool m_parsed, m_prepared;
3220 Uint32 m_warningFlags;
3223 static const OpInfo g_opInfo;
3227 return dict->c_createFilegroupRecPool;
3230 CreateFilegroupRec() :
3231 OpRec(g_opInfo, (Uint32*)&m_request) {
3232 memset(&m_request, 0,
sizeof(m_request));
3233 m_parsed = m_prepared =
false;
3242 bool createFilegroup_seize(SchemaOpPtr);
3243 void createFilegroup_release(SchemaOpPtr);
3245 void createFilegroup_parse(
Signal*,
bool master,
3247 bool createFilegroup_subOps(
Signal*, SchemaOpPtr);
3248 void createFilegroup_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3250 void createFilegroup_prepare(
Signal*, SchemaOpPtr);
3251 void createFilegroup_commit(
Signal*, SchemaOpPtr);
3252 void createFilegroup_complete(
Signal*, SchemaOpPtr);
3254 void createFilegroup_abortParse(
Signal*, SchemaOpPtr);
3255 void createFilegroup_abortPrepare(
Signal*, SchemaOpPtr);
3257 void createFilegroup_fromLocal(
Signal*, Uint32, Uint32);
3258 void createFilegroup_fromWriteObjInfo(
Signal*, Uint32, Uint32);
3262 struct CreateFileRec :
public OpRec {
3263 bool m_parsed, m_prepared;
3265 Uint32 m_warningFlags;
3268 static const OpInfo g_opInfo;
3272 return dict->c_createFileRecPool;
3276 OpRec(g_opInfo, (Uint32*)&m_request) {
3277 memset(&m_request, 0,
sizeof(m_request));
3278 m_parsed = m_prepared =
false;
3287 bool createFile_seize(SchemaOpPtr);
3288 void createFile_release(SchemaOpPtr);
3290 void createFile_parse(
Signal*,
bool master,
3292 bool createFile_subOps(
Signal*, SchemaOpPtr);
3293 void createFile_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3295 void createFile_prepare(
Signal*, SchemaOpPtr);
3296 void createFile_commit(
Signal*, SchemaOpPtr);
3297 void createFile_complete(
Signal*, SchemaOpPtr);
3299 void createFile_abortParse(
Signal*, SchemaOpPtr);
3300 void createFile_abortPrepare(
Signal*, SchemaOpPtr);
3302 void createFile_fromLocal(
Signal*, Uint32, Uint32);
3303 void createFile_fromWriteObjInfo(
Signal*, Uint32, Uint32);
3307 struct DropFilegroupRec :
public OpRec {
3308 bool m_parsed, m_prepared;
3312 static const OpInfo g_opInfo;
3316 return dict->c_dropFilegroupRecPool;
3319 DropFilegroupRec() :
3320 OpRec(g_opInfo, (Uint32*)&m_request) {
3321 memset(&m_request, 0,
sizeof(m_request));
3322 m_parsed = m_prepared =
false;
3330 bool dropFilegroup_seize(SchemaOpPtr);
3331 void dropFilegroup_release(SchemaOpPtr);
3333 void dropFilegroup_parse(
Signal*,
bool master,
3335 bool dropFilegroup_subOps(
Signal*, SchemaOpPtr);
3336 void dropFilegroup_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3338 void dropFilegroup_prepare(
Signal*, SchemaOpPtr);
3339 void dropFilegroup_commit(
Signal*, SchemaOpPtr);
3340 void dropFilegroup_complete(
Signal*, SchemaOpPtr);
3342 void dropFilegroup_abortParse(
Signal*, SchemaOpPtr);
3343 void dropFilegroup_abortPrepare(
Signal*, SchemaOpPtr);
3345 void dropFilegroup_fromLocal(
Signal*, Uint32, Uint32);
3349 struct DropFileRec :
public OpRec {
3350 bool m_parsed, m_prepared;
3354 static const OpInfo g_opInfo;
3358 return dict->c_dropFileRecPool;
3362 OpRec(g_opInfo, (Uint32*)&m_request) {
3363 memset(&m_request, 0,
sizeof(m_request));
3364 m_parsed = m_prepared =
false;
3372 bool dropFile_seize(SchemaOpPtr);
3373 void dropFile_release(SchemaOpPtr);
3375 void dropFile_parse(
Signal*,
bool master,
3377 bool dropFile_subOps(
Signal*, SchemaOpPtr);
3378 void dropFile_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3380 void dropFile_prepare(
Signal*, SchemaOpPtr);
3381 void dropFile_commit(
Signal*, SchemaOpPtr);
3382 void dropFile_complete(
Signal*, SchemaOpPtr);
3384 void dropFile_abortParse(
Signal*, SchemaOpPtr);
3385 void dropFile_abortPrepare(
Signal*, SchemaOpPtr);
3387 void dropFile_fromLocal(
Signal*, Uint32, Uint32);
3391 struct CreateNodegroupRec :
public OpRec {
3396 static const OpInfo g_opInfo;
3400 return dict->c_createNodegroupRecPool;
3403 CreateNodegroupRec() :
3404 OpRec(g_opInfo, (Uint32*)&m_request) {
3405 memset(&m_request, 0,
sizeof(m_request));
3406 m_map_created =
false;
3407 m_blockIndex = RNIL;
3409 m_cnt_waitGCP = RNIL;
3410 m_wait_gcp_type = RNIL;
3411 m_substartstop_blocked =
false;
3412 m_gcp_blocked =
false;
3415 enum { BlockCount = 3 };
3416 Uint32 m_blockNo[BlockCount];
3417 Uint32 m_blockIndex;
3419 Uint32 m_cnt_waitGCP;
3420 Uint32 m_wait_gcp_type;
3422 bool m_substartstop_blocked;
3429 void execCREATE_NODEGROUP_REQ(
Signal*);
3430 void execCREATE_NODEGROUP_IMPL_REF(
Signal*);
3431 void execCREATE_NODEGROUP_IMPL_CONF(
Signal*);
3433 bool createNodegroup_seize(SchemaOpPtr);
3434 void createNodegroup_release(SchemaOpPtr);
3436 void createNodegroup_parse(
Signal*,
bool master,
3438 bool createNodegroup_subOps(
Signal*, SchemaOpPtr);
3439 void createNodegroup_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3441 void createNodegroup_prepare(
Signal*, SchemaOpPtr);
3442 void createNodegroup_commit(
Signal*, SchemaOpPtr);
3443 void createNodegroup_complete(
Signal*, SchemaOpPtr);
3445 void createNodegroup_abortParse(
Signal*, SchemaOpPtr);
3446 void createNodegroup_abortPrepare(
Signal*, SchemaOpPtr);
3448 void createNodegroup_toLocal(
Signal*, SchemaOpPtr);
3449 void createNodegroup_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
3450 void createNodegroup_fromCreateHashMap(
Signal*, Uint32 op_key, Uint32
ret);
3451 void createNodegroup_fromWaitGCP(
Signal*, Uint32 op_key, Uint32
ret);
3452 void createNodegroup_fromBlockSubStartStop(
Signal*, Uint32 op_key, Uint32);
3454 void execCREATE_HASH_MAP_REF(
Signal* signal);
3455 void execCREATE_HASH_MAP_CONF(
Signal* signal);
3459 struct DropNodegroupRec :
public OpRec {
3463 static const OpInfo g_opInfo;
3467 return dict->c_dropNodegroupRecPool;
3470 DropNodegroupRec() :
3471 OpRec(g_opInfo, (Uint32*)&m_request) {
3472 memset(&m_request, 0,
sizeof(m_request));
3473 m_blockIndex = RNIL;
3475 m_cnt_waitGCP = RNIL;
3476 m_wait_gcp_type = RNIL;
3477 m_gcp_blocked =
false;
3478 m_substartstop_blocked =
false;
3481 enum { BlockCount = 3 };
3482 Uint32 m_blockNo[BlockCount];
3483 Uint32 m_blockIndex;
3485 Uint32 m_cnt_waitGCP;
3486 Uint32 m_wait_gcp_type;
3488 bool m_substartstop_blocked;
3495 void execDROP_NODEGROUP_REQ(
Signal*);
3496 void execDROP_NODEGROUP_IMPL_REF(
Signal*);
3497 void execDROP_NODEGROUP_IMPL_CONF(
Signal*);
3499 bool dropNodegroup_seize(SchemaOpPtr);
3500 void dropNodegroup_release(SchemaOpPtr);
3502 void dropNodegroup_parse(
Signal*,
bool master,
3504 bool dropNodegroup_subOps(
Signal*, SchemaOpPtr);
3505 void dropNodegroup_reply(
Signal*, SchemaOpPtr, ErrorInfo);
3507 void dropNodegroup_prepare(
Signal*, SchemaOpPtr);
3508 void dropNodegroup_commit(
Signal*, SchemaOpPtr);
3509 void dropNodegroup_complete(
Signal*, SchemaOpPtr);
3511 void dropNodegroup_abortParse(
Signal*, SchemaOpPtr);
3512 void dropNodegroup_abortPrepare(
Signal*, SchemaOpPtr);
3514 void dropNodegroup_toLocal(
Signal*, SchemaOpPtr);
3515 void dropNodegroup_fromLocal(
Signal*, Uint32 op_key, Uint32
ret);
3516 void dropNodegroup_fromWaitGCP(
Signal*, Uint32 op_key, Uint32
ret);
3517 void dropNodegroup_fromBlockSubStartStop(
Signal*, Uint32 op_key, Uint32);
3524 STATIC_CONST( opCreateEventSize =
sizeof(OpCreateEvent) );
3527 STATIC_CONST( opSignalUtilSize =
sizeof(OpSignalUtil) );
3529 #define PTR_ALIGN(n) ((((n)+sizeof(void*)-1)>>2)&~((sizeof(void*)-1)>>2))
3530 union OpRecordUnion {
3531 Uint32 u_opCreateEvent [PTR_ALIGN(opCreateEventSize)];
3532 Uint32 u_opSubEvent [PTR_ALIGN(opSubEventSize)];
3533 Uint32 u_opDropEvent [PTR_ALIGN(opDropEventSize)];
3534 Uint32 u_opSignalUtil [PTR_ALIGN(opSignalUtilSize)];
3546 Uint32 c_opRecordSequence;
3548 void handleNdbdFailureCallback(
Signal* signal,
3549 Uint32 failedNodeId,
3551 void handleApiFailureCallback(
Signal* signal,
3552 Uint32 failedNodeId,
3559 void sendSTTORRY(
Signal* signal);
3560 void sendNDB_STTORRY(
Signal* signal);
3561 void initSchemaFile(
Signal* signal);
3566 void releaseTableObject(Uint32 tableId,
bool removeFromHash =
true);
3571 Uint32 getFreeObjId(Uint32 minId,
bool both =
false);
3572 Uint32 getFreeTableRecord(Uint32 primaryTableId);
3573 Uint32 getFreeTriggerRecord();
3574 bool getNewAttributeRecord(TableRecordPtr tablePtr,
3575 AttributeRecordPtr & attrPtr);
3576 void packTableIntoPages(
Signal* signal);
3580 const Uint32 undo_free_hi,
3581 const Uint32 undo_free_lo);
3584 void sendGET_TABINFOREQ(
Signal* signal,
3586 void sendTC_SCHVERREQ(
Signal* signal,
3588 BlockReference tcRef);
3593 void initSendSchemaData(
Signal* signal);
3594 void sendSchemaData(
Signal* signal);
3595 Uint32 sendSCHEMA_INFO(
Signal* signal, Uint32 nodeId, Uint32* pagePointer);
3596 void sendDIHSTARTTAB_REQ(
Signal* signal);
3601 void handleTabInfoInit(
Signal*, SchemaTransPtr&,
3603 ParseDictTabInfoRecord *,
3604 bool checkExist =
true);
3608 void handleAddTableFailure(
Signal* signal,
3611 bool verifyTableCorrect(
Signal* signal, Uint32 tableId);
3616 void sendLQHADDATTRREQ(
Signal*, SchemaOpPtr, Uint32 attributePtrI);
3621 void updateSchemaState(
Signal* signal, Uint32 tableId,
3623 bool savetodisk = 1,
bool dicttrans = 0);
3624 void startWriteSchemaFile(
Signal* signal);
3625 void openSchemaFile(
Signal* signal,
3630 void writeSchemaFile(
Signal* signal, Uint32 filePtr, Uint32 fsPtr);
3631 void writeSchemaConf(
Signal* signal,
3632 FsConnectRecordPtr fsPtr);
3633 void closeFile(
Signal* signal, Uint32 filePtr, Uint32 fsPtr);
3634 void closeWriteSchemaConf(
Signal* signal,
3635 FsConnectRecordPtr fsPtr);
3636 void initSchemaFile_conf(
Signal* signal, Uint32 i, Uint32 returnCode);
3638 void writeTableFile(
Signal* signal, Uint32 tableId,
3640 void writeTableFile(
Signal* signal, Uint32 tableId,
3641 OpSection opSection, Callback*);
3642 void startWriteTableFile(
Signal* signal, Uint32 tableId);
3643 void openTableFile(
Signal* signal,
3648 void writeTableFile(
Signal* signal, Uint32 filePtr, Uint32 fsPtr);
3649 void writeTableConf(
Signal* signal,
3650 FsConnectRecordPtr fsPtr);
3651 void closeWriteTableConf(
Signal* signal,
3652 FsConnectRecordPtr fsPtr);
3654 void startReadTableFile(
Signal* signal, Uint32 tableId);
3655 void openReadTableRef(
Signal* signal,
3656 FsConnectRecordPtr fsPtr);
3657 void readTableFile(
Signal* signal, Uint32 filePtr, Uint32 fsPtr);
3658 void readTableConf(
Signal* signal,
3659 FsConnectRecordPtr fsPtr);
3660 void readTableRef(
Signal* signal,
3661 FsConnectRecordPtr fsPtr);
3662 void closeReadTableConf(
Signal* signal,
3663 FsConnectRecordPtr fsPtr);
3665 void startReadSchemaFile(
Signal* signal);
3666 void openReadSchemaRef(
Signal* signal,
3667 FsConnectRecordPtr fsPtr);
3668 void readSchemaFile(
Signal* signal, Uint32 filePtr, Uint32 fsPtr);
3669 void readSchemaConf(
Signal* signal, FsConnectRecordPtr fsPtr);
3670 void readSchemaRef(
Signal* signal, FsConnectRecordPtr fsPtr);
3671 void closeReadSchemaConf(
Signal* signal,
3672 FsConnectRecordPtr fsPtr);
3673 bool convertSchemaFileTo_5_0_6(XSchemaFile*);
3674 bool convertSchemaFileTo_6_4(XSchemaFile*);
3679 void sendGET_TABINFOREF(
Signal* signal,
3681 GetTabInfoRef::ErrorCode errorCode,
3684 void sendGET_TABLEID_REF(
Signal* signal,
3686 GetTableIdRef::ErrorCode errorCode);
3688 void sendGetTabResponse(
Signal* signal);
3695 void activateIndexes(
Signal* signal, Uint32 i);
3696 void activateIndex_fromBeginTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3697 void activateIndex_fromAlterIndex(
Signal*, Uint32 tx_key, Uint32
ret);
3698 void activateIndex_fromEndTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3699 void rebuildIndexes(
Signal* signal, Uint32 i);
3700 void rebuildIndex_fromBeginTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3701 void rebuildIndex_fromBuildIndex(
Signal*, Uint32 tx_key, Uint32
ret);
3702 void rebuildIndex_fromEndTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3706 createEventUTIL_PREPARE(
Signal* signal,
3707 Uint32 callbackData,
3710 createEventUTIL_EXECUTE(
Signal *signal,
3711 Uint32 callbackData,
3714 dropEventUTIL_PREPARE_READ(
Signal* signal,
3715 Uint32 callbackData,
3718 dropEventUTIL_EXECUTE_READ(
Signal* signal,
3719 Uint32 callbackData,
3722 dropEventUTIL_PREPARE_DELETE(
Signal* signal,
3723 Uint32 callbackData,
3726 dropEventUTIL_EXECUTE_DELETE(
Signal *signal,
3727 Uint32 callbackData,
3730 dropEventUtilPrepareRef(
Signal* signal,
3731 Uint32 callbackData,
3734 dropEventUtilExecuteRef(
Signal* signal,
3735 Uint32 callbackData,
3738 sendSignalUtilReq(Callback *c,
3740 GlobalSignalNumber gsn,
3743 JobBufferLevel jbuf,
3745 Uint32 noOfSections);
3747 recvSignalUtilReq(
Signal* signal, Uint32 returnCode);
3749 void completeSubStartReq(
Signal* signal, Uint32 ptrI, Uint32 returnCode);
3750 void completeSubStopReq(
Signal* signal, Uint32 ptrI, Uint32 returnCode);
3751 void completeSubRemoveReq(
Signal* signal, Uint32 ptrI, Uint32 returnCode);
3753 void dropEvent_sendReply(
Signal* signal,
3754 OpDropEventPtr evntRecPtr);
3756 void createEvent_RT_USER_CREATE(
Signal* signal,
3757 OpCreateEventPtr evntRecPtr,
3759 void createEventComplete_RT_USER_CREATE(
Signal* signal,
3760 OpCreateEventPtr evntRecPtr);
3762 void createEventComplete_RT_USER_GET(
Signal* signal, OpCreateEventPtr evntRecPtr);
3764 void createEvent_RT_DICT_AFTER_GET(
Signal* signal, OpCreateEventPtr evntRecPtr);
3766 void createEvent_nodeFailCallback(
Signal* signal, Uint32 eventRecPtrI,
3768 void createEvent_sendReply(
Signal* signal, OpCreateEventPtr evntRecPtr,
3771 void prepareTransactionEventSysTable (Callback *c,
3774 UtilPrepareReq::OperationTypeValue prepReq);
3775 void prepareUtilTransaction(Callback *c,
3779 const char *tableName,
3780 UtilPrepareReq::OperationTypeValue prepReq,
3783 const char *attrNames[]);
3785 void executeTransEventSysTable(Callback *c,
3789 const Uint32 prepareId,
3790 UtilPrepareReq::OperationTypeValue prepReq);
3791 void executeTransaction(Callback *c,
3800 bool upgrade_suma_NotStarted(Uint32 err, Uint32 ref)
const;
3803 void getTableKeyList(TableRecordPtr,
3805 void getIndexAttr(TableRecordPtr indexPtr, Uint32 itAttr, Uint32*
id);
3807 void getIndexAttrMask(TableRecordPtr indexPtr,
AttributeMask& mask);
3812 void initCommonData();
3814 void initConnectRecord();
3815 void initRetrieveRecord(
Signal*, Uint32, Uint32 returnCode);
3816 void initSchemaRecord();
3817 void initRestartRecord(Uint32 sp = 0, Uint32 lp = 0,
3818 const char * sb = 0,
const char * eb = 0);
3819 void initSendSchemaRecord();
3820 void initReadTableRecord();
3821 void initWriteTableRecord();
3822 void initReadSchemaRecord();
3823 void initWriteSchemaRecord();
3825 void initNodeRecords();
3826 void initTableRecords();
3827 void initialiseTableRecord(TableRecordPtr tablePtr);
3828 void initTriggerRecords();
3829 void initialiseTriggerRecord(TriggerRecordPtr triggerPtr);
3830 void initPageRecords();
3832 Uint32 getFsConnRecord();
3834 bool getIsFailed(Uint32 nodeId)
const;
3838 void startRestoreSchema(
Signal*, Callback);
3839 void restartNextPass(
Signal*);
3840 void restart_fromBeginTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3841 void restart_fromEndTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3842 void restartEndPass_fromEndTrans(
Signal*, Uint32 tx_key, Uint32
ret);
3843 void restart_fromWriteSchemaFile(
Signal*, Uint32, Uint32);
3844 void restart_nextOp(
Signal*,
bool commit =
false);
3846 void checkSchemaStatus(
Signal* signal);
3847 void checkPendingSchemaTrans(XSchemaFile* xsf);
3850 void restartCreateObj_readConf(
Signal*, Uint32, Uint32);
3851 void restartCreateObj_getTabInfoConf(
Signal*);
3855 void restart_checkSchemaStatusComplete(
Signal*, Uint32 callback, Uint32);
3856 void masterRestart_checkSchemaStatusComplete(
Signal*, Uint32, Uint32);
3858 void sendSchemaComplete(
Signal*, Uint32 callbackData, Uint32);
3861 void send_drop_file(
Signal*, Uint32, Uint32, DropFileImplReq::RequestInfo);
3862 void send_drop_fg(
Signal*, Uint32, Uint32, DropFilegroupImplReq::RequestInfo);
3864 int checkSingleUserMode(Uint32 senderRef);
3866 friend NdbOut& operator<<(NdbOut& out,
const ErrorInfo&);
3868 friend NdbOut& operator<<(NdbOut& out,
const DictObject&);
3869 friend NdbOut& operator<<(NdbOut& out,
const SchemaOp&);
3870 friend NdbOut& operator<<(NdbOut& out,
const SchemaTrans&);
3871 friend NdbOut& operator<<(NdbOut& out,
const TxHandle&);
3872 void check_consistency();
3873 void check_consistency_entry(TableRecordPtr tablePtr);
3874 void check_consistency_table(TableRecordPtr tablePtr);
3875 void check_consistency_index(TableRecordPtr indexPtr);
3876 void check_consistency_trigger(TriggerRecordPtr triggerPtr);
3877 void check_consistency_object(DictObjectPtr obj_ptr);
3892 struct DictLockType;
3893 friend struct DictLockType;
3896 DictLockReq::LockType lockType;
3899 static const DictLockType* getDictLockType(Uint32 lockType);
3901 void removeStaleDictLocks(
Signal* signal,
const Uint32* theFailedNodes);
3913 Uint32 c_outstanding_sub_startstop;
3916 Uint32 get_default_fragments(
Signal*, Uint32 extra_nodegroups = 0);
3920 void unblock_substartstop();
3921 void wait_substartstop(
Signal* signal, Uint32 opPtrI);
3932 virtual bool getParam(
const char * param, Uint32 * retVal);
3936 Dbdict::TableRecord::isTable()
const
3938 return DictTabInfo::isTable(tableType);
3942 Dbdict::TableRecord::isIndex()
const
3944 return DictTabInfo::isIndex(tableType);
3948 Dbdict::TableRecord::isUniqueIndex()
const
3950 return DictTabInfo::isUniqueIndex(tableType);
3954 Dbdict::TableRecord::isNonUniqueIndex()
const
3956 return DictTabInfo::isNonUniqueIndex(tableType);
3960 Dbdict::TableRecord::isHashIndex()
const
3962 return DictTabInfo::isHashIndex(tableType);
3966 Dbdict::TableRecord::isOrderedIndex()
const
3968 return DictTabInfo::isOrderedIndex(tableType);