mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / src / kernel / blocks / dbdict / Dbdict.hpp
bloba1139edb4eff34b80de39ae8362e632d99791943
1 /* Copyright (c) 2003-2008 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef DBDICT_H
17 #define DBDICT_H
19 /**
20 * Dict : Dictionary Block
22 #include <ndb_limits.h>
23 #include <trigger_definitions.h>
24 #include <pc.hpp>
25 #include <DLHashTable.hpp>
26 #include <DLFifoList.hpp>
27 #include <CArray.hpp>
28 #include <KeyTable.hpp>
29 #include <KeyTable2.hpp>
30 #include <KeyTable2Ref.hpp>
31 #include <SimulatedBlock.hpp>
32 #include <SimpleProperties.hpp>
33 #include <SignalCounter.hpp>
34 #include <Bitmask.hpp>
35 #include <AttributeList.hpp>
36 #include <signaldata/GetTableId.hpp>
37 #include <signaldata/GetTabInfo.hpp>
38 #include <signaldata/DictTabInfo.hpp>
39 #include <signaldata/CreateTable.hpp>
40 #include <signaldata/CreateTab.hpp>
41 #include <signaldata/DropTable.hpp>
42 #include <signaldata/AlterTable.hpp>
43 #include <signaldata/AlterTab.hpp>
44 #include <signaldata/CreateIndx.hpp>
45 #include <signaldata/DropIndx.hpp>
46 #include <signaldata/AlterIndx.hpp>
47 #include <signaldata/BuildIndx.hpp>
48 #include <signaldata/UtilPrepare.hpp>
49 #include <signaldata/CreateEvnt.hpp>
50 #include <signaldata/CreateTrig.hpp>
51 #include <signaldata/DropTrig.hpp>
52 #include <signaldata/AlterTrig.hpp>
53 #include <signaldata/DictLock.hpp>
54 #include <signaldata/SumaImpl.hpp>
55 #include "SchemaFile.hpp"
56 #include <blocks/mutexes.hpp>
57 #include <SafeCounter.hpp>
58 #include <RequestTracker.hpp>
59 #include <Rope.hpp>
60 #include <signaldata/DictObjOp.hpp>
61 #include <signaldata/DropFilegroupImpl.hpp>
62 #include <SLList.hpp>
64 #ifdef DBDICT_C
65 // Debug Macros
67 /*--------------------------------------------------------------*/
68 // Constants for CONTINUEB
69 /*--------------------------------------------------------------*/
70 #define ZPACK_TABLE_INTO_PAGES 0
71 #define ZSEND_GET_TAB_RESPONSE 3
72 #define ZDICT_LOCK_POLL 4
75 /*--------------------------------------------------------------*/
76 // Other constants in alphabetical order
77 /*--------------------------------------------------------------*/
78 #define ZNOMOREPHASES 255
80 /*--------------------------------------------------------------*/
81 // Schema file defines
82 /*--------------------------------------------------------------*/
83 #define ZSCHEMA_WORDS 4
85 /*--------------------------------------------------------------*/
86 // Page constants
87 /*--------------------------------------------------------------*/
88 #define ZBAT_SCHEMA_FILE 0 //Variable number of page for NDBFS
89 #define ZBAT_TABLE_FILE 1 //Variable number of page for NDBFS
90 #define ZPAGE_HEADER_SIZE 32
91 #define ZPOS_PAGE_SIZE 16
92 #define ZPOS_CHECKSUM 17
93 #define ZPOS_VERSION 18
94 #define ZPOS_PAGE_HEADER_SIZE 19
96 /*--------------------------------------------------------------*/
97 // Size constants
98 /*--------------------------------------------------------------*/
99 #define ZFS_CONNECT_SIZE 4
100 #define ZSIZE_OF_PAGES_IN_WORDS 8192
101 #define ZLOG_SIZE_OF_PAGES_IN_WORDS 13
102 #define ZMAX_PAGES_OF_TABLE_DEFINITION 8
103 #define ZNUMBER_OF_PAGES (ZMAX_PAGES_OF_TABLE_DEFINITION + 1)
104 #define ZNO_OF_FRAGRECORD 5
106 /*--------------------------------------------------------------*/
107 // Error codes
108 /*--------------------------------------------------------------*/
109 #define ZNODE_FAILURE_ERROR 704
110 #endif
113 * Systable NDB$EVENTS_0
115 #define EVENT_SYSTEM_TABLE_LENGTH 8
117 struct sysTab_NDBEVENTS_0 {
118 char NAME[MAX_TAB_NAME_SIZE];
119 Uint32 EVENT_TYPE;
120 Uint32 TABLEID;
121 Uint32 TABLEVERSION;
122 char TABLE_NAME[MAX_TAB_NAME_SIZE];
123 Uint32 ATTRIBUTE_MASK[MAXNROFATTRIBUTESINWORDS];
124 Uint32 SUBID;
125 Uint32 SUBKEY;
129 * DICT - This blocks handles all metadata
131 class Dbdict: public SimulatedBlock {
132 public:
134 * 2.3 RECORD AND FILESIZES
138 * Table attributes. Permanent data.
140 * Indexes have an attribute list which duplicates primary table
141 * attributes. This is wrong but convenient.
143 struct AttributeRecord {
144 AttributeRecord(){}
146 /* attribute id */
147 Uint16 attributeId;
149 /* Attribute number within tuple key (counted from 1) */
150 Uint16 tupleKey;
152 /* Attribute name (unique within table) */
153 RopeHandle attributeName;
155 /* Attribute description (old-style packed descriptor) */
156 Uint32 attributeDescriptor;
158 /* Extended attributes */
159 Uint32 extType;
160 Uint32 extPrecision;
161 Uint32 extScale;
162 Uint32 extLength;
164 /* Autoincrement flag, only for ODBC/SQL */
165 bool autoIncrement;
167 /* Default value as null-terminated string, only for ODBC/SQL */
168 RopeHandle defaultValue;
170 struct {
171 Uint32 m_name_len;
172 const char * m_name_ptr;
173 RopePool * m_pool;
174 } m_key;
176 union {
177 Uint32 nextPool;
178 Uint32 nextList;
180 Uint32 prevList;
181 Uint32 nextHash;
182 Uint32 prevHash;
184 Uint32 hashValue() const { return attributeName.hashValue();}
185 bool equal(const AttributeRecord& obj) const {
186 if(obj.hashValue() == hashValue()){
187 ConstRope r(* m_key.m_pool, obj.attributeName);
188 return r.compare(m_key.m_name_ptr, m_key.m_name_len) == 0;
190 return false;
193 /** Singly linked in internal (attributeId) order */
194 // TODO use DL template when possible to have more than 1
195 Uint32 nextAttributeIdPtrI;
197 typedef Ptr<AttributeRecord> AttributeRecordPtr;
198 ArrayPool<AttributeRecord> c_attributeRecordPool;
199 DLHashTable<AttributeRecord> c_attributeRecordHash;
202 * Shared table / index record. Most of this is permanent data stored
203 * on disk. Index trigger ids are volatile.
205 struct TableRecord {
206 TableRecord(){}
207 Uint32 maxRowsLow;
208 Uint32 maxRowsHigh;
209 Uint32 minRowsLow;
210 Uint32 minRowsHigh;
211 /* Table id (array index in DICT and other blocks) */
212 Uint32 tableId;
213 Uint32 m_obj_ptr_i;
215 /* Table version (incremented when tableId is re-used) */
216 Uint32 tableVersion;
218 /* Table name (may not be unique under "alter table") */
219 RopeHandle tableName;
221 /* Type of table or index */
222 DictTabInfo::TableType tableType;
224 /* Is table or index online (this flag is not used in DICT) */
225 bool online;
227 /* Primary table of index otherwise RNIL */
228 Uint32 primaryTableId;
230 /* Type of fragmentation (small/medium/large) */
231 DictTabInfo::FragmentType fragmentType;
233 /* Global checkpoint identity when table created */
234 Uint32 gciTableCreated;
236 /* Is the table logged (i.e. data survives system restart) */
237 enum Bits
239 TR_Logged = 0x1,
240 TR_RowGCI = 0x2,
241 TR_RowChecksum = 0x4,
242 TR_Temporary = 0x8,
243 TR_ForceVarPart = 0x10
245 Uint16 m_bits;
247 /* Number of attibutes in table */
248 Uint16 noOfAttributes;
250 /* Number of null attributes in table (should be computed) */
251 Uint16 noOfNullAttr;
253 /* Number of primary key attributes (should be computed) */
254 Uint16 noOfPrimkey;
256 /* Length of primary key in words (should be computed) */
257 /* For ordered index this is tree node size in words */
258 Uint16 tupKeyLength;
260 /** */
261 Uint16 noOfCharsets;
263 /* K value for LH**3 algorithm (only 6 allowed currently) */
264 Uint8 kValue;
266 /* Local key length in words (currently 1) */
267 Uint8 localKeyLen;
270 * Parameter for hash algorithm that specifies the load factor in
271 * percentage of fill level in buckets. A high value means we are
272 * splitting early and that buckets are only lightly used. A high
273 * value means that we have fill the buckets more and get more
274 * likelihood of overflow buckets.
276 Uint8 maxLoadFactor;
279 Flag to indicate default number of partitions
281 bool defaultNoPartFlag;
284 Flag to indicate using linear hash function
286 bool linearHashFlag;
289 * Used when shrinking to decide when to merge buckets. Hysteresis
290 * is thus possible. Should be smaller but not much smaller than
291 * maxLoadFactor
293 Uint8 minLoadFactor;
295 /* Convenience routines */
296 bool isTable() const;
297 bool isIndex() const;
298 bool isUniqueIndex() const;
299 bool isNonUniqueIndex() const;
300 bool isHashIndex() const;
301 bool isOrderedIndex() const;
303 /****************************************************
304 * Support variables for table handling
305 ****************************************************/
307 /* Active page which is sent to disk */
308 Uint32 activePage;
310 /** File pointer received from disk */
311 Uint32 filePtr[2];
313 /** Pointer to first attribute in table */
314 DLFifoList<AttributeRecord>::Head m_attributes;
316 /* Pointer to first page of table description */
317 Uint32 firstPage;
319 Uint32 nextPool;
321 enum TabState {
322 NOT_DEFINED = 0,
323 DEFINING = 2,
324 DEFINED = 4,
325 PREPARE_DROPPING = 5,
326 DROPPING = 6,
327 BACKUP_ONGOING = 7
329 TabState tabState;
331 /* State when returning from TC_SCHVERREQ */
332 enum TabReturnState {
333 TRS_IDLE = 0,
334 ADD_TABLE = 1,
335 SLAVE_SYSTEM_RESTART = 2,
336 MASTER_SYSTEM_RESTART = 3
338 TabReturnState tabReturnState;
340 /** Number of words */
341 Uint32 packedSize;
343 /** Index state (volatile data) */
344 enum IndexState {
345 IS_UNDEFINED = 0, // initial
346 IS_OFFLINE = 1, // index table created
347 IS_BUILDING = 2, // building (local state)
348 IS_DROPPING = 3, // dropping (local state)
349 IS_ONLINE = 4, // online
350 IS_BROKEN = 9 // build or drop aborted
352 IndexState indexState;
354 /** Trigger ids of index (volatile data) */
355 Uint32 insertTriggerId;
356 Uint32 updateTriggerId;
357 Uint32 deleteTriggerId;
358 Uint32 customTriggerId; // ordered index
359 Uint32 buildTriggerId; // temp during build
361 /** Index state in other blocks on this node */
362 enum IndexLocal {
363 IL_CREATED_TC = 1 << 0 // created in TC
365 Uint32 indexLocal;
367 Uint32 noOfNullBits;
369 /** frm data for this table */
370 RopeHandle frmData;
371 RopeHandle tsData;
372 RopeHandle ngData;
373 RopeHandle rangeData;
375 Uint32 fragmentCount;
376 Uint32 m_tablespace_id;
379 * Access rights to table during single user mode
381 Uint8 singleUserMode;
384 typedef Ptr<TableRecord> TableRecordPtr;
385 ArrayPool<TableRecord> c_tableRecordPool;
387 /** Node Group and Tablespace id+version + range or list data.
388 * This is only stored temporarily in DBDICT during an ongoing
389 * change.
390 * TODO RONM: Look into improvements of this
392 Uint32 c_fragDataLen;
393 Uint16 c_fragData[MAX_NDB_PARTITIONS];
394 Uint32 c_tsIdData[2*MAX_NDB_PARTITIONS];
397 * Triggers. This is volatile data not saved on disk. Setting a
398 * trigger online creates the trigger in TC (if index) and LQH-TUP.
400 struct TriggerRecord {
401 TriggerRecord() {}
403 /** Trigger state */
404 enum TriggerState {
405 TS_NOT_DEFINED = 0,
406 TS_DEFINING = 1,
407 TS_OFFLINE = 2, // created globally in DICT
408 TS_BUILDING = 3,
409 TS_DROPPING = 4,
410 TS_ONLINE = 5 // activated globally
412 TriggerState triggerState;
414 /** Trigger state in other blocks on this node */
415 enum IndexLocal {
416 TL_CREATED_TC = 1 << 0, // created in TC
417 TL_CREATED_LQH = 1 << 1 // created in LQH-TUP
419 Uint32 triggerLocal;
421 /** Trigger name, used by DICT to identify the trigger */
422 RopeHandle triggerName;
424 /** Trigger id, used by TRIX, TC, LQH, and TUP to identify the trigger */
425 Uint32 triggerId;
426 Uint32 m_obj_ptr_i;
428 /** Table id, the table the trigger is defined on */
429 Uint32 tableId;
431 /** Trigger type, defines what the trigger is used for */
432 TriggerType::Value triggerType;
434 /** Trigger action time, defines when the trigger should fire */
435 TriggerActionTime::Value triggerActionTime;
437 /** Trigger event, defines what events the trigger should monitor */
438 TriggerEvent::Value triggerEvent;
440 /** Monitor all replicas */
441 bool monitorReplicas;
443 /** Monitor all, the trigger monitors changes of all attributes in table */
444 bool monitorAllAttributes;
446 /** Monitor all, the trigger monitors changes of all attributes in table */
447 bool reportAllMonitoredAttributes;
450 * Attribute mask, defines what attributes are to be monitored.
451 * Can be seen as a compact representation of SQL column name list.
453 AttributeMask attributeMask;
455 /** Index id, only used by secondary_index triggers */
456 Uint32 indexId;
458 /** Pointer to the next attribute used by ArrayPool */
459 Uint32 nextPool;
462 Uint32 c_maxNoOfTriggers;
463 typedef Ptr<TriggerRecord> TriggerRecordPtr;
464 ArrayPool<TriggerRecord> c_triggerRecordPool;
467 * Information for each FS connection.
468 ***************************************************************************/
469 struct FsConnectRecord {
470 enum FsState {
471 IDLE = 0,
472 OPEN_WRITE_SCHEMA = 1,
473 WRITE_SCHEMA = 2,
474 CLOSE_WRITE_SCHEMA = 3,
475 OPEN_READ_SCHEMA1 = 4,
476 OPEN_READ_SCHEMA2 = 5,
477 READ_SCHEMA1 = 6,
478 READ_SCHEMA2 = 7,
479 CLOSE_READ_SCHEMA = 8,
480 OPEN_READ_TAB_FILE1 = 9,
481 OPEN_READ_TAB_FILE2 = 10,
482 READ_TAB_FILE1 = 11,
483 READ_TAB_FILE2 = 12,
484 CLOSE_READ_TAB_FILE = 13,
485 OPEN_WRITE_TAB_FILE = 14,
486 WRITE_TAB_FILE = 15,
487 CLOSE_WRITE_TAB_FILE = 16
489 /** File Pointer for this file system connection */
490 Uint32 filePtr;
492 /** Reference of owner record */
493 Uint32 ownerPtr;
495 /** State of file system connection */
496 FsState fsState;
498 /** Used by Array Pool for free list handling */
499 Uint32 nextPool;
502 typedef Ptr<FsConnectRecord> FsConnectRecordPtr;
503 ArrayPool<FsConnectRecord> c_fsConnectRecordPool;
506 * This record stores all the information about a node and all its attributes
507 ***************************************************************************/
508 struct NodeRecord {
509 enum NodeState {
510 API_NODE = 0,
511 NDB_NODE_ALIVE = 1,
512 NDB_NODE_DEAD = 2
514 bool hotSpare;
515 NodeState nodeState;
518 typedef Ptr<NodeRecord> NodeRecordPtr;
519 CArray<NodeRecord> c_nodes;
520 NdbNodeBitmask c_aliveNodes;
522 struct PageRecord {
523 Uint32 word[8192];
526 typedef Ptr<PageRecord> PageRecordPtr;
527 CArray<PageRecord> c_pageRecordArray;
529 struct SchemaPageRecord {
530 Uint32 word[NDB_SF_PAGE_SIZE_IN_WORDS];
533 CArray<SchemaPageRecord> c_schemaPageRecordArray;
535 DictTabInfo::Table c_tableDesc;
538 * A page for create index table signal.
540 PageRecord c_indexPage;
542 struct File {
543 File() {}
545 Uint32 key;
546 Uint32 m_magic;
547 Uint32 m_version;
548 Uint32 m_obj_ptr_i;
549 Uint32 m_filegroup_id;
550 Uint32 m_type;
551 Uint64 m_file_size;
552 Uint64 m_file_free;
553 RopeHandle m_path;
555 Uint32 nextList;
556 union {
557 Uint32 prevList;
558 Uint32 nextPool;
560 Uint32 nextHash, prevHash;
562 Uint32 hashValue() const { return key;}
563 bool equal(const File& obj) const { return key == obj.key;}
565 typedef Ptr<File> FilePtr;
566 typedef RecordPool<File, RWPool> File_pool;
567 typedef DLListImpl<File_pool, File> File_list;
568 typedef LocalDLListImpl<File_pool, File> Local_file_list;
569 typedef KeyTableImpl<File_pool, File> File_hash;
571 struct Filegroup {
572 Filegroup(){}
574 Uint32 key;
575 Uint32 m_obj_ptr_i;
576 Uint32 m_magic;
578 Uint32 m_type;
579 Uint32 m_version;
580 RopeHandle m_name;
582 union {
583 struct {
584 Uint32 m_extent_size;
585 Uint32 m_default_logfile_group_id;
586 } m_tablespace;
588 struct {
589 Uint32 m_undo_buffer_size;
590 File_list::HeadPOD m_files;
591 } m_logfilegroup;
594 union {
595 Uint32 nextPool;
596 Uint32 nextList;
597 Uint32 nextHash;
599 Uint32 prevHash;
601 Uint32 hashValue() const { return key;}
602 bool equal(const Filegroup& obj) const { return key == obj.key;}
604 typedef Ptr<Filegroup> FilegroupPtr;
605 typedef RecordPool<Filegroup, RWPool> Filegroup_pool;
606 typedef KeyTableImpl<Filegroup_pool, Filegroup> Filegroup_hash;
608 File_pool c_file_pool;
609 Filegroup_pool c_filegroup_pool;
610 File_hash c_file_hash;
611 Filegroup_hash c_filegroup_hash;
613 RopePool c_rope_pool;
615 struct DictObject {
616 DictObject() {}
617 Uint32 m_id;
618 Uint32 m_type;
619 Uint32 m_ref_count;
620 RopeHandle m_name;
621 union {
622 struct {
623 Uint32 m_name_len;
624 const char * m_name_ptr;
625 RopePool * m_pool;
626 } m_key;
627 Uint32 nextPool;
628 Uint32 nextList;
630 Uint32 nextHash;
631 Uint32 prevHash;
633 Uint32 hashValue() const { return m_name.hashValue();}
634 bool equal(const DictObject& obj) const {
635 if(obj.hashValue() == hashValue()){
636 ConstRope r(* m_key.m_pool, obj.m_name);
637 return r.compare(m_key.m_name_ptr, m_key.m_name_len) == 0;
639 return false;
643 DLHashTable<DictObject> c_obj_hash; // Name
644 ArrayPool<DictObject> c_obj_pool;
646 DictObject * get_object(const char * name){
647 return get_object(name, strlen(name) + 1);
650 DictObject * get_object(const char * name, Uint32 len){
651 return get_object(name, len, Rope::hash(name, len));
654 DictObject * get_object(const char * name, Uint32 len, Uint32 hash);
656 void release_object(Uint32 obj_ptr_i){
657 release_object(obj_ptr_i, c_obj_pool.getPtr(obj_ptr_i));
660 void release_object(Uint32 obj_ptr_i, DictObject* obj_ptr_p);
662 void increase_ref_count(Uint32 obj_ptr_i);
663 void decrease_ref_count(Uint32 obj_ptr_i);
665 public:
666 Dbdict(Block_context& ctx);
667 virtual ~Dbdict();
669 private:
670 BLOCK_DEFINES(Dbdict);
672 // Signal receivers
673 void execDICTSTARTREQ(Signal* signal);
675 void execGET_TABINFOREQ(Signal* signal);
676 void execGET_TABLEDID_REQ(Signal* signal);
677 void execGET_TABINFO_REF(Signal* signal);
678 void execGET_TABINFO_CONF(Signal* signal);
679 void execCONTINUEB(Signal* signal);
681 void execDUMP_STATE_ORD(Signal* signal);
682 void execHOT_SPAREREP(Signal* signal);
683 void execDIADDTABCONF(Signal* signal);
684 void execDIADDTABREF(Signal* signal);
685 void execTAB_COMMITCONF(Signal* signal);
686 void execTAB_COMMITREF(Signal* signal);
687 void execGET_SCHEMA_INFOREQ(Signal* signal);
688 void execSCHEMA_INFO(Signal* signal);
689 void execSCHEMA_INFOCONF(Signal* signal);
690 void execREAD_NODESCONF(Signal* signal);
691 void execFSCLOSECONF(Signal* signal);
692 void execFSOPENCONF(Signal* signal);
693 void execFSOPENREF(Signal* signal);
694 void execFSREADCONF(Signal* signal);
695 void execFSREADREF(Signal* signal);
696 void execFSWRITECONF(Signal* signal);
697 void execNDB_STTOR(Signal* signal);
698 void execREAD_CONFIG_REQ(Signal* signal);
699 void execSTTOR(Signal* signal);
700 void execTC_SCHVERCONF(Signal* signal);
701 void execNODE_FAILREP(Signal* signal);
702 void execINCL_NODEREQ(Signal* signal);
703 void execAPI_FAILREQ(Signal* signal);
705 void execWAIT_GCP_REF(Signal* signal);
706 void execWAIT_GCP_CONF(Signal* signal);
708 void execLIST_TABLES_REQ(Signal* signal);
710 // Index signals
711 void execCREATE_INDX_REQ(Signal* signal);
712 void execCREATE_INDX_CONF(Signal* signal);
713 void execCREATE_INDX_REF(Signal* signal);
715 void execALTER_INDX_REQ(Signal* signal);
716 void execALTER_INDX_CONF(Signal* signal);
717 void execALTER_INDX_REF(Signal* signal);
719 void execCREATE_TABLE_CONF(Signal* signal);
720 void execCREATE_TABLE_REF(Signal* signal);
722 void execDROP_INDX_REQ(Signal* signal);
723 void execDROP_INDX_CONF(Signal* signal);
724 void execDROP_INDX_REF(Signal* signal);
726 void execDROP_TABLE_CONF(Signal* signal);
727 void execDROP_TABLE_REF(Signal* signal);
729 void execBUILDINDXREQ(Signal* signal);
730 void execBUILDINDXCONF(Signal* signal);
731 void execBUILDINDXREF(Signal* signal);
733 void execBACKUP_FRAGMENT_REQ(Signal*);
735 // Util signals used by Event code
736 void execUTIL_PREPARE_CONF(Signal* signal);
737 void execUTIL_PREPARE_REF (Signal* signal);
738 void execUTIL_EXECUTE_CONF(Signal* signal);
739 void execUTIL_EXECUTE_REF (Signal* signal);
740 void execUTIL_RELEASE_CONF(Signal* signal);
741 void execUTIL_RELEASE_REF (Signal* signal);
744 // Event signals from API
745 void execCREATE_EVNT_REQ (Signal* signal);
746 void execCREATE_EVNT_CONF(Signal* signal);
747 void execCREATE_EVNT_REF (Signal* signal);
749 void execDROP_EVNT_REQ (Signal* signal);
751 void execSUB_START_REQ (Signal* signal);
752 void execSUB_START_CONF (Signal* signal);
753 void execSUB_START_REF (Signal* signal);
755 void execSUB_STOP_REQ (Signal* signal);
756 void execSUB_STOP_CONF (Signal* signal);
757 void execSUB_STOP_REF (Signal* signal);
759 // Event signals from SUMA
761 void execCREATE_SUBID_CONF(Signal* signal);
762 void execCREATE_SUBID_REF (Signal* signal);
764 void execSUB_CREATE_CONF(Signal* signal);
765 void execSUB_CREATE_REF (Signal* signal);
767 void execSUB_REMOVE_REQ(Signal* signal);
768 void execSUB_REMOVE_CONF(Signal* signal);
769 void execSUB_REMOVE_REF(Signal* signal);
771 // Trigger signals
772 void execCREATE_TRIG_REQ(Signal* signal);
773 void execCREATE_TRIG_CONF(Signal* signal);
774 void execCREATE_TRIG_REF(Signal* signal);
775 void execALTER_TRIG_REQ(Signal* signal);
776 void execALTER_TRIG_CONF(Signal* signal);
777 void execALTER_TRIG_REF(Signal* signal);
778 void execDROP_TRIG_REQ(Signal* signal);
779 void execDROP_TRIG_CONF(Signal* signal);
780 void execDROP_TRIG_REF(Signal* signal);
782 void execDROP_TABLE_REQ(Signal* signal);
784 void execPREP_DROP_TAB_REQ(Signal* signal);
785 void execPREP_DROP_TAB_REF(Signal* signal);
786 void execPREP_DROP_TAB_CONF(Signal* signal);
788 void execDROP_TAB_REQ(Signal* signal);
789 void execDROP_TAB_REF(Signal* signal);
790 void execDROP_TAB_CONF(Signal* signal);
792 void execCREATE_TABLE_REQ(Signal* signal);
793 void execALTER_TABLE_REQ(Signal* signal);
794 void execCREATE_FRAGMENTATION_REF(Signal*);
795 void execCREATE_FRAGMENTATION_CONF(Signal*);
796 void execCREATE_TAB_REQ(Signal* signal);
797 void execADD_FRAGREQ(Signal* signal);
798 void execLQHFRAGREF(Signal* signal);
799 void execLQHFRAGCONF(Signal* signal);
800 void execLQHADDATTREF(Signal* signal);
801 void execLQHADDATTCONF(Signal* signal);
802 void execCREATE_TAB_REF(Signal* signal);
803 void execCREATE_TAB_CONF(Signal* signal);
804 void execALTER_TAB_REQ(Signal* signal);
805 void execALTER_TAB_REF(Signal* signal);
806 void execALTER_TAB_CONF(Signal* signal);
807 bool check_ndb_versions() const;
809 void execCREATE_FILE_REQ(Signal* signal);
810 void execCREATE_FILEGROUP_REQ(Signal* signal);
811 void execDROP_FILE_REQ(Signal* signal);
812 void execDROP_FILEGROUP_REQ(Signal* signal);
814 // Internal
815 void execCREATE_FILE_REF(Signal* signal);
816 void execCREATE_FILE_CONF(Signal* signal);
817 void execCREATE_FILEGROUP_REF(Signal* signal);
818 void execCREATE_FILEGROUP_CONF(Signal* signal);
819 void execDROP_FILE_REF(Signal* signal);
820 void execDROP_FILE_CONF(Signal* signal);
821 void execDROP_FILEGROUP_REF(Signal* signal);
822 void execDROP_FILEGROUP_CONF(Signal* signal);
824 void execDICT_LOCK_REQ(Signal* signal);
825 void execDICT_UNLOCK_ORD(Signal* signal);
828 * 2.4 COMMON STORED VARIABLES
832 * This record stores all the state needed
833 * when the schema page is being sent to other nodes
834 ***************************************************************************/
835 struct SendSchemaRecord {
836 /** Number of words of schema data */
837 Uint32 noOfWords;
838 /** Page Id of schema data */
839 Uint32 pageId;
841 Uint32 nodeId;
842 SignalCounter m_SCHEMAINFO_Counter;
844 Uint32 noOfWordsCurrentlySent;
845 Uint32 noOfSignalsSentSinceDelay;
847 bool inUse;
849 SendSchemaRecord c_sendSchemaRecord;
852 * This record stores all the state needed
853 * when a table file is being read from disk
854 ****************************************************************************/
855 struct ReadTableRecord {
856 /** Number of Pages */
857 Uint32 no_of_words;
858 /** Page Id*/
859 Uint32 pageId;
860 /** Table Id of read table */
861 Uint32 tableId;
863 bool inUse;
864 Callback m_callback;
866 ReadTableRecord c_readTableRecord;
869 * This record stores all the state needed
870 * when a table file is being written to disk
871 ****************************************************************************/
872 struct WriteTableRecord {
873 /** Number of Pages */
874 Uint32 no_of_words;
875 /** Page Id*/
876 Uint32 pageId;
877 /** Table Files Handled, local state variable */
878 Uint32 noOfTableFilesHandled;
879 /** Table Id of written table */
880 Uint32 tableId;
881 /** State, indicates from where it was called */
882 enum TableWriteState {
883 IDLE = 0,
884 WRITE_ADD_TABLE_MASTER = 1,
885 WRITE_ADD_TABLE_SLAVE = 2,
886 WRITE_RESTART_FROM_MASTER = 3,
887 WRITE_RESTART_FROM_OWN = 4,
888 TWR_CALLBACK = 5
890 TableWriteState tableWriteState;
891 Callback m_callback;
893 WriteTableRecord c_writeTableRecord;
896 * This record stores all the state needed
897 * when a schema file is being read from disk
898 ****************************************************************************/
899 struct ReadSchemaRecord {
900 /** Page Id of schema page */
901 Uint32 pageId;
902 /** First page to read */
903 Uint32 firstPage;
904 /** Number of pages to read */
905 Uint32 noOfPages;
906 /** State, indicates from where it was called */
907 enum SchemaReadState {
908 IDLE = 0,
909 INITIAL_READ_HEAD = 1,
910 INITIAL_READ = 2
912 SchemaReadState schemaReadState;
914 ReadSchemaRecord c_readSchemaRecord;
917 * This record stores all the state needed
918 * when a schema file is being written to disk
919 ****************************************************************************/
920 struct WriteSchemaRecord {
921 /** Page Id of schema page */
922 Uint32 pageId;
923 /** Rewrite entire file */
924 Uint32 newFile;
925 /** First page to write */
926 Uint32 firstPage;
927 /** Number of pages to write */
928 Uint32 noOfPages;
929 /** Schema Files Handled, local state variable */
930 Uint32 noOfSchemaFilesHandled;
932 bool inUse;
933 Callback m_callback;
935 WriteSchemaRecord c_writeSchemaRecord;
938 * This record stores all the information needed
939 * when a file is being read from disk
940 ****************************************************************************/
941 struct RestartRecord {
942 /** Global check point identity */
943 Uint32 gciToRestart;
945 /** The active table at restart process */
946 Uint32 activeTable;
948 /** The active table at restart process */
949 BlockReference returnBlockRef;
951 Uint32 m_pass; // 0 tablespaces/logfilegroups, 1 tables, 2 indexes
953 RestartRecord c_restartRecord;
956 * This record stores all the information needed
957 * when a file is being read from disk
958 ****************************************************************************/
959 struct RetrieveRecord {
960 RetrieveRecord(){ noOfWaiters = 0;}
962 /** Only one retrieve table definition at a time */
963 bool busyState;
966 * No of waiting in time queue
968 Uint32 noOfWaiters;
970 /** Block Reference of retriever */
971 BlockReference blockRef;
973 /** Id of retriever */
974 Uint32 m_senderData;
976 /** Table id of retrieved table */
977 Uint32 tableId;
979 Uint32 m_table_type;
981 /** Starting page to retrieve data from */
982 Uint32 retrievePage;
984 /** Number of pages retrieved */
985 Uint32 retrievedNoOfPages;
987 /** Number of words retrieved */
988 Uint32 retrievedNoOfWords;
990 /** Number of words sent currently */
991 Uint32 currentSent;
994 * Long signal stuff
996 bool m_useLongSig;
998 RetrieveRecord c_retrieveRecord;
1001 * This record stores all the information needed
1002 * when a file is being read from disk
1004 * This is the info stored in one entry of the schema
1005 * page. Each table has 4 words of info.
1006 * Word 1: Schema version (upper 16 bits)
1007 * Table State (lower 16 bits)
1008 * Word 2: Number of pages of table description
1009 * Word 3: Global checkpoint id table was created
1010 * Word 4: Currently zero
1011 ****************************************************************************/
1012 struct SchemaRecord {
1013 /** Schema file first page (0) */
1014 Uint32 schemaPage;
1016 /** Old Schema file first page (used at node restart) */
1017 Uint32 oldSchemaPage;
1019 Callback m_callback;
1021 SchemaRecord c_schemaRecord;
1024 * Schema file, list of schema pages. Use an array until a pool
1025 * exists and NDBFS interface can use it.
1027 struct XSchemaFile {
1028 SchemaFile* schemaPage;
1029 Uint32 noOfPages;
1031 // 0-normal 1-old
1032 XSchemaFile c_schemaFile[2];
1034 void initSchemaFile(XSchemaFile *, Uint32 firstPage, Uint32 lastPage,
1035 bool initEntries);
1036 void resizeSchemaFile(XSchemaFile * xsf, Uint32 noOfPages);
1037 void computeChecksum(XSchemaFile *, Uint32 pageNo);
1038 bool validateChecksum(const XSchemaFile *);
1039 SchemaFile::TableEntry * getTableEntry(XSchemaFile *, Uint32 tableId);
1041 Uint32 computeChecksum(const Uint32 * src, Uint32 len);
1044 /* ----------------------------------------------------------------------- */
1045 // Node References
1046 /* ----------------------------------------------------------------------- */
1047 Uint16 c_masterNodeId;
1049 /* ----------------------------------------------------------------------- */
1050 // Various current system properties
1051 /* ----------------------------------------------------------------------- */
1052 Uint16 c_numberNode;
1053 Uint16 c_noHotSpareNodes;
1054 Uint16 c_noNodesFailed;
1055 Uint32 c_failureNr;
1057 /* ----------------------------------------------------------------------- */
1058 // State variables
1059 /* ----------------------------------------------------------------------- */
1061 #ifndef ndb_dbdict_log_block_state
1062 enum BlockState {
1063 BS_IDLE = 0,
1064 BS_CREATE_TAB = 1,
1065 BS_BUSY = 2,
1066 BS_NODE_FAILURE = 3,
1067 BS_NODE_RESTART = 4
1069 #else // quick hack to log changes
1070 enum {
1071 BS_IDLE = 0,
1072 BS_CREATE_TAB = 1,
1073 BS_BUSY = 2,
1074 BS_NODE_FAILURE = 3,
1075 BS_NODE_RESTART = 4
1077 struct BlockState;
1078 friend struct BlockState;
1079 struct BlockState {
1080 BlockState() :
1081 m_value(BS_IDLE) {
1083 BlockState(int value) :
1084 m_value(value) {
1086 operator int() const {
1087 return m_value;
1089 BlockState& operator=(const BlockState& bs) {
1090 Dbdict* dict = (Dbdict*)globalData.getBlock(DBDICT);
1091 dict->infoEvent("DICT: bs %d->%d", m_value, bs.m_value);
1092 globalSignalLoggers.log(DBDICT, "bs %d->%d", m_value, bs.m_value);
1093 m_value = bs.m_value;
1094 return *this;
1096 int m_value;
1098 #endif
1099 BlockState c_blockState;
1101 struct PackTable {
1103 enum PackTableState {
1104 PTS_IDLE = 0,
1105 PTS_GET_TAB = 3
1106 } m_state;
1108 } c_packTable;
1110 Uint32 c_startPhase;
1111 Uint32 c_restartType;
1112 bool c_initialStart;
1113 bool c_systemRestart;
1114 bool c_nodeRestart;
1115 bool c_initialNodeRestart;
1116 Uint32 c_tabinfoReceived;
1119 * Temporary structure used when parsing table info
1121 struct ParseDictTabInfoRecord {
1122 DictTabInfo::RequestType requestType;
1123 Uint32 errorCode;
1124 Uint32 errorLine;
1126 SimpleProperties::UnpackStatus status;
1127 Uint32 errorKey;
1128 TableRecordPtr tablePtr;
1131 // Operation records
1134 * Common part of operation records. Uses KeyTable2. Note that each
1135 * seize/release invokes ctor/dtor automatically.
1137 struct OpRecordCommon {
1138 OpRecordCommon() {}
1139 Uint32 key; // key shared between master and slaves
1140 Uint32 nextHash;
1141 Uint32 prevHash;
1142 Uint32 hashValue() const {
1143 return key;
1145 bool equal(const OpRecordCommon& rec) const {
1146 return key == rec.key;
1151 * Create table record
1153 struct CreateTableRecord : OpRecordCommon {
1154 CreateTableRecord() {}
1155 Uint32 m_senderRef;
1156 Uint32 m_senderData;
1157 Uint32 m_coordinatorRef;
1159 Uint32 m_errorCode;
1160 void setErrorCode(Uint32 c){ if(m_errorCode == 0) m_errorCode = c;}
1162 // For alter table
1163 Uint32 m_changeMask;
1164 bool m_alterTableFailed;
1165 AlterTableRef m_alterTableRef;
1166 Uint32 m_alterTableId;
1168 /* Previous table name (used for reverting failed table rename) */
1169 char previousTableName[MAX_TAB_NAME_SIZE];
1171 /* Previous table definition, frm (used for reverting) */
1172 /** TODO Could preferrably be made dynamic size */
1173 Uint32 previousFrmLen;
1174 char previousFrmData[MAX_FRM_DATA_SIZE];
1176 Uint32 m_tablePtrI;
1177 Uint32 m_tabInfoPtrI;
1178 Uint32 m_fragmentsPtrI;
1180 Uint32 m_dihAddFragPtr; // Connect ptr towards DIH
1181 Uint32 m_lqhFragPtr; // Connect ptr towards LQH
1183 Callback m_callback; // Who's using local create tab
1184 MutexHandle2<DIH_START_LCP_MUTEX> m_startLcpMutex;
1186 struct CoordinatorData {
1187 Uint32 m_gsn;
1188 SafeCounterHandle m_counter;
1189 CreateTabReq::RequestType m_requestType;
1190 } m_coordinatorData;
1192 typedef Ptr<CreateTableRecord> CreateTableRecordPtr;
1195 * Drop table record
1197 struct DropTableRecord : OpRecordCommon {
1198 DropTableRecord() {}
1199 DropTableReq m_request;
1201 Uint32 m_requestType;
1202 Uint32 m_coordinatorRef;
1204 Uint32 m_errorCode;
1205 void setErrorCode(Uint32 c){ if(m_errorCode == 0) m_errorCode = c;}
1207 MutexHandle2<BACKUP_DEFINE_MUTEX> m_define_backup_mutex;
1210 * When sending stuff around
1212 struct CoordinatorData {
1213 Uint32 m_gsn;
1214 Uint32 m_block;
1215 SignalCounter m_signalCounter;
1216 } m_coordinatorData;
1218 struct ParticipantData {
1219 Uint32 m_gsn;
1220 Uint32 m_block;
1221 SignalCounter m_signalCounter;
1223 Callback m_callback;
1224 } m_participantData;
1226 typedef Ptr<DropTableRecord> DropTableRecordPtr;
1229 * Request flags passed in signals along with request type and
1230 * propagated across operations.
1232 struct RequestFlag {
1233 enum {
1234 RF_LOCAL = 1 << 0, // create on local node only
1235 RF_NOBUILD = 1 << 1, // no need to build index
1236 RF_NOTCTRIGGER = 1 << 2, // alter trigger: no trigger in TC
1237 RF_FORCE = 1 << 4 // force drop
1242 * Operation record for create index.
1244 struct OpCreateIndex : OpRecordCommon {
1245 // original request (index id will be added)
1246 CreateIndxReq m_request;
1247 AttributeList m_attrList;
1248 char m_indexName[MAX_TAB_NAME_SIZE];
1249 bool m_loggedIndex;
1250 bool m_temporaryIndex;
1251 // coordinator DICT
1252 Uint32 m_coordinatorRef;
1253 bool m_isMaster;
1254 // state info
1255 CreateIndxReq::RequestType m_requestType;
1256 Uint32 m_requestFlag;
1257 // error info
1258 CreateIndxRef::ErrorCode m_lastError;
1259 CreateIndxRef::ErrorCode m_errorCode;
1260 Uint32 m_errorLine;
1261 Uint32 m_errorNode;
1262 // counters
1263 SignalCounter m_signalCounter;
1264 // ctor
1265 OpCreateIndex() {
1266 memset(&m_request, 0, sizeof(m_request));
1267 m_coordinatorRef = 0;
1268 m_requestType = CreateIndxReq::RT_UNDEFINED;
1269 m_requestFlag = 0;
1270 m_lastError = CreateIndxRef::NoError;
1271 m_errorCode = CreateIndxRef::NoError;
1272 m_errorLine = 0;
1273 m_errorNode = 0;
1275 void save(const CreateIndxReq* req) {
1276 m_request = *req;
1277 m_requestType = req->getRequestType();
1278 m_requestFlag = req->getRequestFlag();
1280 bool hasLastError() {
1281 return m_lastError != CreateIndxRef::NoError;
1283 bool hasError() {
1284 return m_errorCode != CreateIndxRef::NoError;
1286 void setError(const CreateIndxRef* ref) {
1287 m_lastError = CreateIndxRef::NoError;
1288 if (ref != 0) {
1289 m_lastError = ref->getErrorCode();
1290 if (! hasError()) {
1291 m_errorCode = m_lastError;
1292 m_errorLine = ref->getErrorLine();
1293 m_errorNode = ref->getErrorNode();
1297 void setError(const CreateTableRef* ref) {
1298 m_lastError = CreateIndxRef::NoError;
1299 if (ref != 0) {
1300 switch (ref->getErrorCode()) {
1301 case CreateTableRef::TableAlreadyExist:
1302 m_lastError = CreateIndxRef::IndexExists;
1303 break;
1304 default:
1305 m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
1306 break;
1308 if (! hasError()) {
1309 m_errorCode = m_lastError;
1310 m_errorLine = ref->getErrorLine();
1314 void setError(const AlterIndxRef* ref) {
1315 m_lastError = CreateIndxRef::NoError;
1316 if (ref != 0) {
1317 m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
1318 if (! hasError()) {
1319 m_errorCode = m_lastError;
1320 m_errorLine = ref->getErrorLine();
1321 m_errorNode = ref->getErrorNode();
1326 typedef Ptr<OpCreateIndex> OpCreateIndexPtr;
1329 * Operation record for drop index.
1331 struct OpDropIndex : OpRecordCommon {
1332 // original request
1333 DropIndxReq m_request;
1334 // coordinator DICT
1335 Uint32 m_coordinatorRef;
1336 bool m_isMaster;
1337 // state info
1338 DropIndxReq::RequestType m_requestType;
1339 Uint32 m_requestFlag;
1340 // error info
1341 DropIndxRef::ErrorCode m_lastError;
1342 DropIndxRef::ErrorCode m_errorCode;
1343 Uint32 m_errorLine;
1344 Uint32 m_errorNode;
1345 // counters
1346 SignalCounter m_signalCounter;
1347 // ctor
1348 OpDropIndex() {
1349 memset(&m_request, 0, sizeof(m_request));
1350 m_coordinatorRef = 0;
1351 m_requestType = DropIndxReq::RT_UNDEFINED;
1352 m_requestFlag = 0;
1353 m_lastError = DropIndxRef::NoError;
1354 m_errorCode = DropIndxRef::NoError;
1355 m_errorLine = 0;
1356 m_errorNode = 0;
1358 void save(const DropIndxReq* req) {
1359 m_request = *req;
1360 m_requestType = req->getRequestType();
1361 m_requestFlag = req->getRequestFlag();
1363 bool hasLastError() {
1364 return m_lastError != DropIndxRef::NoError;
1366 bool hasError() {
1367 return m_errorCode != DropIndxRef::NoError;
1369 void setError(const DropIndxRef* ref) {
1370 m_lastError = DropIndxRef::NoError;
1371 if (ref != 0) {
1372 m_lastError = ref->getErrorCode();
1373 if (! hasError()) {
1374 m_errorCode = ref->getErrorCode();
1375 m_errorLine = ref->getErrorLine();
1376 m_errorNode = ref->getErrorNode();
1380 void setError(const AlterIndxRef* ref) {
1381 m_lastError = DropIndxRef::NoError;
1382 if (ref != 0) {
1383 m_lastError = (DropIndxRef::ErrorCode)ref->getErrorCode();
1384 if (! hasError()) {
1385 m_errorCode = m_lastError;
1386 m_errorLine = ref->getErrorLine();
1387 m_errorNode = ref->getErrorNode();
1391 void setError(const DropTableRef* ref) {
1392 m_lastError = DropIndxRef::NoError;
1393 if (ref != 0) {
1394 switch (ref->errorCode) {
1395 case DropTableRef::Busy:
1396 m_lastError = DropIndxRef::Busy;
1397 break;
1398 case DropTableRef::NoSuchTable:
1399 m_lastError = DropIndxRef::IndexNotFound;
1400 break;
1401 case DropTableRef::DropInProgress:
1402 m_lastError = DropIndxRef::Busy;
1403 break;
1404 case DropTableRef::NoDropTableRecordAvailable:
1405 m_lastError = DropIndxRef::Busy;
1406 break;
1407 default:
1408 m_lastError = (DropIndxRef::ErrorCode)ref->errorCode;
1409 break;
1411 if (! hasError()) {
1412 m_errorCode = m_lastError;
1413 m_errorLine = 0;
1414 m_errorNode = 0;
1419 typedef Ptr<OpDropIndex> OpDropIndexPtr;
1422 * Operation record for alter index.
1424 struct OpAlterIndex : OpRecordCommon {
1425 // original request plus buffer for attribute lists
1426 AlterIndxReq m_request;
1427 AttributeList m_attrList;
1428 AttributeList m_tableKeyList;
1429 // coordinator DICT
1430 Uint32 m_coordinatorRef;
1431 bool m_isMaster;
1432 // state info
1433 AlterIndxReq::RequestType m_requestType;
1434 Uint32 m_requestFlag;
1435 // error info
1436 AlterIndxRef::ErrorCode m_lastError;
1437 AlterIndxRef::ErrorCode m_errorCode;
1438 Uint32 m_errorLine;
1439 Uint32 m_errorNode;
1440 // counters
1441 SignalCounter m_signalCounter;
1442 Uint32 m_triggerCounter;
1443 // ctor
1444 OpAlterIndex() {
1445 memset(&m_request, 0, sizeof(m_request));
1446 m_coordinatorRef = 0;
1447 m_requestType = AlterIndxReq::RT_UNDEFINED;
1448 m_requestFlag = 0;
1449 m_lastError = AlterIndxRef::NoError;
1450 m_errorCode = AlterIndxRef::NoError;
1451 m_errorLine = 0;
1452 m_errorNode = 0;
1453 m_triggerCounter = 0;
1455 void save(const AlterIndxReq* req) {
1456 m_request = *req;
1457 m_requestType = req->getRequestType();
1458 m_requestFlag = req->getRequestFlag();
1460 bool hasLastError() {
1461 return m_lastError != AlterIndxRef::NoError;
1463 bool hasError() {
1464 return m_errorCode != AlterIndxRef::NoError;
1466 void setError(const AlterIndxRef* ref) {
1467 m_lastError = AlterIndxRef::NoError;
1468 if (ref != 0) {
1469 m_lastError = ref->getErrorCode();
1470 if (! hasError()) {
1471 m_errorCode = m_lastError;
1472 m_errorLine = ref->getErrorLine();
1473 m_errorNode = ref->getErrorNode();
1477 void setError(const CreateIndxRef* ref) {
1478 m_lastError = AlterIndxRef::NoError;
1479 if (ref != 0) {
1480 m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
1481 if (! hasError()) {
1482 m_errorCode = m_lastError;
1483 m_errorLine = ref->getErrorLine();
1484 m_errorNode = ref->getErrorNode();
1488 void setError(const DropIndxRef* ref) {
1489 m_lastError = AlterIndxRef::NoError;
1490 if (ref != 0) {
1491 m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
1492 if (! hasError()) {
1493 m_errorCode = m_lastError;
1494 m_errorLine = ref->getErrorLine();
1495 m_errorNode = ref->getErrorNode();
1499 void setError(const BuildIndxRef* ref) {
1500 m_lastError = AlterIndxRef::NoError;
1501 if (ref != 0) {
1502 m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
1503 if (! hasError()) {
1504 m_errorCode = m_lastError;
1505 m_errorLine = 0;
1506 m_errorNode = 0;
1510 void setError(const CreateTrigRef* ref) {
1511 m_lastError = AlterIndxRef::NoError;
1512 if (ref != 0) {
1513 m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
1514 if (! hasError()) {
1515 m_errorCode = m_lastError;
1516 m_errorLine = ref->getErrorLine();
1517 m_errorNode = ref->getErrorNode();
1521 void setError(const DropTrigRef* ref) {
1522 m_lastError = AlterIndxRef::NoError;
1523 if (ref != 0) {
1524 m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
1525 if (! hasError()) {
1526 m_errorCode = m_lastError;
1527 m_errorLine = ref->getErrorLine();
1528 m_errorNode = ref->getErrorNode();
1533 typedef Ptr<OpAlterIndex> OpAlterIndexPtr;
1536 * Operation record for build index.
1538 struct OpBuildIndex : OpRecordCommon {
1539 // original request plus buffer for attribute lists
1540 BuildIndxReq m_request;
1541 AttributeList m_attrList;
1542 Id_array<MAX_ATTRIBUTES_IN_INDEX+1> m_tableKeyList;
1543 // coordinator DICT
1544 Uint32 m_coordinatorRef;
1545 bool m_isMaster;
1546 // state info
1547 BuildIndxReq::RequestType m_requestType;
1548 Uint32 m_requestFlag;
1549 Uint32 m_constrTriggerId;
1550 // error info
1551 BuildIndxRef::ErrorCode m_lastError;
1552 BuildIndxRef::ErrorCode m_errorCode;
1553 Uint32 m_errorLine;
1554 Uint32 m_errorNode;
1555 // counters
1556 SignalCounter m_signalCounter;
1557 // ctor
1558 OpBuildIndex() {
1559 memset(&m_request, 0, sizeof(m_request));
1560 m_coordinatorRef = 0;
1561 m_requestType = BuildIndxReq::RT_UNDEFINED;
1562 m_requestFlag = 0;
1563 m_lastError = BuildIndxRef::NoError;
1564 m_errorCode = BuildIndxRef::NoError;
1565 m_errorLine = 0;
1566 m_errorNode = 0;
1568 void save(const BuildIndxReq* req) {
1569 m_request = *req;
1570 m_requestType = req->getRequestType();
1571 m_requestFlag = req->getRequestFlag();
1573 bool hasLastError() {
1574 return m_lastError != BuildIndxRef::NoError;
1576 bool hasError() {
1577 return m_errorCode != BuildIndxRef::NoError;
1579 void setError(const BuildIndxRef* ref) {
1580 m_lastError = BuildIndxRef::NoError;
1581 if (ref != 0) {
1582 m_lastError = ref->getErrorCode();
1583 if (! hasError()) {
1584 m_errorCode = m_lastError;
1585 m_errorLine = 0;
1586 m_errorNode = 0;
1590 void setError(const AlterIndxRef* ref) {
1591 m_lastError = BuildIndxRef::NoError;
1592 if (ref != 0) {
1593 m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
1594 if (! hasError()) {
1595 m_errorCode = m_lastError;
1596 m_errorLine = ref->getErrorLine();
1597 m_errorNode = ref->getErrorNode();
1601 void setError(const CreateTrigRef* ref) {
1602 m_lastError = BuildIndxRef::NoError;
1603 if (ref != 0) {
1604 m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
1605 if (! hasError()) {
1606 m_errorCode = m_lastError;
1607 m_errorLine = ref->getErrorLine();
1608 m_errorNode = ref->getErrorNode();
1612 void setError(const DropTrigRef* ref) {
1613 m_lastError = BuildIndxRef::NoError;
1614 if (ref != 0) {
1615 m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
1616 if (! hasError()) {
1617 m_errorCode = m_lastError;
1618 m_errorLine = ref->getErrorLine();
1619 m_errorNode = ref->getErrorNode();
1624 typedef Ptr<OpBuildIndex> OpBuildIndexPtr;
1627 * Operation record for Util Signals.
1629 struct OpSignalUtil : OpRecordCommon{
1630 Callback m_callback;
1631 Uint32 m_userData;
1633 typedef Ptr<OpSignalUtil> OpSignalUtilPtr;
1636 * Operation record for subscribe-start-stop
1638 struct OpSubEvent : OpRecordCommon {
1639 Uint32 m_senderRef;
1640 Uint32 m_senderData;
1641 Uint32 m_errorCode;
1642 union {
1643 SubStartConf m_sub_start_conf;
1644 SubStopConf m_sub_stop_conf;
1646 RequestTracker m_reqTracker;
1648 typedef Ptr<OpSubEvent> OpSubEventPtr;
1650 static const Uint32 sysTab_NDBEVENTS_0_szs[];
1653 * Operation record for create event.
1655 struct OpCreateEvent : OpRecordCommon {
1656 // original request (event id will be added)
1657 CreateEvntReq m_request;
1658 //AttributeMask m_attrListBitmask;
1659 // AttributeList m_attrList;
1660 sysTab_NDBEVENTS_0 m_eventRec;
1661 // char m_eventName[MAX_TAB_NAME_SIZE];
1662 // char m_tableName[MAX_TAB_NAME_SIZE];
1664 // coordinator DICT
1665 RequestTracker m_reqTracker;
1666 // state info
1667 CreateEvntReq::RequestType m_requestType;
1668 // error info
1669 Uint32 m_errorCode;
1670 Uint32 m_errorLine;
1671 Uint32 m_errorNode; /* also used to store master node id
1672 in case of NotMaster */
1673 // ctor
1674 OpCreateEvent() {
1675 memset(&m_request, 0, sizeof(m_request));
1676 m_requestType = CreateEvntReq::RT_UNDEFINED;
1677 m_errorCode = CreateEvntRef::NoError;
1678 m_errorLine = 0;
1679 m_errorNode = 0;
1681 void init(const CreateEvntReq* req, Dbdict* dp) {
1682 m_request = *req;
1683 m_errorCode = CreateEvntRef::NoError;
1684 m_errorLine = 0;
1685 m_errorNode = 0;
1686 m_requestType = req->getRequestType();
1688 bool hasError() {
1689 return m_errorCode != CreateEvntRef::NoError;
1691 void setError(const CreateEvntRef* ref) {
1692 if (ref != 0 && ! hasError()) {
1693 m_errorCode = ref->getErrorCode();
1694 m_errorLine = ref->getErrorLine();
1695 m_errorNode = ref->getErrorNode();
1700 typedef Ptr<OpCreateEvent> OpCreateEventPtr;
1703 * Operation record for drop event.
1705 struct OpDropEvent : OpRecordCommon {
1706 // original request
1707 DropEvntReq m_request;
1708 // char m_eventName[MAX_TAB_NAME_SIZE];
1709 sysTab_NDBEVENTS_0 m_eventRec;
1710 RequestTracker m_reqTracker;
1711 // error info
1712 Uint32 m_errorCode;
1713 Uint32 m_errorLine;
1714 Uint32 m_errorNode;
1715 // ctor
1716 OpDropEvent() {
1717 memset(&m_request, 0, sizeof(m_request));
1718 m_errorCode = 0;
1719 m_errorLine = 0;
1720 m_errorNode = 0;
1722 void init(const DropEvntReq* req) {
1723 m_request = *req;
1724 m_errorCode = 0;
1725 m_errorLine = 0;
1726 m_errorNode = 0;
1728 bool hasError() {
1729 return m_errorCode != 0;
1731 void setError(const DropEvntRef* ref) {
1732 if (ref != 0 && ! hasError()) {
1733 m_errorCode = ref->getErrorCode();
1734 m_errorLine = ref->getErrorLine();
1735 m_errorNode = ref->getErrorNode();
1739 typedef Ptr<OpDropEvent> OpDropEventPtr;
1742 * Operation record for create trigger.
1744 struct OpCreateTrigger : OpRecordCommon {
1745 // original request (trigger id will be added)
1746 CreateTrigReq m_request;
1747 char m_triggerName[MAX_TAB_NAME_SIZE];
1748 // coordinator DICT
1749 Uint32 m_coordinatorRef;
1750 bool m_isMaster;
1751 // state info
1752 CreateTrigReq::RequestType m_requestType;
1753 Uint32 m_requestFlag;
1754 // error info
1755 CreateTrigRef::ErrorCode m_lastError;
1756 CreateTrigRef::ErrorCode m_errorCode;
1757 Uint32 m_errorLine;
1758 Uint32 m_errorNode;
1759 // counters
1760 SignalCounter m_signalCounter;
1761 // ctor
1762 OpCreateTrigger() {
1763 memset(&m_request, 0, sizeof(m_request));
1764 m_coordinatorRef = 0;
1765 m_requestType = CreateTrigReq::RT_UNDEFINED;
1766 m_requestFlag = 0;
1767 m_lastError = CreateTrigRef::NoError;
1768 m_errorCode = CreateTrigRef::NoError;
1769 m_errorLine = 0;
1770 m_errorNode = 0;
1772 void save(const CreateTrigReq* req) {
1773 m_request = *req;
1774 m_requestType = req->getRequestType();
1775 m_requestFlag = req->getRequestFlag();
1777 bool hasLastError() {
1778 return m_lastError != CreateTrigRef::NoError;
1780 bool hasError() {
1781 return m_errorCode != CreateTrigRef::NoError;
1783 void setError(const CreateTrigRef* ref) {
1784 m_lastError = CreateTrigRef::NoError;
1785 if (ref != 0) {
1786 m_lastError = ref->getErrorCode();
1787 if (! hasError()) {
1788 m_errorCode = m_lastError;
1789 m_errorLine = ref->getErrorLine();
1790 m_errorNode = ref->getErrorNode();
1794 void setError(const AlterTrigRef* ref) {
1795 m_lastError = CreateTrigRef::NoError;
1796 if (ref != 0) {
1797 m_lastError = (CreateTrigRef::ErrorCode)ref->getErrorCode();
1798 if (! hasError()) {
1799 m_errorCode = m_lastError;
1800 m_errorLine = ref->getErrorLine();
1801 m_errorNode = ref->getErrorNode();
1806 typedef Ptr<OpCreateTrigger> OpCreateTriggerPtr;
1809 * Operation record for drop trigger.
1811 struct OpDropTrigger : OpRecordCommon {
1812 // original request
1813 DropTrigReq m_request;
1814 // coordinator DICT
1815 Uint32 m_coordinatorRef;
1816 bool m_isMaster;
1817 // state info
1818 DropTrigReq::RequestType m_requestType;
1819 Uint32 m_requestFlag;
1820 // error info
1821 DropTrigRef::ErrorCode m_lastError;
1822 DropTrigRef::ErrorCode m_errorCode;
1823 Uint32 m_errorLine;
1824 Uint32 m_errorNode;
1825 // counters
1826 SignalCounter m_signalCounter;
1827 // ctor
1828 OpDropTrigger() {
1829 memset(&m_request, 0, sizeof(m_request));
1830 m_coordinatorRef = 0;
1831 m_requestType = DropTrigReq::RT_UNDEFINED;
1832 m_requestFlag = 0;
1833 m_lastError = DropTrigRef::NoError;
1834 m_errorCode = DropTrigRef::NoError;
1835 m_errorLine = 0;
1836 m_errorNode = 0;
1838 void save(const DropTrigReq* req) {
1839 m_request = *req;
1840 m_requestType = req->getRequestType();
1841 m_requestFlag = req->getRequestFlag();
1843 bool hasLastError() {
1844 return m_lastError != DropTrigRef::NoError;
1846 bool hasError() {
1847 return m_errorCode != DropTrigRef::NoError;
1849 void setError(const DropTrigRef* ref) {
1850 m_lastError = DropTrigRef::NoError;
1851 if (ref != 0) {
1852 m_lastError = ref->getErrorCode();
1853 if (! hasError()) {
1854 m_errorCode = m_lastError;
1855 m_errorLine = ref->getErrorLine();
1856 m_errorNode = ref->getErrorNode();
1860 void setError(const AlterTrigRef* ref) {
1861 m_lastError = DropTrigRef::NoError;
1862 if (ref != 0) {
1863 m_lastError = (DropTrigRef::ErrorCode)ref->getErrorCode();
1864 if (! hasError()) {
1865 m_errorCode = m_lastError;
1866 m_errorLine = ref->getErrorLine();
1867 m_errorNode = ref->getErrorNode();
1872 typedef Ptr<OpDropTrigger> OpDropTriggerPtr;
1875 * Operation record for alter trigger.
1877 struct OpAlterTrigger : OpRecordCommon {
1878 // original request
1879 AlterTrigReq m_request;
1880 // nodes participating in operation
1881 NdbNodeBitmask m_nodes;
1882 // coordinator DICT
1883 Uint32 m_coordinatorRef;
1884 bool m_isMaster;
1885 // state info
1886 AlterTrigReq::RequestType m_requestType;
1887 Uint32 m_requestFlag;
1888 // error info
1889 AlterTrigRef::ErrorCode m_lastError;
1890 AlterTrigRef::ErrorCode m_errorCode;
1891 Uint32 m_errorLine;
1892 Uint32 m_errorNode;
1893 // counters
1894 SignalCounter m_signalCounter;
1895 // ctor
1896 OpAlterTrigger() {
1897 memset(&m_request, 0, sizeof(m_request));
1898 m_coordinatorRef = 0;
1899 m_requestType = AlterTrigReq::RT_UNDEFINED;
1900 m_requestFlag = 0;
1901 m_lastError = AlterTrigRef::NoError;
1902 m_errorCode = AlterTrigRef::NoError;
1903 m_errorLine = 0;
1904 m_errorNode = 0;
1906 void save(const AlterTrigReq* req) {
1907 m_request = *req;
1908 m_requestType = req->getRequestType();
1909 m_requestFlag = req->getRequestFlag();
1911 bool hasLastError() {
1912 return m_lastError != AlterTrigRef::NoError;
1914 bool hasError() {
1915 return m_errorCode != AlterTrigRef::NoError;
1917 void setError(const AlterTrigRef* ref) {
1918 m_lastError = AlterTrigRef::NoError;
1919 if (ref != 0) {
1920 m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
1921 if (! hasError()) {
1922 m_errorCode = m_lastError;
1923 m_errorLine = ref->getErrorLine();
1924 m_errorNode = ref->getErrorNode();
1928 void setError(const CreateTrigRef* ref) {
1929 m_lastError = AlterTrigRef::NoError;
1930 if (ref != 0) {
1931 m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
1932 if (! hasError()) {
1933 m_errorCode = m_lastError;
1934 m_errorLine = ref->getErrorLine();
1935 m_errorNode = ref->getErrorNode();
1939 void setError(const DropTrigRef* ref) {
1940 m_lastError = AlterTrigRef::NoError;
1941 if (ref != 0) {
1942 m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
1943 if (! hasError()) {
1944 m_errorCode = m_lastError;
1945 m_errorLine = ref->getErrorLine();
1946 m_errorNode = ref->getErrorNode();
1951 typedef Ptr<OpAlterTrigger> OpAlterTriggerPtr;
1953 public:
1954 struct SchemaOp : OpRecordCommon {
1956 Uint32 m_clientRef; // API (for take-over)
1957 Uint32 m_clientData;// API
1959 Uint32 m_senderRef; //
1960 Uint32 m_senderData;// transaction key value
1962 Uint32 m_errorCode;
1964 Uint32 m_obj_id;
1965 Uint32 m_obj_type;
1966 Uint32 m_obj_version;
1967 Uint32 m_obj_ptr_i;
1968 Uint32 m_vt_index;
1969 Callback m_callback;
1971 typedef Ptr<SchemaOp> SchemaOpPtr;
1973 struct SchemaTransaction : OpRecordCommon {
1974 Uint32 m_senderRef; // API
1975 Uint32 m_senderData;// API
1977 Callback m_callback;
1978 SafeCounterHandle m_counter;
1979 NodeBitmask m_nodes;
1981 Uint32 m_errorCode;
1982 SchemaTransaction() {}
1983 void setErrorCode(Uint32 c){ if(m_errorCode == 0) m_errorCode = c;}
1986 * This should contain "lists" with operations
1988 struct {
1989 Uint32 m_key; // Operation key
1990 Uint32 m_vt_index; // Operation type
1991 Uint32 m_obj_id;
1992 DictObjOp::State m_state;
1993 } m_op;
1995 private:
1997 struct OpCreateObj : public SchemaOp {
1998 Uint32 m_gci;
1999 Uint32 m_obj_info_ptr_i;
2000 Uint32 m_restart;
2002 typedef Ptr<OpCreateObj> CreateObjRecordPtr;
2004 struct OpDropObj : public SchemaOp
2007 typedef Ptr<OpDropObj> DropObjRecordPtr;
2010 * Only used at coordinator/master
2012 // Common operation record pool
2013 public:
2014 STATIC_CONST( opCreateTableSize = sizeof(CreateTableRecord) );
2015 STATIC_CONST( opDropTableSize = sizeof(DropTableRecord) );
2016 STATIC_CONST( opCreateIndexSize = sizeof(OpCreateIndex) );
2017 STATIC_CONST( opDropIndexSize = sizeof(OpDropIndex) );
2018 STATIC_CONST( opAlterIndexSize = sizeof(OpAlterIndex) );
2019 STATIC_CONST( opBuildIndexSize = sizeof(OpBuildIndex) );
2020 STATIC_CONST( opCreateEventSize = sizeof(OpCreateEvent) );
2021 STATIC_CONST( opSubEventSize = sizeof(OpSubEvent) );
2022 STATIC_CONST( opDropEventSize = sizeof(OpDropEvent) );
2023 STATIC_CONST( opSignalUtilSize = sizeof(OpSignalUtil) );
2024 STATIC_CONST( opCreateTriggerSize = sizeof(OpCreateTrigger) );
2025 STATIC_CONST( opDropTriggerSize = sizeof(OpDropTrigger) );
2026 STATIC_CONST( opAlterTriggerSize = sizeof(OpAlterTrigger) );
2027 STATIC_CONST( opCreateObjSize = sizeof(OpCreateObj) );
2028 private:
2029 #define PTR_ALIGN(n) ((((n)+sizeof(void*)-1)>>2)&~((sizeof(void*)-1)>>2))
2030 union OpRecordUnion {
2031 Uint32 u_opCreateTable [PTR_ALIGN(opCreateTableSize)];
2032 Uint32 u_opDropTable [PTR_ALIGN(opDropTableSize)];
2033 Uint32 u_opCreateIndex [PTR_ALIGN(opCreateIndexSize)];
2034 Uint32 u_opDropIndex [PTR_ALIGN(opDropIndexSize)];
2035 Uint32 u_opCreateEvent [PTR_ALIGN(opCreateEventSize)];
2036 Uint32 u_opSubEvent [PTR_ALIGN(opSubEventSize)];
2037 Uint32 u_opDropEvent [PTR_ALIGN(opDropEventSize)];
2038 Uint32 u_opSignalUtil [PTR_ALIGN(opSignalUtilSize)];
2039 Uint32 u_opAlterIndex [PTR_ALIGN(opAlterIndexSize)];
2040 Uint32 u_opBuildIndex [PTR_ALIGN(opBuildIndexSize)];
2041 Uint32 u_opCreateTrigger[PTR_ALIGN(opCreateTriggerSize)];
2042 Uint32 u_opDropTrigger [PTR_ALIGN(opDropTriggerSize)];
2043 Uint32 u_opAlterTrigger [PTR_ALIGN(opAlterTriggerSize)];
2044 Uint32 u_opCreateObj [PTR_ALIGN(opCreateObjSize)];
2045 Uint32 nextPool;
2047 ArrayPool<OpRecordUnion> c_opRecordPool;
2049 // Operation records
2050 KeyTable2<CreateTableRecord, OpRecordUnion> c_opCreateTable;
2051 KeyTable2<DropTableRecord, OpRecordUnion> c_opDropTable;
2052 KeyTable2<OpCreateIndex, OpRecordUnion> c_opCreateIndex;
2053 KeyTable2<OpDropIndex, OpRecordUnion> c_opDropIndex;
2054 KeyTable2<OpAlterIndex, OpRecordUnion> c_opAlterIndex;
2055 KeyTable2<OpBuildIndex, OpRecordUnion> c_opBuildIndex;
2056 KeyTable2C<OpCreateEvent, OpRecordUnion> c_opCreateEvent;
2057 KeyTable2C<OpSubEvent, OpRecordUnion> c_opSubEvent;
2058 KeyTable2C<OpDropEvent, OpRecordUnion> c_opDropEvent;
2059 KeyTable2C<OpSignalUtil, OpRecordUnion> c_opSignalUtil;
2060 KeyTable2<OpCreateTrigger, OpRecordUnion> c_opCreateTrigger;
2061 KeyTable2<OpDropTrigger, OpRecordUnion> c_opDropTrigger;
2062 KeyTable2<OpAlterTrigger, OpRecordUnion> c_opAlterTrigger;
2063 KeyTable2<SchemaOp, OpRecordUnion> c_schemaOp;
2064 KeyTable2<SchemaTransaction, OpRecordUnion> c_Trans;
2065 KeyTable2Ref<OpCreateObj, SchemaOp, OpRecordUnion> c_opCreateObj;
2066 KeyTable2Ref<OpDropObj, SchemaOp, OpRecordUnion> c_opDropObj;
2068 // Unique key for operation XXX move to some system table
2069 Uint32 c_opRecordSequence;
2072 * Master DICT can be locked in 2 mutually exclusive ways:
2074 * 1) for schema ops, via operation records
2075 * 2) against schema ops, via a lock queue
2077 * Current use of 2) is by a starting node, to prevent schema ops
2078 * until started. The ops are refused (BlockState != BS_IDLE),
2079 * not queued.
2081 * Master failure is not handled, in node start case the starting
2082 * node will crash too anyway. Use lock table in future..
2084 * The lock queue is "serial" but other behaviour is possible
2085 * by checking lock types e.g. to allow parallel node starts.
2087 * Checking release of last op record is not convenient with
2088 * current structure (5.0). Instead we poll via continueB.
2090 * XXX only table ops check BlockState
2092 struct DictLockType;
2093 friend struct DictLockType;
2095 struct DictLockType {
2096 DictLockReq::LockType lockType;
2097 BlockState blockState;
2098 const char* text;
2101 struct DictLockRecord;
2102 friend struct DictLockRecord;
2104 struct DictLockRecord {
2105 DictLockReq req;
2106 const DictLockType* lt;
2107 bool locked;
2108 union {
2109 Uint32 nextPool;
2110 Uint32 nextList;
2112 Uint32 prevList;
2115 typedef Ptr<DictLockRecord> DictLockPtr;
2116 ArrayPool<DictLockRecord> c_dictLockPool;
2117 DLFifoList<DictLockRecord> c_dictLockQueue;
2118 bool c_dictLockPoll;
2120 static const DictLockType* getDictLockType(Uint32 lockType);
2121 void sendDictLockInfoEvent(Uint32 pollCount);
2122 void sendDictLockInfoEvent(DictLockPtr lockPtr, const char* text);
2124 // check if any schema op exists (conflicting with dict lock)
2125 bool hasDictLockSchemaOp();
2127 void checkDictLockQueue(Signal* signal, bool poll);
2128 void sendDictLockConf(Signal* signal, DictLockPtr lockPtr);
2129 void sendDictLockRef(Signal* signal, DictLockReq req, Uint32 errorCode);
2131 // control polling i.e. continueB loop
2132 void setDictLockPoll(Signal* signal, bool on, Uint32 pollCount);
2134 // NF handling
2135 void removeStaleDictLocks(Signal* signal, const Uint32* theFailedNodes);
2138 // Statement blocks
2140 /* ------------------------------------------------------------ */
2141 // Start/Restart Handling
2142 /* ------------------------------------------------------------ */
2143 void sendSTTORRY(Signal* signal);
2144 void sendNDB_STTORRY(Signal* signal);
2145 void initSchemaFile(Signal* signal);
2147 /* ------------------------------------------------------------ */
2148 // Drop Table Handling
2149 /* ------------------------------------------------------------ */
2150 void releaseTableObject(Uint32 tableId, bool removeFromHash = true);
2152 /* ------------------------------------------------------------ */
2153 // General Stuff
2154 /* ------------------------------------------------------------ */
2155 Uint32 getFreeObjId(Uint32 minId);
2156 Uint32 getFreeTableRecord(Uint32 primaryTableId);
2157 Uint32 getFreeTriggerRecord();
2158 bool getNewAttributeRecord(TableRecordPtr tablePtr,
2159 AttributeRecordPtr & attrPtr);
2160 void packTableIntoPages(Signal* signal);
2161 void packTableIntoPages(SimpleProperties::Writer &, TableRecordPtr, Signal* =0);
2162 void packFilegroupIntoPages(SimpleProperties::Writer &,
2163 FilegroupPtr,
2164 const Uint32 undo_free_hi,
2165 const Uint32 undo_free_lo);
2166 void packFileIntoPages(SimpleProperties::Writer &, FilePtr, const Uint32);
2168 void sendGET_TABINFOREQ(Signal* signal,
2169 Uint32 tableId);
2170 void sendTC_SCHVERREQ(Signal* signal,
2171 Uint32 tableId,
2172 BlockReference tcRef);
2174 /* ------------------------------------------------------------ */
2175 // System Restart Handling
2176 /* ------------------------------------------------------------ */
2177 void initSendSchemaData(Signal* signal);
2178 void sendSchemaData(Signal* signal);
2179 Uint32 sendSCHEMA_INFO(Signal* signal, Uint32 nodeId, Uint32* pagePointer);
2180 void checkSchemaStatus(Signal* signal);
2181 void sendDIHSTARTTAB_REQ(Signal* signal);
2183 /* ------------------------------------------------------------ */
2184 // Receive Table Handling
2185 /* ------------------------------------------------------------ */
2186 void handleTabInfoInit(SimpleProperties::Reader &,
2187 ParseDictTabInfoRecord *,
2188 bool checkExist = true);
2189 void handleTabInfo(SimpleProperties::Reader & it, ParseDictTabInfoRecord *,
2190 DictTabInfo::Table & tableDesc);
2192 void handleAddTableFailure(Signal* signal,
2193 Uint32 failureLine,
2194 Uint32 tableId);
2195 bool verifyTableCorrect(Signal* signal, Uint32 tableId);
2197 /* ------------------------------------------------------------ */
2198 // Add Table Handling
2199 /* ------------------------------------------------------------ */
2200 void releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr);
2202 /* ------------------------------------------------------------ */
2203 // Add Fragment Handling
2204 /* ------------------------------------------------------------ */
2205 void sendLQHADDATTRREQ(Signal*, CreateTableRecordPtr, Uint32 attributePtrI);
2207 /* ------------------------------------------------------------ */
2208 // Read/Write Schema and Table files
2209 /* ------------------------------------------------------------ */
2210 void updateSchemaState(Signal* signal, Uint32 tableId,
2211 SchemaFile::TableEntry*, Callback*,
2212 bool savetodisk = 1);
2213 void startWriteSchemaFile(Signal* signal);
2214 void openSchemaFile(Signal* signal,
2215 Uint32 fileNo,
2216 Uint32 fsPtr,
2217 bool writeFlag,
2218 bool newFile);
2219 void writeSchemaFile(Signal* signal, Uint32 filePtr, Uint32 fsPtr);
2220 void writeSchemaConf(Signal* signal,
2221 FsConnectRecordPtr fsPtr);
2222 void closeFile(Signal* signal, Uint32 filePtr, Uint32 fsPtr);
2223 void closeWriteSchemaConf(Signal* signal,
2224 FsConnectRecordPtr fsPtr);
2225 void initSchemaFile_conf(Signal* signal, Uint32 i, Uint32 returnCode);
2227 void writeTableFile(Signal* signal, Uint32 tableId,
2228 SegmentedSectionPtr tabInfo, Callback*);
2229 void startWriteTableFile(Signal* signal, Uint32 tableId);
2230 void openTableFile(Signal* signal,
2231 Uint32 fileNo,
2232 Uint32 fsPtr,
2233 Uint32 tableId,
2234 bool writeFlag);
2235 void writeTableFile(Signal* signal, Uint32 filePtr, Uint32 fsPtr);
2236 void writeTableConf(Signal* signal,
2237 FsConnectRecordPtr fsPtr);
2238 void closeWriteTableConf(Signal* signal,
2239 FsConnectRecordPtr fsPtr);
2241 void startReadTableFile(Signal* signal, Uint32 tableId);
2242 void openReadTableRef(Signal* signal,
2243 FsConnectRecordPtr fsPtr);
2244 void readTableFile(Signal* signal, Uint32 filePtr, Uint32 fsPtr);
2245 void readTableConf(Signal* signal,
2246 FsConnectRecordPtr fsPtr);
2247 void readTableRef(Signal* signal,
2248 FsConnectRecordPtr fsPtr);
2249 void closeReadTableConf(Signal* signal,
2250 FsConnectRecordPtr fsPtr);
2252 void startReadSchemaFile(Signal* signal);
2253 void openReadSchemaRef(Signal* signal,
2254 FsConnectRecordPtr fsPtr);
2255 void readSchemaFile(Signal* signal, Uint32 filePtr, Uint32 fsPtr);
2256 void readSchemaConf(Signal* signal, FsConnectRecordPtr fsPtr);
2257 void readSchemaRef(Signal* signal, FsConnectRecordPtr fsPtr);
2258 void closeReadSchemaConf(Signal* signal,
2259 FsConnectRecordPtr fsPtr);
2260 bool convertSchemaFileTo_5_0_6(XSchemaFile*);
2262 /* ------------------------------------------------------------ */
2263 // Get table definitions
2264 /* ------------------------------------------------------------ */
2265 void sendGET_TABINFOREF(Signal* signal,
2266 GetTabInfoReq*,
2267 GetTabInfoRef::ErrorCode errorCode);
2269 void sendGET_TABLEID_REF(Signal* signal,
2270 GetTableIdReq * req,
2271 GetTableIdRef::ErrorCode errorCode);
2273 void sendGetTabResponse(Signal* signal);
2275 /* ------------------------------------------------------------ */
2276 // Indexes and triggers
2277 /* ------------------------------------------------------------ */
2279 // reactivate and rebuild indexes on start up
2280 void activateIndexes(Signal* signal, Uint32 i);
2281 void rebuildIndexes(Signal* signal, Uint32 i);
2283 // create index
2284 void createIndex_recvReply(Signal* signal, const CreateIndxConf* conf,
2285 const CreateIndxRef* ref);
2286 void createIndex_slavePrepare(Signal* signal, OpCreateIndexPtr opPtr);
2287 void createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr);
2288 void createIndex_fromCreateTable(Signal* signal, OpCreateIndexPtr opPtr);
2289 void createIndex_toAlterIndex(Signal* signal, OpCreateIndexPtr opPtr);
2290 void createIndex_fromAlterIndex(Signal* signal, OpCreateIndexPtr opPtr);
2291 void createIndex_slaveCommit(Signal* signal, OpCreateIndexPtr opPtr);
2292 void createIndex_slaveAbort(Signal* signal, OpCreateIndexPtr opPtr);
2293 void createIndex_sendSlaveReq(Signal* signal, OpCreateIndexPtr opPtr);
2294 void createIndex_sendReply(Signal* signal, OpCreateIndexPtr opPtr, bool);
2295 // drop index
2296 void dropIndex_recvReply(Signal* signal, const DropIndxConf* conf,
2297 const DropIndxRef* ref);
2298 void dropIndex_slavePrepare(Signal* signal, OpDropIndexPtr opPtr);
2299 void dropIndex_toAlterIndex(Signal* signal, OpDropIndexPtr opPtr);
2300 void dropIndex_fromAlterIndex(Signal* signal, OpDropIndexPtr opPtr);
2301 void dropIndex_toDropTable(Signal* signal, OpDropIndexPtr opPtr);
2302 void dropIndex_fromDropTable(Signal* signal, OpDropIndexPtr opPtr);
2303 void dropIndex_slaveCommit(Signal* signal, OpDropIndexPtr opPtr);
2304 void dropIndex_slaveAbort(Signal* signal, OpDropIndexPtr opPtr);
2305 void dropIndex_sendSlaveReq(Signal* signal, OpDropIndexPtr opPtr);
2306 void dropIndex_sendReply(Signal* signal, OpDropIndexPtr opPtr, bool);
2307 // alter index
2308 void alterIndex_recvReply(Signal* signal, const AlterIndxConf* conf,
2309 const AlterIndxRef* ref);
2310 void alterIndex_slavePrepare(Signal* signal, OpAlterIndexPtr opPtr);
2311 void alterIndex_toCreateTc(Signal* signal, OpAlterIndexPtr opPtr);
2312 void alterIndex_fromCreateTc(Signal* signal, OpAlterIndexPtr opPtr);
2313 void alterIndex_toDropTc(Signal* signal, OpAlterIndexPtr opPtr);
2314 void alterIndex_fromDropTc(Signal* signal, OpAlterIndexPtr opPtr);
2315 void alterIndex_toCreateTrigger(Signal* signal, OpAlterIndexPtr opPtr);
2316 void alterIndex_fromCreateTrigger(Signal* signal, OpAlterIndexPtr opPtr);
2317 void alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr);
2318 void alterIndex_fromDropTrigger(Signal* signal, OpAlterIndexPtr opPtr);
2319 void alterIndex_toBuildIndex(Signal* signal, OpAlterIndexPtr opPtr);
2320 void alterIndex_fromBuildIndex(Signal* signal, OpAlterIndexPtr opPtr);
2321 void alterIndex_slaveCommit(Signal* signal, OpAlterIndexPtr opPtr);
2322 void alterIndex_slaveAbort(Signal* signal, OpAlterIndexPtr opPtr);
2323 void alterIndex_sendSlaveReq(Signal* signal, OpAlterIndexPtr opPtr);
2324 void alterIndex_sendReply(Signal* signal, OpAlterIndexPtr opPtr, bool);
2325 // build index
2326 void buildIndex_recvReply(Signal* signal, const BuildIndxConf* conf,
2327 const BuildIndxRef* ref);
2328 void buildIndex_toCreateConstr(Signal* signal, OpBuildIndexPtr opPtr);
2329 void buildIndex_fromCreateConstr(Signal* signal, OpBuildIndexPtr opPtr);
2330 void buildIndex_buildTrix(Signal* signal, OpBuildIndexPtr opPtr);
2331 void buildIndex_toDropConstr(Signal* signal, OpBuildIndexPtr opPtr);
2332 void buildIndex_fromDropConstr(Signal* signal, OpBuildIndexPtr opPtr);
2333 void buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr);
2334 void buildIndex_fromOnline(Signal* signal, OpBuildIndexPtr opPtr);
2335 void buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr);
2336 void buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr, bool);
2338 // Events
2339 void
2340 createEventUTIL_PREPARE(Signal* signal,
2341 Uint32 callbackData,
2342 Uint32 returnCode);
2343 void
2344 createEventUTIL_EXECUTE(Signal *signal,
2345 Uint32 callbackData,
2346 Uint32 returnCode);
2347 void
2348 dropEventUTIL_PREPARE_READ(Signal* signal,
2349 Uint32 callbackData,
2350 Uint32 returnCode);
2351 void
2352 dropEventUTIL_EXECUTE_READ(Signal* signal,
2353 Uint32 callbackData,
2354 Uint32 returnCode);
2355 void
2356 dropEventUTIL_PREPARE_DELETE(Signal* signal,
2357 Uint32 callbackData,
2358 Uint32 returnCode);
2359 void
2360 dropEventUTIL_EXECUTE_DELETE(Signal *signal,
2361 Uint32 callbackData,
2362 Uint32 returnCode);
2363 void
2364 dropEventUtilPrepareRef(Signal* signal,
2365 Uint32 callbackData,
2366 Uint32 returnCode);
2367 void
2368 dropEventUtilExecuteRef(Signal* signal,
2369 Uint32 callbackData,
2370 Uint32 returnCode);
2372 sendSignalUtilReq(Callback *c,
2373 BlockReference ref,
2374 GlobalSignalNumber gsn,
2375 Signal* signal,
2376 Uint32 length,
2377 JobBufferLevel jbuf,
2378 LinearSectionPtr ptr[3],
2379 Uint32 noOfSections);
2381 recvSignalUtilReq(Signal* signal, Uint32 returnCode);
2383 void completeSubStartReq(Signal* signal, Uint32 ptrI, Uint32 returnCode);
2384 void completeSubStopReq(Signal* signal, Uint32 ptrI, Uint32 returnCode);
2385 void completeSubRemoveReq(Signal* signal, Uint32 ptrI, Uint32 returnCode);
2387 void dropEvent_sendReply(Signal* signal,
2388 OpDropEventPtr evntRecPtr);
2390 void createEvent_RT_USER_CREATE(Signal* signal, OpCreateEventPtr evntRecPtr);
2391 void createEventComplete_RT_USER_CREATE(Signal* signal,
2392 OpCreateEventPtr evntRecPtr);
2393 void createEvent_RT_USER_GET(Signal* signal, OpCreateEventPtr evntRecPtr);
2394 void createEventComplete_RT_USER_GET(Signal* signal, OpCreateEventPtr evntRecPtr);
2396 void createEvent_RT_DICT_AFTER_GET(Signal* signal, OpCreateEventPtr evntRecPtr);
2398 void createEvent_nodeFailCallback(Signal* signal, Uint32 eventRecPtrI,
2399 Uint32 returnCode);
2400 void createEvent_sendReply(Signal* signal, OpCreateEventPtr evntRecPtr,
2401 LinearSectionPtr *ptr = NULL, int noLSP = 0);
2403 void prepareTransactionEventSysTable (Callback *c,
2404 Signal* signal,
2405 Uint32 senderData,
2406 UtilPrepareReq::OperationTypeValue prepReq);
2407 void prepareUtilTransaction(Callback *c,
2408 Signal* signal,
2409 Uint32 senderData,
2410 Uint32 tableId,
2411 const char *tableName,
2412 UtilPrepareReq::OperationTypeValue prepReq,
2413 Uint32 noAttr,
2414 Uint32 attrIds[],
2415 const char *attrNames[]);
2417 void executeTransEventSysTable(Callback *c,
2418 Signal *signal,
2419 const Uint32 ptrI,
2420 sysTab_NDBEVENTS_0& m_eventRec,
2421 const Uint32 prepareId,
2422 UtilPrepareReq::OperationTypeValue prepReq);
2423 void executeTransaction(Callback *c,
2424 Signal* signal,
2425 Uint32 senderData,
2426 Uint32 prepareId,
2427 Uint32 noAttr,
2428 LinearSectionPtr headerPtr,
2429 LinearSectionPtr dataPtr);
2431 void parseReadEventSys(Signal *signal, sysTab_NDBEVENTS_0& m_eventRec);
2433 // create trigger
2434 void createTrigger_recvReply(Signal* signal, const CreateTrigConf* conf,
2435 const CreateTrigRef* ref);
2436 void createTrigger_slavePrepare(Signal* signal, OpCreateTriggerPtr opPtr);
2437 void createTrigger_masterSeize(Signal* signal, OpCreateTriggerPtr opPtr);
2438 void createTrigger_slaveCreate(Signal* signal, OpCreateTriggerPtr opPtr);
2439 void createTrigger_toAlterTrigger(Signal* signal, OpCreateTriggerPtr opPtr);
2440 void createTrigger_fromAlterTrigger(Signal* signal, OpCreateTriggerPtr opPtr);
2441 void createTrigger_slaveCommit(Signal* signal, OpCreateTriggerPtr opPtr);
2442 void createTrigger_slaveAbort(Signal* signal, OpCreateTriggerPtr opPtr);
2443 void createTrigger_sendSlaveReq(Signal* signal, OpCreateTriggerPtr opPtr);
2444 void createTrigger_sendReply(Signal* signal, OpCreateTriggerPtr opPtr, bool);
2445 // drop trigger
2446 void dropTrigger_recvReply(Signal* signal, const DropTrigConf* conf,
2447 const DropTrigRef* ref);
2448 void dropTrigger_slavePrepare(Signal* signal, OpDropTriggerPtr opPtr);
2449 void dropTrigger_toAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr);
2450 void dropTrigger_fromAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr);
2451 void dropTrigger_slaveCommit(Signal* signal, OpDropTriggerPtr opPtr);
2452 void dropTrigger_slaveAbort(Signal* signal, OpDropTriggerPtr opPtr);
2453 void dropTrigger_sendSlaveReq(Signal* signal, OpDropTriggerPtr opPtr);
2454 void dropTrigger_sendReply(Signal* signal, OpDropTriggerPtr opPtr, bool);
2455 // alter trigger
2456 void alterTrigger_recvReply(Signal* signal, const AlterTrigConf* conf,
2457 const AlterTrigRef* ref);
2458 void alterTrigger_slavePrepare(Signal* signal, OpAlterTriggerPtr opPtr);
2459 void alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr);
2460 void alterTrigger_fromCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr);
2461 void alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr);
2462 void alterTrigger_fromDropLocal(Signal* signal, OpAlterTriggerPtr opPtr);
2463 void alterTrigger_slaveCommit(Signal* signal, OpAlterTriggerPtr opPtr);
2464 void alterTrigger_slaveAbort(Signal* signal, OpAlterTriggerPtr opPtr);
2465 void alterTrigger_sendSlaveReq(Signal* signal, OpAlterTriggerPtr opPtr);
2466 void alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, bool);
2467 // support
2468 void getTableKeyList(TableRecordPtr,
2469 Id_array<MAX_ATTRIBUTES_IN_INDEX+1>& list);
2470 void getIndexAttr(TableRecordPtr indexPtr, Uint32 itAttr, Uint32* id);
2471 void getIndexAttrList(TableRecordPtr indexPtr, AttributeList& list);
2472 void getIndexAttrMask(TableRecordPtr indexPtr, AttributeMask& mask);
2474 /* ------------------------------------------------------------ */
2475 // Initialisation
2476 /* ------------------------------------------------------------ */
2477 void initCommonData();
2478 void initRecords();
2479 void initConnectRecord();
2480 void initRetrieveRecord(Signal*, Uint32, Uint32 returnCode);
2481 void initSchemaRecord();
2482 void initRestartRecord();
2483 void initSendSchemaRecord();
2484 void initReadTableRecord();
2485 void initWriteTableRecord();
2486 void initReadSchemaRecord();
2487 void initWriteSchemaRecord();
2489 void initNodeRecords();
2490 void initTableRecords();
2491 void initialiseTableRecord(TableRecordPtr tablePtr);
2492 void initTriggerRecords();
2493 void initialiseTriggerRecord(TriggerRecordPtr triggerPtr);
2494 void initPageRecords();
2496 Uint32 getFsConnRecord();
2498 bool getIsFailed(Uint32 nodeId) const;
2500 void dropTable_backup_mutex_locked(Signal* signal, Uint32, Uint32);
2501 void dropTableRef(Signal * signal, DropTableReq *, DropTableRef::ErrorCode);
2502 void printTables(); // For debugging only
2503 int handleAlterTab(AlterTabReq * req,
2504 CreateTableRecord * regAlterTabPtr,
2505 TableRecordPtr origTablePtr,
2506 TableRecordPtr newTablePtr);
2507 void revertAlterTable(Signal * signal,
2508 Uint32 changeMask,
2509 Uint32 tableId,
2510 CreateTableRecord * regAlterTabPtr);
2511 void alterTable_backup_mutex_locked(Signal* signal, Uint32, Uint32);
2512 void alterTableRef(Signal * signal,
2513 AlterTableReq *, AlterTableRef::ErrorCode,
2514 ParseDictTabInfoRecord* parseRecord = NULL);
2515 void alterTabRef(Signal * signal,
2516 AlterTabReq *, AlterTableRef::ErrorCode,
2517 ParseDictTabInfoRecord* parseRecord = NULL);
2518 void alterTab_writeSchemaConf(Signal* signal,
2519 Uint32 callbackData,
2520 Uint32 returnCode);
2521 void alterTab_writeTableConf(Signal* signal,
2522 Uint32 callbackData,
2523 Uint32 returnCode);
2525 void prepDropTab_nextStep(Signal* signal, DropTableRecordPtr);
2526 void prepDropTab_complete(Signal* signal, DropTableRecordPtr);
2527 void prepDropTab_writeSchemaConf(Signal* signal, Uint32 dropTabPtrI, Uint32);
2529 void dropTab_localDROP_TAB_CONF(Signal* signal);
2530 void dropTab_nextStep(Signal* signal, DropTableRecordPtr);
2531 void dropTab_complete(Signal* signal, Uint32 dropTabPtrI, Uint32);
2532 void dropTab_writeSchemaConf(Signal* signal, Uint32 dropTabPtrI, Uint32);
2534 void createTab_prepare(Signal* signal, CreateTabReq * req);
2535 void createTab_writeSchemaConf1(Signal* signal, Uint32 callback, Uint32);
2536 void createTab_writeTableConf(Signal* signal, Uint32 callbackData, Uint32);
2537 void createTab_dih(Signal*, CreateTableRecordPtr,
2538 SegmentedSectionPtr, Callback*);
2539 void createTab_dihComplete(Signal* signal, Uint32 callbackData, Uint32);
2541 void createTab_startLcpMutex_locked(Signal* signal, Uint32, Uint32);
2542 void createTab_startLcpMutex_unlocked(Signal* signal, Uint32, Uint32);
2544 void createTab_commit(Signal* signal, CreateTabReq * req);
2545 void createTab_writeSchemaConf2(Signal* signal, Uint32 callbackData, Uint32);
2546 void createTab_alterComplete(Signal*, Uint32 callbackData, Uint32);
2548 void createTab_drop(Signal* signal, CreateTabReq * req);
2549 void createTab_dropComplete(Signal* signal, Uint32 callbackData, Uint32);
2551 void createTab_reply(Signal* signal, CreateTableRecordPtr, Uint32 nodeId);
2552 void alterTab_activate(Signal*, CreateTableRecordPtr, Callback*);
2554 void restartCreateTab(Signal*, Uint32,
2555 const SchemaFile::TableEntry *,
2556 const SchemaFile::TableEntry *, bool);
2557 void restartCreateTab_readTableConf(Signal* signal, Uint32 callback, Uint32);
2558 void restartCreateTab_writeTableConf(Signal* signal, Uint32 callback, Uint32);
2559 void restartCreateTab_dihComplete(Signal* signal, Uint32 callback, Uint32);
2560 void restartCreateTab_activateComplete(Signal*, Uint32 callback, Uint32);
2562 void restartDropTab(Signal* signal, Uint32 tableId,
2563 const SchemaFile::TableEntry *,
2564 const SchemaFile::TableEntry *);
2565 void restartDropTab_complete(Signal*, Uint32 callback, Uint32);
2567 void restartDropObj(Signal*, Uint32, const SchemaFile::TableEntry *);
2568 void restartDropObj_prepare_start_done(Signal*, Uint32, Uint32);
2569 void restartDropObj_prepare_complete_done(Signal*, Uint32, Uint32);
2570 void restartDropObj_commit_start_done(Signal*, Uint32, Uint32);
2571 void restartDropObj_commit_complete_done(Signal*, Uint32, Uint32);
2573 void restart_checkSchemaStatusComplete(Signal*, Uint32 callback, Uint32);
2574 void restart_writeSchemaConf(Signal*, Uint32 callbackData, Uint32);
2575 void masterRestart_checkSchemaStatusComplete(Signal*, Uint32, Uint32);
2577 void sendSchemaComplete(Signal*, Uint32 callbackData, Uint32);
2579 void execCREATE_OBJ_REQ(Signal* signal);
2580 void execCREATE_OBJ_REF(Signal* signal);
2581 void execCREATE_OBJ_CONF(Signal* signal);
2583 void createObj_prepare_start_done(Signal* signal, Uint32 callback, Uint32);
2584 void createObj_writeSchemaConf1(Signal* signal, Uint32 callback, Uint32);
2585 void createObj_writeObjConf(Signal* signal, Uint32 callbackData, Uint32);
2586 void createObj_prepare_complete_done(Signal*, Uint32 callbackData, Uint32);
2587 void createObj_commit_start_done(Signal* signal, Uint32 callback, Uint32);
2588 void createObj_writeSchemaConf2(Signal* signal, Uint32 callbackData, Uint32);
2589 void createObj_commit_complete_done(Signal*, Uint32 callbackData, Uint32);
2590 void createObj_abort(Signal*, struct CreateObjReq*);
2591 void createObj_abort_start_done(Signal*, Uint32 callbackData, Uint32);
2592 void createObj_abort_writeSchemaConf(Signal*, Uint32 callbackData, Uint32);
2593 void createObj_abort_complete_done(Signal*, Uint32 callbackData, Uint32);
2595 void schemaOp_reply(Signal* signal, SchemaTransaction *, Uint32);
2596 void trans_commit_start_done(Signal*, Uint32 callbackData, Uint32);
2597 void trans_commit_complete_done(Signal*, Uint32 callbackData, Uint32);
2598 void trans_abort_start_done(Signal*, Uint32 callbackData, Uint32);
2599 void trans_abort_complete_done(Signal*, Uint32 callbackData, Uint32);
2601 void execDROP_OBJ_REQ(Signal* signal);
2602 void execDROP_OBJ_REF(Signal* signal);
2603 void execDROP_OBJ_CONF(Signal* signal);
2605 void dropObj_prepare_start_done(Signal* signal, Uint32 callback, Uint32);
2606 void dropObj_prepare_writeSchemaConf(Signal*, Uint32 callback, Uint32);
2607 void dropObj_prepare_complete_done(Signal*, Uint32 callbackData, Uint32);
2608 void dropObj_commit_start_done(Signal*, Uint32 callbackData, Uint32);
2609 void dropObj_commit_writeSchemaConf(Signal*, Uint32 callback, Uint32);
2610 void dropObj_commit_complete_done(Signal*, Uint32 callbackData, Uint32);
2611 void dropObj_abort_start_done(Signal*, Uint32 callbackData, Uint32);
2612 void dropObj_abort_writeSchemaConf(Signal*, Uint32 callback, Uint32);
2613 void dropObj_abort_complete_done(Signal*, Uint32 callbackData, Uint32);
2615 void restartCreateObj(Signal*, Uint32,
2616 const SchemaFile::TableEntry *,
2617 const SchemaFile::TableEntry *, bool);
2618 void restartCreateObj_readConf(Signal*, Uint32, Uint32);
2619 void restartCreateObj_getTabInfoConf(Signal*);
2620 void restartCreateObj_prepare_start_done(Signal*, Uint32, Uint32);
2621 void restartCreateObj_write_complete(Signal*, Uint32, Uint32);
2622 void restartCreateObj_prepare_complete_done(Signal*, Uint32, Uint32);
2623 void restartCreateObj_commit_start_done(Signal*, Uint32, Uint32);
2624 void restartCreateObj_commit_complete_done(Signal*, Uint32, Uint32);
2626 void execDICT_COMMIT_REQ(Signal*);
2627 void execDICT_COMMIT_REF(Signal*);
2628 void execDICT_COMMIT_CONF(Signal*);
2630 void execDICT_ABORT_REQ(Signal*);
2631 void execDICT_ABORT_REF(Signal*);
2632 void execDICT_ABORT_CONF(Signal*);
2634 public:
2635 void createObj_commit(Signal*, struct SchemaOp*);
2636 void createObj_abort(Signal*, struct SchemaOp*);
2638 void create_fg_prepare_start(Signal* signal, SchemaOp*);
2639 void create_fg_prepare_complete(Signal* signal, SchemaOp*);
2640 void create_fg_abort_start(Signal* signal, SchemaOp*);
2641 void create_fg_abort_complete(Signal* signal, SchemaOp*);
2643 void create_file_prepare_start(Signal* signal, SchemaOp*);
2644 void create_file_prepare_complete(Signal* signal, SchemaOp*);
2645 void create_file_commit_start(Signal* signal, SchemaOp*);
2646 void create_file_abort_start(Signal* signal, SchemaOp*);
2647 void create_file_abort_complete(Signal* signal, SchemaOp*);
2649 void dropObj_commit(Signal*, struct SchemaOp*);
2650 void dropObj_abort(Signal*, struct SchemaOp*);
2651 void drop_file_prepare_start(Signal* signal, SchemaOp*);
2652 void drop_file_commit_start(Signal* signal, SchemaOp*);
2653 void drop_file_commit_complete(Signal* signal, SchemaOp*);
2654 void drop_file_abort_start(Signal* signal, SchemaOp*);
2655 void send_drop_file(Signal*, SchemaOp*, DropFileImplReq::RequestInfo);
2657 void drop_fg_prepare_start(Signal* signal, SchemaOp*);
2658 void drop_fg_commit_start(Signal* signal, SchemaOp*);
2659 void drop_fg_commit_complete(Signal* signal, SchemaOp*);
2660 void drop_fg_abort_start(Signal* signal, SchemaOp*);
2661 void send_drop_fg(Signal*, SchemaOp*, DropFilegroupImplReq::RequestInfo);
2663 void drop_undofile_prepare_start(Signal* signal, SchemaOp*);
2664 void drop_undofile_commit_complete(Signal* signal, SchemaOp*);
2666 int checkSingleUserMode(Uint32 senderRef);
2669 inline bool
2670 Dbdict::TableRecord::isTable() const
2672 return DictTabInfo::isTable(tableType);
2675 inline bool
2676 Dbdict::TableRecord::isIndex() const
2678 return DictTabInfo::isIndex(tableType);
2681 inline bool
2682 Dbdict::TableRecord::isUniqueIndex() const
2684 return DictTabInfo::isUniqueIndex(tableType);
2687 inline bool
2688 Dbdict::TableRecord::isNonUniqueIndex() const
2690 return DictTabInfo::isNonUniqueIndex(tableType);
2693 inline bool
2694 Dbdict::TableRecord::isHashIndex() const
2696 return DictTabInfo::isHashIndex(tableType);
2699 inline bool
2700 Dbdict::TableRecord::isOrderedIndex() const
2702 return DictTabInfo::isOrderedIndex(tableType);
2706 #endif