1
/* Copyright (C) 2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20
#define ACC_SAFE_QUEUE
24
#include <SimulatedBlock.hpp>
28
#define dbgWord32(ptr, ind, val)
31
#define dbgWord32(ptr, ind, val) \
35
case 1: strcpy(tmp_string, "ZPOS_PAGE_TYPE "); \
37
case 2: strcpy(tmp_string, "ZPOS_NO_ELEM_IN_PAGE"); \
39
case 3: strcpy(tmp_string, "ZPOS_CHECKSUM "); \
41
case 4: strcpy(tmp_string, "ZPOS_OVERFLOWREC "); \
43
case 5: strcpy(tmp_string, "ZPOS_FREE_AREA_IN_PAGE"); \
45
case 6: strcpy(tmp_string, "ZPOS_LAST_INDEX "); \
47
case 7: strcpy(tmp_string, "ZPOS_INSERT_INDEX "); \
49
case 8: strcpy(tmp_string, "ZPOS_ARRAY_POS "); \
51
case 9: strcpy(tmp_string, "ZPOS_NEXT_FREE_INDEX"); \
53
case 10: strcpy(tmp_string, "ZPOS_NEXT_PAGE "); \
55
case 11: strcpy(tmp_string, "ZPOS_PREV_PAGE "); \
57
default: sprintf(tmp_string, "%-20d", ind);\
59
ndbout << "Ptr: " << ptr.p->word32 << " \tIndex: " << tmp_string << " \tValue: " << tmp_val << " \tLINE: " << __LINE__ << endl; \
64
/** ------------------------------------------------------------------------
65
* THESE ARE CONSTANTS THAT ARE USED FOR DEFINING THE SIZE OF BUFFERS, THE
66
* SIZE OF PAGE HEADERS, THE NUMBER OF BUFFERS IN A PAGE AND A NUMBER OF
67
* OTHER CONSTANTS WHICH ARE CHANGED WHEN THE BUFFER SIZE IS CHANGED.
68
* ----------------------------------------------------------------------- */
70
#define ZCON_HEAD_SIZE 2
74
#define ZDOWN_LIMIT 12
76
#define ZSHIFT_MINUS 2
77
#define ZFREE_LIMIT 65
78
#define ZNO_CONTAINERS 64
79
#define ZELEM_HEAD_SIZE 1
80
/* ------------------------------------------------------------------------- */
81
/* THESE CONSTANTS DEFINE THE USE OF THE PAGE HEADER IN THE INDEX PAGES. */
82
/* ------------------------------------------------------------------------- */
83
#define ZPOS_PAGE_ID 0
84
#define ZPOS_PAGE_TYPE 1
85
#define ZPOS_PAGE_TYPE_BIT 14
86
#define ZPOS_EMPTY_LIST 1
87
#define ZPOS_ALLOC_CONTAINERS 2
88
#define ZPOS_CHECKSUM 3
89
#define ZPOS_OVERFLOWREC 4
90
#define ZPOS_NO_ELEM_IN_PAGE 2
91
#define ZPOS_FREE_AREA_IN_PAGE 5
92
#define ZPOS_LAST_INDEX 6
93
#define ZPOS_INSERT_INDEX 7
94
#define ZPOS_ARRAY_POS 8
95
#define ZPOS_NEXT_FREE_INDEX 9
96
#define ZPOS_NEXT_PAGE 10
97
#define ZPOS_PREV_PAGE 11
98
#define ZNORMAL_PAGE_TYPE 0
99
#define ZOVERFLOW_PAGE_TYPE 1
100
#define ZDEFAULT_LIST 3
101
#define ZWORDS_IN_PAGE 2048
104
#define ZDIRRANGESIZE 65
105
//#define ZEMPTY_FRAGMENT 0
106
#define ZFRAGMENTSIZE 64
108
#define ZFS_CONNECTSIZE 300
109
#define ZFS_OPSIZE 100
110
#define ZKEYINKEYREQ 4
112
#define ZLOCALLOGFILE 2
114
#define ZMAXSCANSIGNALLEN 20
115
#define ZMAINKEYLEN 8
116
#define ZNO_OF_DISK_VERSION 3
117
#define ZNO_OF_OP_PER_SIGNAL 20
118
//#define ZNOT_EMPTY_FRAGMENT 1
119
#define ZOP_HEAD_INFO_LN 3
120
#define ZOPRECSIZE 740
121
#define ZOVERFLOWRECSIZE 5
122
#define ZPAGE8_BASE_ADD 1
123
#define ZPAGESIZE 128
124
#define ZPARALLEL_QUEUE 1
125
#define ZPDIRECTORY 1
126
#define ZSCAN_MAX_LOCK 4
127
#define ZSERIAL_QUEUE 2
134
#define ZROOTFRAGMENTSIZE 32
135
#define ZSCAN_LOCK_ALL 3
137
* Check kernel_types for other operation types
140
#define ZSCAN_REC_SIZE 256
142
#define ZTABLESIZE 16
143
#define ZTABMAXINDEX 3
144
#define ZUNDEFINED_OP 6
147
/* --------------------------------------------------------------------------------- */
148
/* CONTINUEB CODES */
149
/* --------------------------------------------------------------------------------- */
150
#define ZINITIALISE_RECORDS 1
151
#define ZSEND_SCAN_HBREP 4
152
#define ZREL_ROOT_FRAG 5
155
#define ZREPORT_MEMORY_USAGE 8
157
/* ------------------------------------------------------------------------- */
159
/* ------------------------------------------------------------------------- */
160
#define ZLIMIT_OF_ERROR 600 // Limit check for error codes
161
#define ZCHECKROOT_ERROR 601 // Delete fragment error code
162
#define ZCONNECT_SIZE_ERROR 602 // ACC_SEIZEREF
163
#define ZDIR_RANGE_ERROR 603 // Add fragment error code
164
#define ZFULL_FRAGRECORD_ERROR 604 // Add fragment error code
165
#define ZFULL_ROOTFRAGRECORD_ERROR 605 // Add fragment error code
166
#define ZROOTFRAG_STATE_ERROR 606 // Add fragment
167
#define ZOVERTAB_REC_ERROR 607 // Add fragment
169
#define ZSCAN_REFACC_CONNECT_ERROR 608 // ACC_SCANREF
170
#define ZFOUR_ACTIVE_SCAN_ERROR 609 // ACC_SCANREF
171
#define ZNULL_SCAN_REC_ERROR 610 // ACC_SCANREF
173
#define ZDIRSIZE_ERROR 623
174
#define ZOVER_REC_ERROR 624 // Insufficient Space
175
#define ZPAGESIZE_ERROR 625
176
#define ZTUPLE_DELETED_ERROR 626
177
#define ZREAD_ERROR 626
178
#define ZWRITE_ERROR 630
179
#define ZTO_OP_STATE_ERROR 631
180
#define ZTOO_EARLY_ACCESS_ERROR 632
183
class ElementHeader {
186
* l = Locked -- If true contains operation else scan bits + hash value
189
* o = Operation ptr I
191
* 1111111111222222222233
192
* 01234567890123456789012345678901
193
* lssssssssssss hhhhhhhhhhhhhhhh
194
* ooooooooooooooooooooooooooooooo
197
STATIC_CONST( HASH_VALUE_PART_MASK = 0xFFFF );
199
static bool getLocked(Uint32 data);
200
static bool getUnlocked(Uint32 data);
201
static Uint32 getScanBits(Uint32 data);
202
static Uint32 getHashValuePart(Uint32 data);
203
static Uint32 getOpPtrI(Uint32 data);
205
static Uint32 setLocked(Uint32 opPtrI);
206
static Uint32 setUnlocked(Uint32 hashValuePart, Uint32 scanBits);
207
static Uint32 setScanBit(Uint32 header, Uint32 scanBit);
208
static Uint32 clearScanBit(Uint32 header, Uint32 scanBit);
213
ElementHeader::getLocked(Uint32 data){
214
return (data & 1) == 0;
219
ElementHeader::getUnlocked(Uint32 data){
220
return (data & 1) == 1;
225
ElementHeader::getScanBits(Uint32 data){
226
assert(getUnlocked(data));
227
return (data >> 1) & ((1 << MAX_PARALLEL_SCANS_PER_FRAG) - 1);
232
ElementHeader::getHashValuePart(Uint32 data){
233
assert(getUnlocked(data));
239
ElementHeader::getOpPtrI(Uint32 data){
240
assert(getLocked(data));
246
ElementHeader::setLocked(Uint32 opPtrI){
247
return (opPtrI << 1) + 0;
251
ElementHeader::setUnlocked(Uint32 hashValue, Uint32 scanBits){
252
return (hashValue << 16) + (scanBits << 1) + 1;
257
ElementHeader::setScanBit(Uint32 header, Uint32 scanBit){
258
assert(getUnlocked(header));
259
return header | (scanBit << 1);
264
ElementHeader::clearScanBit(Uint32 header, Uint32 scanBit){
265
assert(getUnlocked(header));
266
return header & (~(scanBit << 1));
270
class Dbacc: public SimulatedBlock {
284
SCAN_WAIT_IN_QUEUE = 37,
287
WAIT_COMMIT_ABORT = 41,
296
DELETEFIRSTFRAG = 50,
297
DELETESECONDFRAG = 51,
303
/* --------------------------------------------------------------------------------- */
304
/* DIRECTORY RANGE */
305
/* --------------------------------------------------------------------------------- */
307
Uint32 dirArray[256];
308
}; /* p2c: size = 1024 bytes */
310
typedef Ptr<DirRange> DirRangePtr;
312
/* --------------------------------------------------------------------------------- */
314
/* --------------------------------------------------------------------------------- */
315
struct Directoryarray {
317
}; /* p2c: size = 1024 bytes */
319
typedef Ptr<Directoryarray> DirectoryarrayPtr;
321
/* --------------------------------------------------------------------------------- */
322
/* FRAGMENTREC. ALL INFORMATION ABOUT FRAMENT AND HASH TABLE IS SAVED IN FRAGMENT */
323
/* REC A POINTER TO FRAGMENT RECORD IS SAVED IN ROOTFRAGMENTREC FRAGMENT */
324
/* --------------------------------------------------------------------------------- */
326
Uint32 scan[MAX_PARALLEL_SCANS_PER_FRAG];
335
Uint32 roothashcheck;
337
Uint32 m_commit_count;
340
//-----------------------------------------------------------------------------
341
// These variables keep track of allocated pages, the number of them and the
342
// start file page of them. Used during local checkpoints.
343
//-----------------------------------------------------------------------------
345
Uint32 activeDataPage;
347
//-----------------------------------------------------------------------------
348
// Temporary variables used during shrink and expand process.
349
//-----------------------------------------------------------------------------
350
Uint32 expReceivePageptr;
351
Uint32 expReceiveIndex;
352
Uint32 expReceiveForward;
353
Uint32 expSenderDirIndex;
354
Uint32 expSenderDirptr;
355
Uint32 expSenderIndex;
356
Uint32 expSenderPageptr;
358
//-----------------------------------------------------------------------------
359
// List of lock owners and list of lock waiters to support LCP handling
360
//-----------------------------------------------------------------------------
361
Uint32 lockOwnersList;
363
//-----------------------------------------------------------------------------
364
// References to Directory Ranges (which in turn references directories, which
365
// in its turn references the pages) for the bucket pages and the overflow
367
//-----------------------------------------------------------------------------
371
Uint32 lastOverIndex;
373
//-----------------------------------------------------------------------------
374
// We have a list of overflow pages with free areas. We have a special record,
375
// the overflow record representing these pages. The reason is that the
376
// same record is also used to represent pages in the directory array that have
377
// been released since they were empty (there were however higher indexes with
378
// data in them). These are put in the firstFreeDirIndexRec-list.
379
// An overflow record representing a page can only be in one of these lists.
380
//-----------------------------------------------------------------------------
381
Uint32 firstOverflowRec;
382
Uint32 lastOverflowRec;
383
Uint32 firstFreeDirindexRec;
385
//-----------------------------------------------------------------------------
386
// Counter keeping track of how many times we have expanded. We need to ensure
387
// that we do not shrink so many times that this variable becomes negative.
388
//-----------------------------------------------------------------------------
389
Uint32 expandCounter;
391
//-----------------------------------------------------------------------------
392
// These variables are important for the linear hashing algorithm.
393
// localkeylen is the size of the local key (1 and 2 is currently supported)
394
// maxloadfactor is the factor specifying when to expand
395
// minloadfactor is the factor specifying when to shrink (hysteresis model)
397
// maxp and p is the variables most central to linear hashing. p + maxp + 1 is the
398
// current number of buckets. maxp is the largest value of the type 2**n - 1
399
// which is smaller than the number of buckets. These values are used to find
400
// correct bucket with the aid of the hash value.
402
// slack is the variable keeping track of whether we have inserted more than
403
// the current size is suitable for or less. Slack together with the boundaries
404
// set by maxloadfactor and minloadfactor decides when to expand/shrink
405
// slackCheck When slack goes over this value it is time to expand.
406
// slackCheck = (maxp + p + 1)*(maxloadfactor - minloadfactor) or
407
// bucketSize * hysteresis
408
//-----------------------------------------------------------------------------
411
Uint32 maxloadfactor;
412
Uint32 minloadfactor;
417
//-----------------------------------------------------------------------------
418
// nextfreefrag is the next free fragment if linked into a free list
419
//-----------------------------------------------------------------------------
422
//-----------------------------------------------------------------------------
423
// This variable is used during restore to keep track of page id of read pages.
424
// During read of bucket pages this is used to calculate the page id and also
425
// to verify that the page id of the read page is correct. During read of over-
426
// flow pages it is only used to keep track of the number of pages read.
427
//-----------------------------------------------------------------------------
428
Uint32 nextAllocPage;
430
//-----------------------------------------------------------------------------
431
// Number of pages read from file during restore
432
//-----------------------------------------------------------------------------
433
Uint32 noOfExpectedPages;
435
//-----------------------------------------------------------------------------
436
// Fragment State, mostly applicable during LCP and restore
437
//-----------------------------------------------------------------------------
440
//-----------------------------------------------------------------------------
441
// elementLength: Length of element in bucket and overflow pages
442
// keyLength: Length of key
443
//-----------------------------------------------------------------------------
447
//-----------------------------------------------------------------------------
448
// This flag is used to avoid sending a big number of expand or shrink signals
449
// when simultaneously committing many inserts or deletes.
450
//-----------------------------------------------------------------------------
453
//-----------------------------------------------------------------------------
454
// hashcheckbit is the bit to check whether to send element to split bucket or not
455
// k (== 6) is the number of buckets per page
456
// lhfragbits is the number of bits used to calculate the fragment id
457
// lhdirbits is the number of bits used to calculate the page id
458
//-----------------------------------------------------------------------------
464
//-----------------------------------------------------------------------------
465
// nodetype can only be STORED in this release. Is currently only set, never read
466
//-----------------------------------------------------------------------------
469
//-----------------------------------------------------------------------------
470
// flag to avoid accessing table record if no char attributes
471
//-----------------------------------------------------------------------------
475
typedef Ptr<Fragmentrec> FragmentrecPtr;
477
/* --------------------------------------------------------------------------------- */
479
/* --------------------------------------------------------------------------------- */
480
struct Operationrec {
483
Uint32 elementIsforward;
485
Uint32 elementPointer;
488
Uint32 hashvaluePart;
490
Uint32 nextLockOwnerOp;
492
Uint32 nextParallelQue;
494
Uint32 nextSerialQue;
495
Uint32 m_lock_owner_ptr_i; // if nextParallelQue = RNIL, else undefined
498
Uint32 prevLockOwnerOp;
500
Uint32 prevParallelQue;
501
Uint32 m_lo_last_parallel_op_ptr_i;
504
Uint32 prevSerialQue;
505
Uint32 m_lo_last_serial_op_ptr_i;
511
Uint16 elementContainer;
513
Uint32 xfrmtupkeylen;
518
OP_MASK = 0x0000F // 4 bits for operation type
519
,OP_LOCK_MODE = 0x00010 // 0 - shared lock, 1 = exclusive lock
520
,OP_ACC_LOCK_MODE = 0x00020 // Or:de lock mode of all operation
522
,OP_LOCK_OWNER = 0x00040
523
,OP_RUN_QUEUE = 0x00080 // In parallell queue of lock owner
524
,OP_DIRTY_READ = 0x00100
525
,OP_LOCK_REQ = 0x00200 // isAccLockReq
526
,OP_COMMIT_DELETE_CHECK = 0x00400
527
,OP_INSERT_IS_DONE = 0x00800
528
,OP_ELEMENT_DISAPPEARED = 0x01000
530
,OP_STATE_MASK = 0xF0000
531
,OP_STATE_IDLE = 0xF0000
532
,OP_STATE_WAITING = 0x00000
533
,OP_STATE_RUNNING = 0x10000
534
,OP_STATE_EXECUTED = 0x30000
536
,OP_EXECUTED_DIRTY_READ = 0x3050F
537
,OP_INITIAL = ~(Uint32)0
541
bool is_same_trans(const Operationrec* op) const {
543
transId1 == op->transId1 && transId2 == op->transId2;
546
}; /* p2c: size = 168 bytes */
548
typedef Ptr<Operationrec> OperationrecPtr;
550
/* --------------------------------------------------------------------------------- */
551
/* OVERFLOW_RECORD */
552
/* --------------------------------------------------------------------------------- */
553
struct OverflowRecord {
560
Uint32 nextfreeoverrec;
563
typedef Ptr<OverflowRecord> OverflowRecordPtr;
565
/* --------------------------------------------------------------------------------- */
567
/* --------------------------------------------------------------------------------- */
570
}; /* p2c: size = 8192 bytes */
572
typedef Ptr<Page8> Page8Ptr;
574
/* --------------------------------------------------------------------------------- */
576
/* --------------------------------------------------------------------------------- */
582
enum ScanBucketState {
587
Uint32 activeLocalFrag;
588
Uint32 nextBucketIndex;
589
Uint32 scanNextfreerec;
590
Uint32 scanFirstActiveOp;
591
Uint32 scanFirstLockedOp;
592
Uint32 scanLastLockedOp;
593
Uint32 scanFirstQueuedOp;
594
Uint32 scanLastQueuedOp;
598
Uint32 startNoOfBuckets;
599
Uint32 minBucketIndexToRescan;
600
Uint32 maxBucketIndexToRescan;
601
Uint32 scanOpsAllocated;
602
ScanBucketState scanBucketState;
605
Uint32 scanUserblockref;
609
Uint8 scanContinuebCounter;
610
Uint8 scanReadCommittedFlag;
613
typedef Ptr<ScanRec> ScanRecPtr;
616
/* --------------------------------------------------------------------------------- */
618
/* --------------------------------------------------------------------------------- */
620
Uint32 fragholder[MAX_FRAG_PER_NODE];
621
Uint32 fragptrholder[MAX_FRAG_PER_NODE];
623
BlockReference tabUserRef;
625
typedef Ptr<Tabrec> TabrecPtr;
628
Dbacc(Block_context&);
631
// pointer to TUP instance in this thread
635
void execACCMINUPDATE(Signal* signal);
638
BLOCK_DEFINES(Dbacc);
641
void execDEBUG_SIG(Signal* signal);
642
void execCONTINUEB(Signal* signal);
643
void execACC_CHECK_SCAN(Signal* signal);
644
void execEXPANDCHECK2(Signal* signal);
645
void execSHRINKCHECK2(Signal* signal);
646
void execACC_OVER_REC(Signal* signal);
647
void execNEXTOPERATION(Signal* signal);
648
void execREAD_PSEUDO_REQ(Signal* signal);
651
void execSTTOR(Signal* signal);
652
void execACCKEYREQ(Signal* signal);
653
void execACCSEIZEREQ(Signal* signal);
654
void execACCFRAGREQ(Signal* signal);
655
void execNEXT_SCANREQ(Signal* signal);
656
void execACC_ABORTREQ(Signal* signal);
657
void execACC_SCANREQ(Signal* signal);
658
void execACC_COMMITREQ(Signal* signal);
659
void execACC_TO_REQ(Signal* signal);
660
void execACC_LOCKREQ(Signal* signal);
661
void execNDB_STTOR(Signal* signal);
662
void execDROP_TAB_REQ(Signal* signal);
663
void execREAD_CONFIG_REQ(Signal* signal);
664
void execDUMP_STATE_ORD(Signal* signal);
667
void ACCKEY_error(Uint32 fromWhere);
669
void commitDeleteCheck();
670
void report_dealloc(Signal* signal, const Operationrec* opPtrP);
672
typedef void * RootfragmentrecPtr;
673
void initRootFragPageZero(FragmentrecPtr, Page8Ptr);
674
void initFragAdd(Signal*, FragmentrecPtr);
675
void initFragPageZero(FragmentrecPtr, Page8Ptr);
676
void initFragGeneral(FragmentrecPtr);
677
void verifyFragCorrect(FragmentrecPtr regFragPtr);
678
void releaseFragResources(Signal* signal, Uint32 fragIndex);
679
void releaseRootFragRecord(Signal* signal, RootfragmentrecPtr rootPtr);
680
void releaseRootFragResources(Signal* signal, Uint32 tableId);
681
void releaseDirResources(Signal* signal,
685
void releaseDirectoryResources(Signal* signal,
689
Uint32 directoryIndex);
690
void releaseOverflowResources(Signal* signal, FragmentrecPtr regFragPtr);
691
void releaseDirIndexResources(Signal* signal, FragmentrecPtr regFragPtr);
692
void releaseFragRecord(Signal* signal, FragmentrecPtr regFragPtr);
693
void initScanFragmentPart(Signal* signal);
694
Uint32 checkScanExpand(Signal* signal);
695
Uint32 checkScanShrink(Signal* signal);
696
void initialiseDirRec(Signal* signal);
697
void initialiseDirRangeRec(Signal* signal);
698
void initialiseFragRec(Signal* signal);
699
void initialiseFsConnectionRec(Signal* signal);
700
void initialiseFsOpRec(Signal* signal);
701
void initialiseOperationRec(Signal* signal);
702
void initialiseOverflowRec(Signal* signal);
703
void initialisePageRec(Signal* signal);
704
void initialiseRootfragRec(Signal* signal);
705
void initialiseScanRec(Signal* signal);
706
void initialiseTableRec(Signal* signal);
707
bool addfragtotab(Signal* signal, Uint32 rootIndex, Uint32 fragId);
708
void initOpRec(Signal* signal);
709
void sendAcckeyconf(Signal* signal);
710
Uint32 getNoParallelTransaction(const Operationrec*);
713
Uint32 getNoParallelTransactionFull(const Operationrec*);
715
#ifdef ACC_SAFE_QUEUE
716
bool validate_lock_queue(OperationrecPtr opPtr);
717
Uint32 get_parallel_head(OperationrecPtr opPtr);
718
void dump_lock_queue(OperationrecPtr loPtr);
720
bool validate_lock_queue(OperationrecPtr) { return true;}
724
void execACCKEY_ORD(Signal* signal, Uint32 opPtrI);
725
void startNext(Signal* signal, OperationrecPtr lastOp);
728
Uint32 placeReadInLockQueue(OperationrecPtr lockOwnerPtr);
729
Uint32 placeWriteInLockQueue(OperationrecPtr lockOwnerPtr);
730
void placeSerialQueue(OperationrecPtr lockOwner, OperationrecPtr op);
731
void abortSerieQueueOperation(Signal* signal, OperationrecPtr op);
732
void abortParallelQueueOperation(Signal* signal, OperationrecPtr op);
734
void expandcontainer(Signal* signal);
735
void shrinkcontainer(Signal* signal);
736
void nextcontainerinfoExp(Signal* signal);
737
void releaseAndCommitActiveOps(Signal* signal);
738
void releaseAndCommitQueuedOps(Signal* signal);
739
void releaseAndAbortLockedOps(Signal* signal);
740
void containerinfo(Signal* signal);
741
bool getScanElement(Signal* signal);
742
void initScanOpRec(Signal* signal);
743
void nextcontainerinfo(Signal* signal);
744
void putActiveScanOp(Signal* signal);
745
void putOpScanLockQue();
746
void putReadyScanQueue(Signal* signal, Uint32 scanRecIndex);
747
void releaseScanBucket(Signal* signal);
748
void releaseScanContainer(Signal* signal);
749
void releaseScanRec(Signal* signal);
750
bool searchScanContainer(Signal* signal);
751
void sendNextScanConf(Signal* signal);
752
void setlock(Signal* signal);
753
void takeOutActiveScanOp(Signal* signal);
754
void takeOutScanLockQueue(Uint32 scanRecIndex);
755
void takeOutReadyScanQueue(Signal* signal);
756
void insertElement(Signal* signal);
757
void insertContainer(Signal* signal);
758
void addnewcontainer(Signal* signal);
759
void getfreelist(Signal* signal);
760
void increaselistcont(Signal* signal);
761
void seizeLeftlist(Signal* signal);
762
void seizeRightlist(Signal* signal);
763
Uint32 readTablePk(Uint32 localkey1, Uint32 eh, OperationrecPtr);
764
Uint32 getElement(Signal* signal, OperationrecPtr& lockOwner);
765
void getdirindex(Signal* signal);
766
void commitdelete(Signal* signal);
767
void deleteElement(Signal* signal);
768
void getLastAndRemove(Signal* signal);
769
void releaseLeftlist(Signal* signal);
770
void releaseRightlist(Signal* signal);
771
void checkoverfreelist(Signal* signal);
772
void abortOperation(Signal* signal);
773
void commitOperation(Signal* signal);
774
void copyOpInfo(OperationrecPtr dst, OperationrecPtr src);
775
Uint32 executeNextOperation(Signal* signal);
776
void releaselock(Signal* signal);
777
void release_lockowner(Signal* signal, OperationrecPtr, bool commit);
778
void startNew(Signal* signal, OperationrecPtr newOwner);
779
void abortWaitingOperation(Signal*, OperationrecPtr);
780
void abortExecutedOperation(Signal*, OperationrecPtr);
782
void takeOutFragWaitQue(Signal* signal);
783
void check_lock_upgrade(Signal* signal, OperationrecPtr release_op, bool lo);
784
void check_lock_upgrade(Signal* signal, OperationrecPtr lock_owner,
785
OperationrecPtr release_op);
786
void allocOverflowPage(Signal* signal);
787
bool getfragmentrec(Signal* signal, FragmentrecPtr&, Uint32 fragId);
788
void insertLockOwnersList(Signal* signal, const OperationrecPtr&);
789
void takeOutLockOwnersList(Signal* signal, const OperationrecPtr&);
791
void initFsOpRec(Signal* signal);
792
void initOverpage(Signal* signal);
793
void initPage(Signal* signal);
794
void initRootfragrec(Signal* signal);
795
void putOpInFragWaitQue(Signal* signal);
796
void putOverflowRecInFrag(Signal* signal);
797
void putRecInFreeOverdir(Signal* signal);
798
void releaseDirectory(Signal* signal);
799
void releaseDirrange(Signal* signal);
800
void releaseFsConnRec(Signal* signal);
801
void releaseFsOpRec(Signal* signal);
802
void releaseOpRec(Signal* signal);
803
void releaseOverflowRec(Signal* signal);
804
void releaseOverpage(Signal* signal);
805
void releasePage(Signal* signal);
806
void releaseLogicalPage(Fragmentrec * fragP, Uint32 logicalPageId);
807
void seizeDirectory(Signal* signal);
808
void seizeDirrange(Signal* signal);
809
void seizeFragrec(Signal* signal);
810
void seizeFsConnectRec(Signal* signal);
811
void seizeFsOpRec(Signal* signal);
812
void seizeOpRec(Signal* signal);
813
void seizeOverRec(Signal* signal);
814
void seizePage(Signal* signal);
815
void seizeRootfragrec(Signal* signal);
816
void seizeScanRec(Signal* signal);
817
void sendSystemerror(Signal* signal, int line);
818
void takeRecOutOfFreeOverdir(Signal* signal);
819
void takeRecOutOfFreeOverpage(Signal* signal);
820
void sendScanHbRep(Signal* signal, Uint32);
822
void addFragRefuse(Signal* signal, Uint32 errorCode);
823
void ndbsttorryLab(Signal* signal);
824
void acckeyref1Lab(Signal* signal, Uint32 result_code);
825
void insertelementLab(Signal* signal);
826
void checkNextFragmentLab(Signal* signal);
827
void endofexpLab(Signal* signal);
828
void endofshrinkbucketLab(Signal* signal);
829
void senddatapagesLab(Signal* signal);
830
void sttorrysignalLab(Signal* signal);
831
void sendholdconfsignalLab(Signal* signal);
832
void accIsLockedLab(Signal* signal, OperationrecPtr lockOwnerPtr);
833
void insertExistElemLab(Signal* signal, OperationrecPtr lockOwnerPtr);
834
void refaccConnectLab(Signal* signal);
835
void releaseScanLab(Signal* signal);
836
void ndbrestart1Lab(Signal* signal);
837
void initialiseRecordsLab(Signal* signal, Uint32 ref, Uint32 data);
838
void checkNextBucketLab(Signal* signal);
839
void storeDataPageInDirectoryLab(Signal* signal);
841
void zpagesize_error(const char* where);
843
void reportMemoryUsage(Signal* signal, int gth);
844
void reenable_expand_after_redo_log_exection_complete(Signal*);
847
void xfrmKeyData(Signal* signal);
854
/* --------------------------------------------------------------------------------- */
855
/* DIRECTORY RANGE */
856
/* --------------------------------------------------------------------------------- */
858
DirRangePtr expDirRangePtr;
859
DirRangePtr gnsDirRangePtr;
860
DirRangePtr newDirRangePtr;
861
DirRangePtr rdDirRangePtr;
862
DirRangePtr nciOverflowrangeptr;
863
Uint32 cdirrangesize;
864
Uint32 cfirstfreeDirrange;
865
/* --------------------------------------------------------------------------------- */
867
/* --------------------------------------------------------------------------------- */
868
Directoryarray *directoryarray;
869
DirectoryarrayPtr expDirptr;
870
DirectoryarrayPtr rdDirptr;
871
DirectoryarrayPtr sdDirptr;
872
DirectoryarrayPtr nciOverflowDirptr;
873
Uint32 cdirarraysize;
875
Uint32 cfirstfreedir;
876
/* --------------------------------------------------------------------------------- */
877
/* FRAGMENTREC. ALL INFORMATION ABOUT FRAMENT AND HASH TABLE IS SAVED IN FRAGMENT */
878
/* REC A POINTER TO FRAGMENT RECORD IS SAVED IN ROOTFRAGMENTREC FRAGMENT */
879
/* --------------------------------------------------------------------------------- */
880
Fragmentrec *fragmentrec;
881
FragmentrecPtr fragrecptr;
882
Uint32 cfirstfreefrag;
883
Uint32 cfragmentsize;
884
/* --------------------------------------------------------------------------------- */
886
/* --------------------------------------------------------------------------------- */
888
/* --------------------------------------------------------------------------------- */
889
Operationrec *operationrec;
890
OperationrecPtr operationRecPtr;
891
OperationrecPtr idrOperationRecPtr;
892
OperationrecPtr mlpqOperPtr;
893
OperationrecPtr queOperPtr;
894
OperationrecPtr readWriteOpPtr;
897
/* --------------------------------------------------------------------------------- */
898
/* OVERFLOW_RECORD */
899
/* --------------------------------------------------------------------------------- */
900
OverflowRecord *overflowRecord;
901
OverflowRecordPtr iopOverflowRecPtr;
902
OverflowRecordPtr tfoOverflowRecPtr;
903
OverflowRecordPtr porOverflowRecPtr;
904
OverflowRecordPtr priOverflowRecPtr;
905
OverflowRecordPtr rorOverflowRecPtr;
906
OverflowRecordPtr sorOverflowRecPtr;
907
OverflowRecordPtr troOverflowRecPtr;
908
Uint32 cfirstfreeoverrec;
909
Uint32 coverflowrecsize;
911
/* --------------------------------------------------------------------------------- */
913
/* --------------------------------------------------------------------------------- */
919
Page8Ptr datapageptr;
930
Page8Ptr lastPageptr;
931
Page8Ptr lastPrevpageptr;
933
Page8Ptr lcnCopyPageptr;
935
Page8Ptr ciPageidptr;
936
Page8Ptr gsePageidptr;
938
Page8Ptr nciPageidptr;
939
Page8Ptr rsbPageidptr;
940
Page8Ptr rscPageidptr;
941
Page8Ptr slPageidptr;
942
Page8Ptr sscPageidptr;
949
Uint32 cfirstfreepage;
952
Uint32 cnoOfAllocatedPages;
953
/* --------------------------------------------------------------------------------- */
954
/* ROOTFRAGMENTREC */
955
/* DURING EXPAND FRAGMENT PROCESS, EACH FRAGMEND WILL BE EXPAND INTO TWO */
956
/* NEW FRAGMENTS.TO MAKE THIS PROCESS EASIER, DURING ADD FRAGMENT PROCESS */
957
/* NEXT FRAGMENT IDENTIIES WILL BE CALCULATED, AND TWO FRAGMENTS WILL BE */
958
/* ADDED IN (NDBACC). THEREBY EXPAND OF FRAGMENT CAN BE PERFORMED QUICK AND */
959
/* EASY.THE NEW FRAGMENT ID SENDS TO TUP MANAGER FOR ALL OPERATION PROCESS. */
960
/* --------------------------------------------------------------------------------- */
961
/* --------------------------------------------------------------------------------- */
963
/* --------------------------------------------------------------------------------- */
967
Uint32 cfirstFreeScanRec;
968
/* --------------------------------------------------------------------------------- */
970
/* --------------------------------------------------------------------------------- */
974
Uint32 tgseElementptr;
975
Uint32 tgseContainerptr;
981
Uint32 tlupElemIndex;
986
Uint32 tancContainerptr;
987
Uint32 tancPageindex;
992
Uint32 tidrPageindex;
993
Uint32 tidrContainerptr;
994
Uint32 tidrContainerhead;
996
Uint32 tlastPageindex;
997
Uint32 tlastContainerlen;
998
Uint32 tlastElementptr;
999
Uint32 tlastContainerptr;
1000
Uint32 tlastContainerhead;
1001
Uint32 trlPageindex;
1002
Uint32 tdelContainerptr;
1003
Uint32 tdelElementptr;
1007
Uint32 tgeContainerptr;
1008
Uint32 tgeElementptr;
1010
Uint32 texpReceivedBucket;
1012
Uint32 texpDirRangeIndex;
1013
Uint32 texpDirPageIndex;
1015
Uint32 tcheckpointid;
1016
Uint32 tciContainerptr;
1017
Uint32 tnciContainerptr;
1018
Uint32 tisoContainerptr;
1019
Uint32 trscContainerptr;
1020
Uint32 tsscContainerptr;
1021
Uint32 tciContainerlen;
1022
Uint32 trscContainerlen;
1023
Uint32 tsscContainerlen;
1024
Uint32 tciContainerhead;
1025
Uint32 tnciContainerhead;
1026
Uint32 tslElementptr;
1027
Uint32 tisoElementptr;
1028
Uint32 tsscElementptr;
1032
Uint32 tgseIsforward;
1033
Uint32 tsscIsforward;
1034
Uint32 trscIsforward;
1035
Uint32 tciIsforward;
1036
Uint32 tnciIsforward;
1037
Uint32 tisoIsforward;
1038
Uint32 tgseIsLocked;
1039
Uint32 tsscIsLocked;
1046
Uint32 tgflPageindex;
1049
Uint32 tslPageindex;
1050
Uint32 tgsePageindex;
1051
Uint32 tnciNextSamePage;
1053
Uint32 tciPageindex;
1054
Uint32 trsbPageindex;
1055
Uint32 tnciPageindex;
1056
Uint32 tlastPrevconptr;
1058
Uint32 tslUpdateHeader;
1060
BlockReference tuserblockref;
1064
Uint32 tgdiPageindex;
1076
BlockReference clqhBlockRef;
1079
BlockReference cownBlockref;
1080
BlockReference cndbcntrRef;
1083
Uint32 csystemRestart;
1085
Uint32 cexcPageindex;
1086
Uint32 cexcContainerptr;
1087
Uint32 cexcContainerhead;
1088
Uint32 cexcContainerlen;
1089
Uint32 cexcElementptr;
1090
Uint32 cexcPrevconptr;
1091
Uint32 cexcMovedLen;
1092
Uint32 cexcPrevpageptr;
1093
Uint32 cexcPrevpageindex;
1094
Uint32 cexcPrevforward;
1095
Uint32 clocalkey[32];
1097
Uint32 ckeys[2048 * MAX_XFRM_MULTIPLY];
1101
Uint32 c_errorInsert3000_TableId;
1102
Uint32 c_memusage_report_frequency;