1 /* Copyright (c) 2003-2007 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 */
19 #include <ndb_global.h>
20 #include <kernel_types.h>
22 #include "VMSignal.hpp"
24 #include <BlockNumbers.h>
25 #include <NodeState.hpp>
26 #include <NodeInfo.hpp>
27 #include "ArrayPool.hpp"
31 enum restartStates
{initial_state
,
37 Uint32 m_restart_seq
; //
38 NodeVersionInfo m_versionInfo
;
39 NodeInfo m_nodeInfo
[MAX_NODES
];
40 Signal VMSignals
[1]; // Owned by FastScheduler::
42 Uint64 internalMillisecCounter
; // Owned by ThreadConfig::
43 Uint32 highestAvailablePrio
; // Owned by FastScheduler::
44 Uint32 JobCounter
; // Owned by FastScheduler
45 Uint64 JobLap
; // Owned by FastScheduler
46 Uint32 loopMax
; // Owned by FastScheduler
48 Uint32 theNextTimerJob
; // Owned by TimeQueue::
49 Uint32 theCurrentTimer
; // Owned by TimeQueue::
50 Uint32 theShortTQIndex
; // Owned by TimeQueue::
52 Uint32 theLongTQIndex
; // Owned by TimeQueue::
53 Uint32 theCountTimer
; // Owned by TimeQueue::
54 Uint32 theFirstFreeTQIndex
; // Owned by TimeQueue::
55 Uint32 testOn
; // Owned by the Signal Loggers
57 NodeId ownId
; // Own processor id
60 restartStates theRestartFlag
;
63 Uint32 sendPackedActivated
;
64 Uint32 activateSendPacked
;
68 theStartLevel
= NodeState::SL_NOTHING
;
69 theRestartFlag
= perform_start
;
73 void setBlock(BlockNumber blockNo
, SimulatedBlock
* block
);
74 SimulatedBlock
* getBlock(BlockNumber blockNo
);
76 void incrementWatchDogCounter(Uint32 place
);
77 const Uint32
* getWatchDogPtr();
81 SimulatedBlock
* blockTable
[NO_OF_BLOCKS
]; // Owned by Dispatcher::
83 ArrayPool
<GlobalPage
> m_global_page_pool
;
84 ArrayPool
<GlobalPage
> m_shared_page_pool
;
87 extern GlobalData globalData
;
89 #define GLOBAL_TEST_ON (localTestOn)
90 #define GET_GLOBAL_TEST_FLAG bool localTestOn = globalData.testOn
91 #define SET_GLOBAL_TEST_ON (globalData.testOn = true)
92 #define SET_GLOBAL_TEST_OFF (globalData.testOn = false)
93 #define TOGGLE_GLOBAL_TEST_FLAG (globalData.testOn = (globalData.testOn == true ? false : true))
97 GlobalData::setBlock(BlockNumber blockNo
, SimulatedBlock
* block
){
98 blockNo
-= MIN_BLOCK_NO
;
99 assert((blockTable
[blockNo
] == 0) || (blockTable
[blockNo
] == block
));
100 blockTable
[blockNo
] = block
;
105 GlobalData::getBlock(BlockNumber blockNo
){
106 blockNo
-= MIN_BLOCK_NO
;
107 return blockTable
[blockNo
];
112 GlobalData::incrementWatchDogCounter(Uint32 place
){
118 GlobalData::getWatchDogPtr(){