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 */
16
#include <ndb_global.h>
19
#include "Configuration.hpp"
20
#include <ErrorHandlingMacros.hpp>
21
#include "GlobalData.hpp"
23
#include <ConfigRetriever.hpp>
24
#include <IPCConfig.hpp>
25
#include <ndb_version.h>
28
#include <WatchDog.hpp>
30
#include <mgmapi_configuration.hpp>
31
#include <mgmapi_config_parameters_debug.h>
32
#include <kernel_config_parameters.h>
34
#include <kernel_types.h>
35
#include <ndb_limits.h>
36
#include <ndbapi_limits.h>
38
#include <LogLevel.hpp>
42
void ndbSetOwnVersion();
45
#include <EventLogger.hpp>
46
extern EventLogger g_eventLogger;
49
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
57
// XXX should be my_bool ???
58
static int _daemon, _no_daemon, _foreground, _initial, _no_start;
59
static int _initialstart;
60
static const char* _nowait_nodes = 0;
61
static const char* _bind_address = 0;
63
extern Uint32 g_start_type;
64
extern NdbNodeBitmask g_nowait_nodes;
66
const char *load_default_groups[]= { "mysql_cluster","ndbd",0 };
69
* Arguments to NDB process
71
static struct my_option my_long_options[] =
74
{ "initial", OPT_INITIAL,
75
"Perform initial start of ndbd, including cleaning the file system. "
76
"Consult documentation before using this",
77
(uchar**) &_initial, (uchar**) &_initial, 0,
78
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
80
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
81
(uchar**) &_no_start, (uchar**) &_no_start, 0,
82
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
83
{ "daemon", 'd', "Start ndbd as daemon (default)",
84
(uchar**) &_daemon, (uchar**) &_daemon, 0,
85
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
86
{ "nodaemon", OPT_NODAEMON,
87
"Do not start ndbd as daemon, provided for testing purposes",
88
(uchar**) &_no_daemon, (uchar**) &_no_daemon, 0,
89
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
90
{ "foreground", OPT_FOREGROUND,
91
"Run real ndbd in foreground, provided for debugging purposes"
92
" (implies --nodaemon)",
93
(uchar**) &_foreground, (uchar**) &_foreground, 0,
94
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
95
{ "nowait-nodes", OPT_NOWAIT_NODES,
96
"Nodes that will not be waited for during start",
97
(uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
98
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
99
{ "initial-start", OPT_INITIAL_START,
100
"Perform initial start",
101
(uchar**) &_initialstart, (uchar**) &_initialstart, 0,
102
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
103
{ "bind-address", OPT_NOWAIT_NODES,
104
"Local bind address",
105
(uchar**) &_bind_address, (uchar**) &_bind_address, 0,
106
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
107
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
109
static void short_usage_sub(void)
111
printf("Usage: %s [OPTIONS]\n", my_progname);
116
ndb_std_print_version();
117
print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
119
my_print_help(my_long_options);
120
my_print_variables(my_long_options);
124
Configuration::init(int argc, char** argv)
126
load_defaults("my",load_default_groups,&argc,&argv);
130
opt_debug= "d:t:O,/tmp/ndbd.trace";
132
if ((ho_error=handle_options(&argc, &argv, my_long_options,
133
ndb_std_get_one_option)))
136
if (_no_daemon || _foreground) {
140
DBUG_PRINT("info", ("no_start=%d", _no_start));
141
DBUG_PRINT("info", ("initial=%d", _initial));
142
DBUG_PRINT("info", ("daemon=%d", _daemon));
143
DBUG_PRINT("info", ("foreground=%d", _foreground));
144
DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
148
// Check the start flag
150
globalData.theRestartFlag = initial_state;
152
globalData.theRestartFlag = perform_start;
154
// Check the initial flag
156
_initialStart = true;
158
// Check connectstring
160
_connectString = strdup(opt_connect_str);
166
_foregroundMode = true;
169
if(argc > 0 && argv[0] != 0)
170
_programName = strdup(argv[0]);
172
_programName = strdup("");
178
BaseString str(_nowait_nodes);
179
Vector<BaseString> arr;
181
for (Uint32 i = 0; i<arr.size(); i++)
184
long val = strtol(arr[i].c_str(), &endptr, 10);
187
ndbout_c("Unable to parse nowait-nodes argument: %s : %s",
188
arr[i].c_str(), _nowait_nodes);
191
if (! (val > 0 && val < MAX_NDB_NODES))
193
ndbout_c("Invalid nodeid specified in nowait-nodes: %ld : %s",
197
g_nowait_nodes.set(val);
203
_initialStart = true;
204
g_start_type |= (1 << NodeState::ST_INITIAL_START);
210
Configuration::Configuration()
216
_initialStart = false;
218
_foregroundMode = false;
219
m_config_retriever= 0;
221
m_clusterConfigIter= 0;
225
Configuration::~Configuration(){
227
free(_connectString);
229
if(_programName != NULL)
235
if(_backupPath != NULL)
238
if (m_config_retriever) {
239
delete m_config_retriever;
248
Configuration::closeConfiguration(bool end_session){
249
m_config_retriever->end_session(end_session);
250
if (m_config_retriever) {
251
delete m_config_retriever;
253
m_config_retriever= 0;
257
Configuration::fetch_configuration(){
259
* Fetch configuration from management server
261
if (m_config_retriever) {
262
delete m_config_retriever;
266
m_config_retriever= new ConfigRetriever(getConnectString(),
271
if (m_config_retriever->hasError())
273
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
274
"Could not connect initialize handle to management server",
275
m_config_retriever->getErrorString());
278
if(m_config_retriever->do_connect(12,5,1) == -1){
279
const char * s = m_config_retriever->getErrorString();
281
s = "No error given!";
282
/* Set stop on error to true otherwise NDB will
283
go into an restart loop...
285
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Could not connect to ndb_mgmd", s);
288
m_mgmd_port= m_config_retriever->get_mgmd_port();
289
m_mgmd_host.assign(m_config_retriever->get_mgmd_host());
291
ConfigRetriever &cr= *m_config_retriever;
294
* if we have a nodeid set (e.g in a restart situation)
297
if (globalData.ownId)
298
cr.setNodeId(globalData.ownId);
300
globalData.ownId = cr.allocNodeId(globalData.ownId ? 10 : 2 /*retry*/,
303
if(globalData.ownId == 0){
304
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
305
"Unable to alloc node id", m_config_retriever->getErrorString());
308
ndb_mgm_configuration * p = cr.getConfig();
310
const char * s = cr.getErrorString();
312
s = "No error given!";
314
/* Set stop on error to true otherwise NDB will
315
go into an restart loop...
318
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Could not fetch configuration"
319
"/invalid configuration", s);
322
free(m_clusterConfig);
326
ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE);
327
if (iter.find(CFG_NODE_ID, globalData.ownId)){
328
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", "DB missing");
331
if(iter.get(CFG_DB_STOP_ON_ERROR, &_stopOnError)){
332
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
333
"StopOnError missing");
337
for(ndb_mgm_first(&iter); ndb_mgm_valid(&iter); ndb_mgm_next(&iter))
339
Uint32 nodeType, port;
340
char const *hostname;
342
ndb_mgm_get_int_parameter(&iter,CFG_TYPE_OF_SECTION,&nodeType);
344
if (nodeType != NodeInfo::MGM)
347
if (ndb_mgm_get_string_parameter(&iter,CFG_NODE_HOST, &hostname) ||
348
ndb_mgm_get_int_parameter(&iter,CFG_MGM_PORT, &port) ||
349
hostname == 0 || hostname[0] == 0)
353
BaseString connectstring(hostname);
354
connectstring.appfmt(":%d", port);
356
m_mgmds.push_back(connectstring);
360
static char * get_and_validate_path(ndb_mgm_configuration_iterator &iter,
361
Uint32 param, const char *param_string)
363
const char* path = NULL;
364
if(iter.get(param, &path)){
365
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched missing ",
369
if(path == 0 || strlen(path) == 0){
370
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
371
"Invalid configuration fetched. Configuration does not contain valid ",
375
// check that it is pointing on a valid directory
378
memset(buf2, 0,sizeof(buf2));
381
if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) ||
382
(GetFileAttributes(buf2) & FILE_ATTRIBUTE_READONLY))
384
if((::realpath(path, buf2) == NULL)||
385
(::access(buf2, W_OK) != 0))
388
ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH, path, param_string);
391
if (strcmp(&buf2[strlen(buf2) - 1], DIR_SEPARATOR))
392
strcat(buf2, DIR_SEPARATOR);
398
Configuration::setupConfiguration(){
400
DBUG_ENTER("Configuration::setupConfiguration");
402
ndb_mgm_configuration * p = m_clusterConfig;
405
* Configure transporters
408
int res = IPCConfig::configureTransporters(globalData.ownId,
410
globalTransporterRegistry);
412
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
413
"No transporters configured");
418
* Setup cluster configuration data
420
ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE);
421
if (iter.find(CFG_NODE_ID, globalData.ownId)){
422
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", "DB missing");
426
if(!(iter.get(CFG_TYPE_OF_SECTION, &type) == 0 && type == NODE_TYPE_DB)){
427
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
428
"I'm wrong type of node");
431
if(iter.get(CFG_DB_NO_SAVE_MSGS, &_maxErrorLogs)){
432
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
433
"MaxNoOfSavedMessages missing");
436
if(iter.get(CFG_DB_MEMLOCK, &_lockPagesInMainMemory)){
437
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
438
"LockPagesInMainMemory missing");
441
if(iter.get(CFG_DB_WATCHDOG_INTERVAL, &_timeBetweenWatchDogCheck)){
442
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
443
"TimeBetweenWatchDogCheck missing");
446
if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL, &_timeBetweenWatchDogCheckInitial)){
447
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
448
"TimeBetweenWatchDogCheckInitial missing");
456
_fsPath= get_and_validate_path(iter, CFG_DB_FILESYSTEM_PATH, "FileSystemPath");
459
_backupPath= get_and_validate_path(iter, CFG_DB_BACKUP_DATADIR, "BackupDataDir");
461
if(iter.get(CFG_DB_STOP_ON_ERROR_INSERT, &m_restartOnErrorInsert)){
462
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
463
"RestartOnErrorInsert missing");
467
* Create the watch dog thread
470
if (_timeBetweenWatchDogCheckInitial < _timeBetweenWatchDogCheck)
471
_timeBetweenWatchDogCheckInitial = _timeBetweenWatchDogCheck;
473
Uint32 t = _timeBetweenWatchDogCheckInitial;
474
t = globalEmulatorData.theWatchDog ->setCheckInterval(t);
475
_timeBetweenWatchDogCheckInitial = t;
478
ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config);
480
if(m_clusterConfigIter)
481
ndb_mgm_destroy_iterator(m_clusterConfigIter);
482
m_clusterConfigIter = ndb_mgm_create_configuration_iterator
483
(p, CFG_SECTION_NODE);
491
Configuration::lockPagesInMainMemory() const {
492
return _lockPagesInMainMemory;
496
Configuration::timeBetweenWatchDogCheck() const {
497
return _timeBetweenWatchDogCheck;
501
Configuration::timeBetweenWatchDogCheck(int value) {
502
_timeBetweenWatchDogCheck = value;
506
Configuration::maxNoOfErrorLogs() const {
507
return _maxErrorLogs;
511
Configuration::maxNoOfErrorLogs(int val){
516
Configuration::stopOnError() const {
521
Configuration::stopOnError(bool val){
526
Configuration::getRestartOnErrorInsert() const {
527
return m_restartOnErrorInsert;
531
Configuration::setRestartOnErrorInsert(int i){
532
m_restartOnErrorInsert = i;
536
Configuration::getConnectString() const {
537
return _connectString;
541
Configuration::getConnectStringCopy() const {
542
if(_connectString != 0)
543
return strdup(_connectString);
547
const ndb_mgm_configuration_iterator *
548
Configuration::getOwnConfigIterator() const {
549
return m_ownConfigIterator;
552
ndb_mgm_configuration_iterator *
553
Configuration::getClusterConfigIterator() const {
554
return m_clusterConfigIter;
558
Configuration::calcSizeAlt(ConfigValues * ownConfig){
559
const char * msg = "Invalid configuration fetched";
562
unsigned int noOfTables = 0;
563
unsigned int noOfUniqueHashIndexes = 0;
564
unsigned int noOfOrderedIndexes = 0;
565
unsigned int noOfTriggers = 0;
566
unsigned int noOfReplicas = 0;
567
unsigned int noOfDBNodes = 0;
568
unsigned int noOfAPINodes = 0;
569
unsigned int noOfMGMNodes = 0;
570
unsigned int noOfNodes = 0;
571
unsigned int noOfAttributes = 0;
572
unsigned int noOfOperations = 0;
573
unsigned int noOfLocalOperations = 0;
574
unsigned int noOfTransactions = 0;
575
unsigned int noOfIndexPages = 0;
576
unsigned int noOfDataPages = 0;
577
unsigned int noOfScanRecords = 0;
578
unsigned int noOfLocalScanRecords = 0;
579
unsigned int noBatchSize = 0;
580
m_logLevel = new LogLevel();
582
struct AttribStorage { int paramId; Uint32 * storage; bool computable; };
583
AttribStorage tmp[] = {
584
{ CFG_DB_NO_SCANS, &noOfScanRecords, false },
585
{ CFG_DB_NO_LOCAL_SCANS, &noOfLocalScanRecords, true },
586
{ CFG_DB_BATCH_SIZE, &noBatchSize, false },
587
{ CFG_DB_NO_TABLES, &noOfTables, false },
588
{ CFG_DB_NO_ORDERED_INDEXES, &noOfOrderedIndexes, false },
589
{ CFG_DB_NO_UNIQUE_HASH_INDEXES, &noOfUniqueHashIndexes, false },
590
{ CFG_DB_NO_TRIGGERS, &noOfTriggers, true },
591
{ CFG_DB_NO_REPLICAS, &noOfReplicas, false },
592
{ CFG_DB_NO_ATTRIBUTES, &noOfAttributes, false },
593
{ CFG_DB_NO_OPS, &noOfOperations, false },
594
{ CFG_DB_NO_LOCAL_OPS, &noOfLocalOperations, true },
595
{ CFG_DB_NO_TRANSACTIONS, &noOfTransactions, false }
598
ndb_mgm_configuration_iterator db(*(ndb_mgm_configuration*)ownConfig, 0);
600
const int sz = sizeof(tmp)/sizeof(AttribStorage);
601
for(int i = 0; i<sz; i++){
602
if(ndb_mgm_get_int_parameter(&db, tmp[i].paramId, tmp[i].storage)){
603
if (tmp[i].computable) {
606
BaseString::snprintf(buf, sizeof(buf),"ConfigParam: %d not found", tmp[i].paramId);
607
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
612
Uint64 indexMem = 0, dataMem = 0;
613
ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem);
614
ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem);
616
BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_DATA_MEM);
617
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
621
BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_INDEX_MEM);
622
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
625
noOfDataPages = (dataMem / 32768);
626
noOfIndexPages = (indexMem / 8192);
628
for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
630
if(!ndb_mgm_get_int_parameter(&db, CFG_MIN_LOGLEVEL+j, &tmp)){
631
m_logLevel->setLogLevel((LogLevel::EventCategory)j, tmp);
636
ndb_mgm_configuration_iterator * p = m_clusterConfigIter;
638
Uint32 nodeNo = noOfNodes = 0;
640
for(ndb_mgm_first(p); ndb_mgm_valid(p); ndb_mgm_next(p), nodeNo++){
645
if(ndb_mgm_get_int_parameter(p, CFG_NODE_ID, &nodeId)){
646
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Id) missing");
649
if(ndb_mgm_get_int_parameter(p, CFG_TYPE_OF_SECTION, &nodeType)){
650
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, "Node data (Type) missing");
653
if(nodeId > MAX_NODES || nodeId == 0){
654
BaseString::snprintf(buf, sizeof(buf),
655
"Invalid node id: %d", nodeId);
656
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
659
if(nodes.get(nodeId)){
660
BaseString::snprintf(buf, sizeof(buf), "Two node can not have the same node id: %d",
662
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
668
noOfDBNodes++; // No of NDB processes
670
if(nodeId > MAX_NDB_NODES){
671
BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d",
673
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
677
noOfAPINodes++; // No of API processes
680
noOfMGMNodes++; // No of MGM processes
683
BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
684
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
689
noOfTables+= 2; // Add System tables
690
noOfAttributes += 9; // Add System table attributes
692
ConfigValues::Iterator it2(*ownConfig, db.m_config);
693
it2.set(CFG_DB_NO_TABLES, noOfTables);
694
it2.set(CFG_DB_NO_ATTRIBUTES, noOfAttributes);
696
Uint32 neededNoOfTriggers = /* types: Insert/Update/Delete/Custom */
697
3 * noOfUniqueHashIndexes + /* for unique hash indexes, I/U/D */
698
3 * NDB_MAX_ACTIVE_EVENTS + /* for events in suma, I/U/D */
699
3 * noOfTables + /* for backup, I/U/D */
700
noOfOrderedIndexes; /* for ordered indexes, C */
701
if (noOfTriggers < neededNoOfTriggers)
703
noOfTriggers= neededNoOfTriggers;
704
it2.set(CFG_DB_NO_TRIGGERS, noOfTriggers);
709
* Do size calculations
711
ConfigValuesFactory cfg(ownConfig);
713
Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes +
714
noOfUniqueHashIndexes;
715
Uint32 noOfMetaTablesDict= noOfMetaTables;
716
if (noOfMetaTablesDict > MAX_TABLES)
717
noOfMetaTablesDict= MAX_TABLES;
721
* Dict Size Alt values
723
cfg.put(CFG_DICT_ATTRIBUTE,
726
cfg.put(CFG_DICT_TABLE,
731
if (noOfLocalScanRecords == 0) {
732
noOfLocalScanRecords = (noOfDBNodes * noOfScanRecords) + 1;
734
if (noOfLocalOperations == 0) {
735
noOfLocalOperations= (11 * noOfOperations) / 10;
737
Uint32 noOfTCScanRecords = noOfScanRecords;
740
Uint32 noOfAccTables= noOfMetaTables/*noOfTables+noOfUniqueHashIndexes*/;
742
* Acc Size Alt values
744
// Can keep 65536 pages (= 0.5 GByte)
745
cfg.put(CFG_ACC_DIR_RANGE,
746
2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
748
cfg.put(CFG_ACC_DIR_ARRAY,
749
(noOfIndexPages >> 8) +
750
2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
752
cfg.put(CFG_ACC_FRAGMENT,
753
NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
755
/*-----------------------------------------------------------------------*/
756
// The extra operation records added are used by the scan and node
758
// Node recovery process will have its operations dedicated to ensure
759
// that they never have a problem with allocation of the operation record.
760
// The remainder are allowed for use by the scan processes.
761
/*-----------------------------------------------------------------------*/
762
cfg.put(CFG_ACC_OP_RECS,
763
(noOfLocalOperations + 50) +
764
(noOfLocalScanRecords * noBatchSize) +
765
NODE_RECOVERY_SCAN_OP_RECORDS);
767
cfg.put(CFG_ACC_OVERFLOW_RECS,
769
NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
771
cfg.put(CFG_ACC_PAGE8,
772
noOfIndexPages + 32);
774
cfg.put(CFG_ACC_TABLE, noOfAccTables);
776
cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
781
* Dih Size Alt values
783
cfg.put(CFG_DIH_API_CONNECT,
784
2 * noOfTransactions);
786
cfg.put(CFG_DIH_CONNECT,
787
noOfOperations + noOfTransactions + 46);
789
Uint32 noFragPerTable= ((noOfDBNodes + NO_OF_FRAGS_PER_CHUNK - 1) >>
790
LOG_NO_OF_FRAGS_PER_CHUNK) <<
791
LOG_NO_OF_FRAGS_PER_CHUNK;
793
cfg.put(CFG_DIH_FRAG_CONNECT,
794
noFragPerTable * noOfMetaTables);
797
temp = noOfReplicas - 2;
802
cfg.put(CFG_DIH_MORE_NODES,
803
temp * NO_OF_FRAG_PER_NODE *
804
noOfMetaTables * noOfDBNodes);
806
cfg.put(CFG_DIH_REPLICAS,
807
NO_OF_FRAG_PER_NODE * noOfMetaTables *
808
noOfDBNodes * noOfReplicas);
810
cfg.put(CFG_DIH_TABLE,
816
* Lqh Size Alt values
818
cfg.put(CFG_LQH_FRAG,
819
NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas);
821
cfg.put(CFG_LQH_TABLE,
824
cfg.put(CFG_LQH_TC_CONNECT,
825
noOfLocalOperations + 50);
827
cfg.put(CFG_LQH_SCAN,
828
noOfLocalScanRecords);
835
cfg.put(CFG_TC_API_CONNECT,
836
3 * noOfTransactions);
838
cfg.put(CFG_TC_TC_CONNECT,
839
(2 * noOfOperations) + 16 + noOfTransactions);
841
cfg.put(CFG_TC_TABLE,
844
cfg.put(CFG_TC_LOCAL_SCAN,
845
noOfLocalScanRecords);
853
* Tup Size Alt values
855
cfg.put(CFG_TUP_FRAG,
856
NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
858
cfg.put(CFG_TUP_OP_RECS,
859
noOfLocalOperations + 50);
861
cfg.put(CFG_TUP_PAGE,
864
cfg.put(CFG_TUP_PAGE_RANGE,
865
2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
867
cfg.put(CFG_TUP_TABLE,
870
cfg.put(CFG_TUP_TABLE_DESC,
871
6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
872
10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
874
cfg.put(CFG_TUP_STORED_PROC,
875
noOfLocalScanRecords);
880
* Tux Size Alt values
882
cfg.put(CFG_TUX_INDEX,
883
noOfMetaTables /*noOfOrderedIndexes*/);
885
cfg.put(CFG_TUX_FRAGMENT,
886
NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
888
cfg.put(CFG_TUX_ATTRIBUTE,
889
noOfOrderedIndexes * 4);
891
cfg.put(CFG_TUX_SCAN_OP, noOfLocalScanRecords);
894
m_ownConfig = (ndb_mgm_configuration*)cfg.getConfigValues();
895
m_ownConfigIterator = ndb_mgm_create_configuration_iterator
900
Configuration::setInitialStart(bool val){