List:Commits« Previous MessageNext Message »
From:jonas Date:March 20 2007 3:32pm
Subject:bk commit into 5.1 tree (jonas:1.2442)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-20 16:32:11+01:00, jonas@stripped +5 -0
  Merge perch.ndb.mysql.com:/home/jonas/src/50-work
  into  perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
  MERGE: 1.1810.2124.54

  storage/ndb/src/kernel/blocks/ERROR_codes.txt@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.9.18.2

  storage/ndb/src/kernel/blocks/ERROR_codes.txt@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Merge rename: ndb/src/kernel/blocks/ERROR_codes.txt -> storage/ndb/src/kernel/blocks/ERROR_codes.txt

  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.24.68.2

  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Merge rename: ndb/src/kernel/blocks/dbdih/DbdihMain.cpp -> storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp

  storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.60.25.2

  storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/ConfigInfo.cpp -> storage/ndb/src/mgmsrv/ConfigInfo.cpp

  storage/ndb/test/ndbapi/testNodeRestart.cpp@stripped, 2007-03-20 16:32:09+01:00, jonas@stripped +46 -45
    merge
    MERGE: 1.13.19.2

  storage/ndb/test/ndbapi/testNodeRestart.cpp@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Merge rename: ndb/test/ndbapi/testNodeRestart.cpp -> storage/ndb/test/ndbapi/testNodeRestart.cpp

  storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.27.31.2

  storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-03-20 16:29:26+01:00, jonas@stripped +0 -0
    Merge rename: ndb/test/run-test/daily-basic-tests.txt -> storage/ndb/test/run-test/daily-basic-tests.txt

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/51-telco-gca/RESYNC

--- 1.27.31.1/ndb/test/run-test/daily-basic-tests.txt	2007-03-20 16:32:16 +01:00
+++ 1.68/storage/ndb/test/run-test/daily-basic-tests.txt	2007-03-20 16:32:16 +01:00
@@ -81,23 +81,23 @@
 
 max-time: 500
 cmd: testBasic
-args: -n PkReadAndLocker T6 
+args: -n PkReadAndLocker T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n PkReadAndLocker2 T6 
+args: -n PkReadAndLocker2 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n PkReadUpdateAndLocker T6 
+args: -n PkReadUpdateAndLocker T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n ReadWithLocksAndInserts T6 
+args: -n ReadWithLocksAndInserts T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n PkInsertTwice T1 T6 T10 
+args: -n PkInsertTwice T1 T6 T10 D1 D2
 
 max-time: 1500
 cmd: testBasic
@@ -109,79 +109,79 @@
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommitSleep T6 
+args: -n NoCommitSleep T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommit626 T6 
+args: -n NoCommit626 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommitAndClose T6 
+args: -n NoCommitAndClose T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n Commit626 T6 
+args: -n Commit626 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n CommitTry626 T6 
+args: -n CommitTry626 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n CommitAsMuch626 T6 
+args: -n CommitAsMuch626 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommit626 T6 
+args: -n NoCommit626 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommitRollback626 T1 T6 
+args: -n NoCommitRollback626 T1 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n Commit630 T1 T6 
+args: -n Commit630 T1 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n CommitTry630 T1 T6 
+args: -n CommitTry630 T1 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n CommitAsMuch630 T1 T6 
+args: -n CommitAsMuch630 T1 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommit630 T1 T6 
+args: -n NoCommit630 T1 T6 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommitRollback630 T1 T6 
+args: -n NoCommitRollback630 T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n NoCommitAndClose T1 T6 
+args: -n NoCommitAndClose T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n RollbackUpdate T1 T6 
+args: -n RollbackUpdate T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n RollbackDeleteMultiple T1 T6 
+args: -n RollbackDeleteMultiple T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n ImplicitRollbackDelete T1 T6 
+args: -n ImplicitRollbackDelete T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n CommitDelete T1 T6 
+args: -n CommitDelete T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasic
-args: -n RollbackNothing T1 T6 
+args: -n RollbackNothing T1 T6 D1 D2 
 
 max-time: 500
 cmd: testBasicAsynch
@@ -199,13 +199,33 @@
 cmd: testBasicAsynch
 args: -n PkDeleteAsynch 
 
+max-time: 1000
+cmd: testBasic
+args: -n MassiveRollback T1 T7 D1 D2
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback2 T1 T7 D1 D2
+
 max-time: 500
 cmd: testBasic
-args: -n MassiveRollback T1 T6 T13 
+args: -n MassiveRollback3 T1 T7 D1 D2
 
 max-time: 500
 cmd: testBasic
-args: -n MassiveRollback2 T1 T6 T13 
+args: -n MassiveRollback4 T1 T7 D1 D2
+
+max-time: 500
+cmd: testBasic
+args: -n TupError
+
+max-time: 500
+cmd: testBasic
+args: -n InsertError T1
+
+max-time: 500
+cmd: testBasic
+args: -n InsertError2 T1
 
 max-time: 500
 cmd: testTimeout
@@ -239,7 +259,7 @@
 
 max-time: 500
 cmd: testScan
-args: -n ScanUpdate2 T6 
+args: -n ScanUpdate2 T6 D1 D2
 
 max-time: 500
 cmd: testScan
@@ -247,47 +267,51 @@
 
 max-time: 500
 cmd: testScan
-args: -n ScanDelete2 T10 
+args: -n ScanDelete2 T10 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanUpdateAndScanRead T6 
+args: -n ScanUpdateAndScanRead T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadAndLocker T6 
+args: -n ScanReadAndLocker T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadAndPkRead T6 
+args: -n ScanReadAndPkRead T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanRead488 -l 10 T6 
+args: -n ScanRead488 -l 10 T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanRead488O -l 10 T6 
+args: -n ScanRead488O -l 10 T6 D1 D2 
 
 max-time: 1000
 cmd: testScan
-args: -n ScanRead488_Mixed -l 10 T6 
+args: -n ScanRead488T -l 10 T6 D1 D2 
+
+max-time: 1000
+cmd: testScan
+args: -n ScanRead488_Mixed -l 10 T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanRead488Timeout -l 10 T6 
+args: -n ScanRead488Timeout -l 10 T6 D1 D2
 
 max-time: 600
 cmd: testScan
-args: -n ScanRead40 -l 100 T2 
+args: -n ScanRead40 -l 100 T2 D1 D2 
 
 max-time: 1800
 cmd: testScan
-args: -n ScanRead100 -l 100 T1 
+args: -n ScanRead100 -l 100 T1 D1 D2 
 
 max-time: 600
 cmd: testScan
-args: -n ScanRead40 -l 100 T1 
+args: -n ScanRead40 -l 100 T1 D1 D2 
 
 max-time: 1800
 cmd: testScan
@@ -299,123 +323,135 @@
 
 max-time: 500
 cmd: testScan
-args: -n ScanWithLocksAndInserts T6 
+args: -n ScanWithLocksAndInserts T6 D1 D2
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadAbort T6 
+args: -n ScanReadAbort T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadAbort15 T6 
+args: -n ScanReadAbort15 T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadAbort240 T6 
+args: -n ScanReadAbort240 T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanUpdateAbort16 T6 
+args: -n ScanUpdateAbort16 T6 D1 D2 
 
 max-time: 3600
 cmd: testScan
-args: -n ScanReadRestart T1 T6 T13 
+args: -n ScanReadRestart T1 T6 T13
 
-max-time: 500
+max-time: 3600
 cmd: testScan
-args: -n ScanUpdateRestart T6 
+args: -n ScanReadRestart D1 D2
 
-max-time: 500
+max-time: 1200
 cmd: testScan
-args: -n CheckGetValue T6 
+args: -n ScanUpdateRestart T6
+
+max-time: 1200
+cmd: testScan
+args: -n ScanUpdateRestart D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n CloseWithoutStop T6 
+args: -n CheckGetValue T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n NextScanWhenNoMore T6 
+args: -n CloseWithoutStop T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ExecuteScanWithoutOpenScan T6 
+args: -n NextScanWhenNoMore T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n OnlyOpenScanOnce T6 
+args: -n ExecuteScanWithoutOpenScan T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n OnlyOneOpInScanTrans T6 
+args: -n OnlyOpenScanOnce T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n OnlyOneOpBeforeOpenScan T6 
+args: -n OnlyOneOpInScanTrans T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n OnlyOneScanPerTrans T6 
+args: -n OnlyOneOpBeforeOpenScan T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n NoCloseTransaction T6 
+args: -n OnlyOneScanPerTrans T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n CheckInactivityTimeOut T6 
+args: -n NoCloseTransaction T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n CheckInactivityBeforeClose T6 
+args: -n CheckInactivityTimeOut T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n CheckAfterTerror T6 
+args: -n CheckInactivityBeforeClose T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadError5021 T1 
+args: -n CheckAfterTerror T6 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReaderror5022 T1 
+args: -n ScanReadError5021 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadError5023 T1 
+args: -n ScanReaderror5022 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadError5024 T1 
+args: -n ScanReadError5023 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadError5025 T1 
+args: -n ScanReadError5024 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n ScanReadError5030 T1 
+args: -n ScanReadError5025 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n InsertDelete T1 T6
+args: -n ScanReadError5030 T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -n CheckAfterTerror T1
+args: -n InsertDelete T1 T6 D1 D2 
 
 max-time: 500
 cmd: testScan
+args: -n CheckAfterTerror T1 D1 D2 
+
+max-time: 1200
+cmd: testScan
 args: -n ScanReadWhileNodeIsDown T1
 
+max-time: 1200
+cmd: testScan
+args: -n ScanReadWhileNodeIsDown D1 D2 
+
 max-time: 500
 cmd: testScan
-args: -n ScanRestart T1
+args: -n ScanRestart T1 D1 D2 
 
 max-time: 500
 cmd: testScan
-args: -l 100 -n Scan-bug8262 T7
+args: -l 100 -n Scan-bug8262 T7 D1 D2
 
 max-time: 500
 cmd: testScan
@@ -434,6 +470,10 @@
 args: -n Bug27283 T1
 
 max-time: 500
+cmd: testScan
+args: -n ScanVariants
+
+max-time: 500
 cmd: testNodeRestart
 args: -n Bug15587 T1
 
@@ -470,6 +510,10 @@
 args: -n Bug20185 T1
 
 max-time: 1000
+cmd: testNodeRestart
+args: -n Bug21271 T6
+
+max-time: 1000
 cmd: testIndex
 args: -n Bug21384
 
@@ -493,15 +537,6 @@
 cmd: testNodeRestart
 args: -n Bug26481 T1
 
-# OLD FLEX
-max-time: 500
-cmd: flexBench
-args: -c 25 -t 10 
-
-max-time: 500
-cmd: flexHammer
-args: -r 5 -t 32 
-
 #
 # DICT TESTS
 max-time: 1500
@@ -518,7 +553,7 @@
 
 max-time: 1500
 cmd: testDict
-args: -n CreateAndDropDuring T6 T10 
+args: -n CreateAndDropDuring T6 T10 D1 D2
 
 max-time: 1500
 cmd: testDict
@@ -550,7 +585,7 @@
 
 max-time: 1500
 cmd: testDict
-args: -n Restart_NR2 T1
+args: -n Restart_NR2 T1 I3
 
 #
 # TEST NDBAPI
@@ -607,23 +642,27 @@
 
 max-time: 500
 cmd: testNdbApi
-args: -n UpdateWithoutKeys T6 
+args: -n UpdateWithoutKeys T6 D1 D2 
 
 max-time: 500
 cmd: testNdbApi
-args: -n UpdateWithoutValues T6 
+args: -n UpdateWithoutValues T6 D1 D2 
 
 max-time: 500
 cmd: testNdbApi
-args: -n ReadWithoutGetValue
+args: -n ReadWithoutGetValue D1 D2 
 
 max-time: 500
 cmd: testNdbApi
-args: -n Bug_11133 T1 
+args: -n Bug_11133 T1 D1 D2 
 
 max-time: 500
 cmd: testNdbApi
-args: -n Scan_4006 T1
+args: -n Scan_4006 T1 D1 D2 
+
+max-time: 500
+cmd: testNdbApi
+args: -n Bug_WritePartialIgnoreError T1 
 
 #max-time: 500
 #cmd: testInterpreter
@@ -641,13 +680,21 @@
 cmd: testRestartGci
 args: T6 
 
-max-time: 600
+max-time: 1500
 cmd: testBlobs
 args:
 
 max-time: 5000
 cmd: testOIBasic
-args: 
+args: -case abcdefz
+
+max-time: 2000
+cmd: testOIBasic
+args: -case gz
+
+max-time: 2000
+cmd: testOIBasic
+args: -case hz
 
 max-time: 2500
 cmd: testBitfield
@@ -679,6 +726,14 @@
 
 max-time: 1500
 cmd: testSystemRestart
+args: -n SR1 D1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 D2 
+
+max-time: 1500
+cmd: testSystemRestart
 args: -n SR2 T1 
 
 max-time: 1500
@@ -691,6 +746,14 @@
 
 max-time: 1500
 cmd: testSystemRestart
+args: -n SR2 D1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 D2 
+
+max-time: 1500
+cmd: testSystemRestart
 args: -n SR_UNDO T1 
 
 max-time: 1500
@@ -704,6 +767,34 @@
 max-time: 1500
 cmd: testSystemRestart
 args: -n SR_UNDO T8 
+
+max-time: 1000
+cmd: testSRBank
+args: -n SR -l 300 -r 15 T1
+
+max-time: 1000
+cmd: testSRBank
+args: -n NR -l 300 -r 15 T1
+
+max-time: 1000
+cmd: testSRBank
+args: -n Mix -l 300 -r 15 T1
+
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug24543 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n Bug24664
+
+max-time: 1000
+cmd: testNodeRestart
+args: -n Bug25468 T1
+
+max-time: 1000
+cmd: test_event
+args: -l 10 -n Bug27169 T1
 
 # OLD FLEX
 max-time: 500

--- 1.60.25.1/ndb/src/mgmsrv/ConfigInfo.cpp	2007-03-20 16:32:16 +01:00
+++ 1.97/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2007-03-20 16:32:16 +01:00
@@ -2,8 +2,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; version 2 of the License.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -66,8 +65,7 @@
 
   "TCP",
   "SCI",
-  "SHM",
-  "OSE"
+  "SHM"
 };
 const int ConfigInfo::m_noOfSectionNames = 
 sizeof(m_sectionNames)/sizeof(char*);
@@ -112,12 +110,10 @@
   { "TCP",  checkConnectionSupport, 0 },
   { "SHM",  checkConnectionSupport, 0 },
   { "SCI",  checkConnectionSupport, 0 },
-  { "OSE",  checkConnectionSupport, 0 },
 
   { "TCP",  transformConnection, 0 },
   { "SHM",  transformConnection, 0 },
   { "SCI",  transformConnection, 0 },
-  { "OSE",  transformConnection, 0 },
 
   { DB_TOKEN,   fixNodeHostname, 0 },
   { API_TOKEN,  fixNodeHostname, 0 },
@@ -129,9 +125,7 @@
   { "SHM",  fixNodeId, "NodeId2" },
   { "SCI",  fixNodeId, "NodeId1" },
   { "SCI",  fixNodeId, "NodeId2" },
-  { "OSE",  fixNodeId, "NodeId1" },
-  { "OSE",  fixNodeId, "NodeId2" },
-  
+
   { "TCP",  fixHostname, "HostName1" },
   { "TCP",  fixHostname, "HostName2" },
   { "SHM",  fixHostname, "HostName1" },
@@ -140,8 +134,6 @@
   { "SCI",  fixHostname, "HostName2" },
   { "SHM",  fixHostname, "HostName1" },
   { "SHM",  fixHostname, "HostName2" },
-  { "OSE",  fixHostname, "HostName1" },
-  { "OSE",  fixHostname, "HostName2" },
 
   { "TCP",  fixPortNumber, 0 }, // has to come after fixHostName
   { "SHM",  fixPortNumber, 0 }, // has to come after fixHostName
@@ -165,7 +157,6 @@
   { "TCP",  checkConnectionConstraints, 0 },
   { "SHM",  checkConnectionConstraints, 0 },
   { "SCI",  checkConnectionConstraints, 0 },
-  { "OSE",  checkConnectionConstraints, 0 },
 
   { "TCP",  checkTCPConstraints, "HostName1" },
   { "TCP",  checkTCPConstraints, "HostName2" },
@@ -182,8 +173,7 @@
 
   { "TCP",  saveInConfigValues, 0 },
   { "SHM",  saveInConfigValues, 0 },
-  { "SCI",  saveInConfigValues, 0 },
-  { "OSE",  saveInConfigValues, 0 }
+  { "SCI",  saveInConfigValues, 0 }
 };
 const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
 
@@ -762,6 +752,30 @@
     STR_VALUE(MAX_INT_RNIL)},
 
   {
+    CFG_DB_DISK_PAGE_BUFFER_MEMORY,
+    "DiskPageBufferMemory",
+    DB_TOKEN,
+    "Number bytes on each "DB_TOKEN_PRINT" node allocated for disk page buffer cache",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT64,
+    "64M",
+    "4M",
+    "1024G" },
+
+  {
+    CFG_DB_SGA,
+    "SharedGlobalMemory",
+    DB_TOKEN,
+    "Total number bytes on each "DB_TOKEN_PRINT" node allocated for any use",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT64,
+    "20M",
+    "0",
+    "65536G" }, // 32k pages * 32-bit i value
+  
+  {
     CFG_DB_START_PARTIAL_TIMEOUT,
     "StartPartialTimeout",
     DB_TOKEN,
@@ -853,7 +867,7 @@
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "8",
+    "16",
     "3",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -870,6 +884,18 @@
     STR_VALUE(MAX_INT_RNIL) },
   
   {
+    CFG_DB_INITIAL_OPEN_FILES,
+    "InitialNoOfOpenFiles",
+    DB_TOKEN,
+    "Initial number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "27",
+    "20",
+    STR_VALUE(MAX_INT_RNIL) },
+  
+  {
     CFG_DB_TRANSACTION_CHECK_INTERVAL,
     "TimeBetweenInactiveTransactionAbortCheck",
     DB_TOKEN,
@@ -916,8 +942,8 @@
     CFG_DB_LCP_DISC_PAGES_TUP_SR,
     "NoOfDiskPagesToDiskDuringRestartTUP",
     DB_TOKEN,
-    "?",
-    ConfigInfo::CI_USED,
+    "DiskCheckpointSpeedSr",
+    ConfigInfo::CI_DEPRICATED,
     true,
     ConfigInfo::CI_INT,
     "40",
@@ -928,8 +954,8 @@
     CFG_DB_LCP_DISC_PAGES_TUP,
     "NoOfDiskPagesToDiskAfterRestartTUP",
     DB_TOKEN,
-    "?",
-    ConfigInfo::CI_USED,
+    "DiskCheckpointSpeed",
+    ConfigInfo::CI_DEPRICATED,
     true,
     ConfigInfo::CI_INT,
     "40",
@@ -940,8 +966,8 @@
     CFG_DB_LCP_DISC_PAGES_ACC_SR,
     "NoOfDiskPagesToDiskDuringRestartACC",
     DB_TOKEN,
-    "?",
-    ConfigInfo::CI_USED,
+    "DiskCheckpointSpeedSr",
+    ConfigInfo::CI_DEPRICATED,
     true,
     ConfigInfo::CI_INT,
     "20",
@@ -952,8 +978,8 @@
     CFG_DB_LCP_DISC_PAGES_ACC,
     "NoOfDiskPagesToDiskAfterRestartACC",
     DB_TOKEN,
-    "?",
-    ConfigInfo::CI_USED,
+    "DiskCheckpointSpeed",
+    ConfigInfo::CI_DEPRICATED,
     true,
     ConfigInfo::CI_INT,
     "20",
@@ -1156,6 +1182,42 @@
     0, 0 },
   
   { 
+    CFG_DB_DISK_SYNCH_SIZE,
+    "DiskSyncSize",
+    DB_TOKEN,
+    "Data written to a file before a synch is forced",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "4M",
+    "32k",
+    STR_VALUE(MAX_INT_RNIL) },
+  
+  { 
+    CFG_DB_CHECKPOINT_SPEED,
+    "DiskCheckpointSpeed",
+    DB_TOKEN,
+    "Bytes per second allowed to be written by checkpoint",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "10M",
+    "1M",
+    STR_VALUE(MAX_INT_RNIL) },
+  
+  { 
+    CFG_DB_CHECKPOINT_SPEED_SR,
+    "DiskCheckpointSpeedInRestart",
+    DB_TOKEN,
+    "Bytes per second allowed to be written by checkpoint during restart",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "100M",
+    "1M",
+    STR_VALUE(MAX_INT_RNIL) },
+  
+  { 
     CFG_DB_BACKUP_MEM,
     "BackupMemory",
     DB_TOKEN,
@@ -1215,6 +1277,30 @@
     "2K",
     STR_VALUE(MAX_INT_RNIL) },
 
+  { 
+    CFG_DB_STRING_MEMORY,
+    "StringMemory",
+    DB_TOKEN,
+    "Default size of string memory (0 -> 5% of max 1-100 -> %of max, >100 -> actual bytes)",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    STR_VALUE(MAX_INT_RNIL) },
+
+  { 
+    CFG_DB_MEMREPORT_FREQUENCY,
+    "MemReportFrequency",
+    DB_TOKEN,
+    "Frequency of mem reports in seconds, 0 = only when passing %-limits",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    STR_VALUE(MAX_INT_RNIL) },
+  
   /***************************************************************************
    * API
    ***************************************************************************/
@@ -2063,150 +2149,7 @@
     false,
     ConfigInfo::CI_STRING,
     UNDEFINED,
-    0, 0 },
-
-  /****************************************************************************
-   * OSE
-   ***************************************************************************/
-  {
-    CFG_SECTION_CONNECTION,
-    "OSE",
-    "OSE",
-    "Connection section",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_SECTION,
-    (const char *)CONNECTION_TYPE_OSE, 
-    0, 0 
-  },
-
-  {
-    CFG_CONNECTION_HOSTNAME_1,
-    "HostName1",
-    "OSE",
-    "Name of computer on one side of the connection",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_STRING,
-    UNDEFINED,
-    0, 0 },
-
-  {
-    CFG_CONNECTION_HOSTNAME_2,
-    "HostName2",
-    "OSE",
-    "Name of computer on one side of the connection",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_STRING,
-    UNDEFINED,
-    0, 0 },
-
-  {
-    CFG_CONNECTION_NODE_1,
-    "NodeId1",
-    "OSE",
-    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_INT,
-    MANDATORY,
-    "0",
-    STR_VALUE(MAX_INT_RNIL) },
-
-  {
-    CFG_CONNECTION_NODE_2,
-    "NodeId2",
-    "OSE",
-    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_INT,
-    UNDEFINED,
-    "0",
-    STR_VALUE(MAX_INT_RNIL) },
-
-  {
-    CFG_CONNECTION_SEND_SIGNAL_ID,
-    "SendSignalId",
-    "OSE",
-    "Sends id in each signal.  Used in trace files.",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_BOOL,
-    "true",
-    "false",
-    "true" },
-
-  {
-    CFG_CONNECTION_CHECKSUM,
-    "Checksum",
-    "OSE",
-    "If checksum is enabled, all signals between nodes are checked for errors",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_BOOL,
-    "false",
-    "false",
-    "true" },
-
-  {
-    CFG_OSE_PRIO_A_SIZE,
-    "PrioASignalSize",
-    "OSE",
-    "Size of priority A signals (in bytes)",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_INT,
-    "1000",
-    "0",
-    STR_VALUE(MAX_INT_RNIL) },
-
-  {
-    CFG_OSE_PRIO_B_SIZE,
-    "PrioBSignalSize",
-    "OSE",
-    "Size of priority B signals (in bytes)",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_INT,
-    "1000",
-    "0",
-    STR_VALUE(MAX_INT_RNIL) },
-  
-  {
-    CFG_OSE_RECEIVE_ARRAY_SIZE,
-    "ReceiveArraySize",
-    "OSE",
-    "Number of OSE signals checked for correct ordering (in no of OSE signals)",
-    ConfigInfo::CI_USED,
-    false,
-    ConfigInfo::CI_INT,
-    "10",
-    "0",
-    STR_VALUE(MAX_INT_RNIL) },
-
-  {
-    CFG_CONNECTION_NODE_1_SYSTEM,
-    "NodeId1_System",
-    "OSE",
-    "System for node 1 in connection",
-    ConfigInfo::CI_INTERNAL,
-    false,
-    ConfigInfo::CI_STRING,
-    UNDEFINED,
-    0, 0 },
-
-  {
-    CFG_CONNECTION_NODE_2_SYSTEM,
-    "NodeId2_System",
-    "OSE",
-    "System for node 2 in connection",
-    ConfigInfo::CI_INTERNAL,
-    false,
-    ConfigInfo::CI_STRING,
-    UNDEFINED,
-    0, 0 },
+    0, 0 }
 };
 
 const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
@@ -2604,6 +2547,13 @@
     return false;
   }
 
+  if(id >= MAX_NODES)
+  {
+    ctx.reportError("too many nodes configured, only up to %d nodes supported.",
+            MAX_NODES);
+    return false;
+  } 
+
   // next node id _always_ next numbers after last used id
   ctx.m_userProperties.put("NextNodeId", id+1, true);
 
@@ -2744,12 +2694,7 @@
     error= 1;
 #endif
   }
-  else if (strcasecmp("OSE",ctx.fname) == 0)
-  {
-#ifndef NDB_OSE_TRANSPORTER
-    error= 1;
-#endif
-  }
+
   if (error)
   {
     ctx.reportError("Binary not compiled with this connection support, "
@@ -3216,7 +3161,31 @@
   } else {
     ctx.m_userProperties.put("NoOfReplicas", replicas);
   }
-  
+
+  /**
+   * In kernel, will calculate the MaxNoOfMeataTables use the following sum:
+   * Uint32 noOfMetaTables = noOfTables + noOfOrderedIndexes + 
+   *                         noOfUniqueHashIndexes + 2
+   * 2 is the number of the SysTables.
+   * So must check that the sum does't exceed the max value of Uint32.
+   */
+  Uint32 noOfTables = 0,
+         noOfOrderedIndexes = 0,
+         noOfUniqueHashIndexes = 0;
+  ctx.m_currentSection->get("MaxNoOfTables", &noOfTables);
+  ctx.m_currentSection->get("MaxNoOfOrderedIndexes", &noOfOrderedIndexes);
+  ctx.m_currentSection->get("MaxNoOfUniqueHashIndexes", &noOfUniqueHashIndexes);
+
+  Uint64 sum= (Uint64)noOfTables + noOfOrderedIndexes + noOfUniqueHashIndexes;
+  
+  if (sum > ((Uint32)~0 - 2)) {
+    ctx.reportError("The sum of MaxNoOfTables, MaxNoOfOrderedIndexes and"
+		    " MaxNoOfUniqueHashIndexes must not exceed %u - [%s]"
+                    " starting at line: %d",
+		    ((Uint32)~0 - 2), ctx.fname, ctx.m_sectionLineno);
+    return false;
+  } 
+
   return true;
 }
 
@@ -3495,11 +3464,11 @@
   Uint32 mgm_nodes = 0;
   Uint32 api_nodes = 0;
   if (!ctx.m_userProperties.get("DB", &db_nodes)) {
-    ctx.reportError("At least one database node should be defined in config file");
+    ctx.reportError("At least one database node (ndbd) should be defined in config file");
     return false;
   }
   if (!ctx.m_userProperties.get("MGM", &mgm_nodes)) {
-    ctx.reportError("At least one management server node should be defined in config file");
+    ctx.reportError("At least one management server node (ndb_mgmd) should be defined in config file");
     return false;
   }
   if (!ctx.m_userProperties.get("API", &api_nodes)) {

--- 1.9.18.1/ndb/src/kernel/blocks/ERROR_codes.txt	2007-03-20 16:32:16 +01:00
+++ 1.35/storage/ndb/src/kernel/blocks/ERROR_codes.txt	2007-03-20 16:32:16 +01:00
@@ -1,14 +1,14 @@
 Next QMGR 1
-Next NDBCNTR 1000
+Next NDBCNTR 1001
 Next NDBFS 2000
 Next DBACC 3002
-Next DBTUP 4014
-Next DBLQH 5043
+Next DBTUP 4029
+Next DBLQH 5045
 Next DBDICT 6007
 Next DBDIH 7183
 Next DBTC 8039
 Next CMVMI 9000
-Next BACKUP 10022
+Next BACKUP 10038
 Next DBUTIL 11002
 Next DBTUX 12008
 Next SUMA 13001
@@ -21,6 +21,8 @@
 
 910: Crash new president after node crash
 
+934 : Crash president in ALLOC_NODE_ID_REQ
+
 935 : Crash master on node failure (delayed) 
       and skip sending GSN_COMMIT_FAILREQ to specified node
 
@@ -421,6 +423,14 @@
 10028: Abort backup by error at reception of BACKUP_FRAGMENT_CONF at master (code 305)
 10029: Abort backup by error at reception of FSAPPENDCONF in slave (FileOrScanError = 5)
 10030: Simulate buffer full from trigger execution => abort backup
+10031: Error 331 for dictCommitTableMutex_locked
+10032: backup checkscan
+10033: backup checkscan
+10034: define backup reply error
+10035: Fail to allocate buffers
+
+10036: Halt backup for table >= 2
+10037: Resume backup (from 10036)
 
 11001: Send UTIL_SEQUENCE_REF (in master)
 
@@ -490,8 +500,18 @@
 6004 Crash in participant @ CreateTabReq::Commit
 6005 Crash in participant @ CreateTabReq::CreateDrop
 
-TUP:
-----
+Dbtup:
+4014 - handleInsert - Out of undo buffer
+4015 - handleInsert - Out of log space
+4016 - handleInsert - AI Inconsistency
+4017 - handleInsert - Out of memory
+4018 - handleInsert - Null check error
+4019 - handleInsert - Alloc rowid error
+4020 - handleInsert - Size change error
+4021 - handleInsert - Out of disk space
+
+4022 - addTuxEntries - fail before add of first entry
+4023 - addTuxEntries - fail add of last entry (the entry for last index)
 
 4025: Fail all inserts with out of memory
 4026: Fail one insert with oom

--- 1.24.68.1/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-03-20 16:32:16 +01:00
+++ 1.105/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-03-20 16:32:16 +01:00
@@ -2,8 +2,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; version 2 of the License.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -67,6 +66,7 @@
 #include <signaldata/CreateFragmentation.hpp>
 #include <signaldata/LqhFrag.hpp>
 #include <signaldata/FsOpenReq.hpp>
+#include <signaldata/DihFragCount.hpp>
 #include <signaldata/DictLock.hpp>
 #include <DebuggerNames.hpp>
 
@@ -610,6 +610,14 @@
     checkWaitDropTabFailedLqh(signal, nodeId, tableId);
     return;
   }
+  case DihContinueB::ZTO_START_FRAGMENTS:
+  {
+    TakeOverRecordPtr takeOverPtr;
+    takeOverPtr.i = signal->theData[1];
+    ptrCheckGuard(takeOverPtr, MAX_NDB_NODES, takeOverRecord);
+    nr_start_fragments(signal, takeOverPtr);
+    return;
+  }
   }//switch
   
   ndbrequire(false);
@@ -666,7 +674,9 @@
   if (cmasterdihref != reference())
   {
     jam();
+    Uint32 tmp= SYSFILE->m_restart_seq;
     memcpy(sysfileData, cdata, sizeof(sysfileData));
+    SYSFILE->m_restart_seq = tmp;
 
     if (c_set_initial_start_flag)
     {
@@ -1085,7 +1095,7 @@
   jamEntry();
 
   const ndb_mgm_configuration_iterator * p = 
-    theConfiguration.getOwnConfigIterator();
+    m_ctx.m_config.getOwnConfigIterator();
   ndbrequireErr(p != 0, NDBD_EXIT_INVALID_CONFIG);
 
   initData();
@@ -1128,6 +1138,26 @@
   return;
 }//Dbdih::execSTART_FRAGCONF()
 
+void Dbdih::execSTART_FRAGREF(Signal* signal) 
+{
+  jamEntry();
+ 
+  /**
+   * Kill starting node
+   */
+  Uint32 errCode = signal->theData[1];
+  Uint32 nodeId = signal->theData[2];
+  
+  SystemError * const sysErr = (SystemError*)&signal->theData[0];
+  sysErr->errorCode = SystemError::StartFragRefError;
+  sysErr->errorRef = reference();
+  sysErr->data1 = errCode;
+  sysErr->data2 = 0;
+  sendSignal(calcNdbCntrBlockRef(nodeId), GSN_SYSTEM_ERROR, signal, 
+	     SystemError::SignalLength, JBB);
+  return;
+}//Dbdih::execSTART_FRAGCONF()
+
 void Dbdih::execSTART_MEREF(Signal* signal) 
 {
   jamEntry();
@@ -1171,7 +1201,7 @@
 {
   jamEntry();
   cntrlblockref = signal->theData[0];
-  if(theConfiguration.getInitialStart()){
+  if(m_ctx.m_config.getInitialStart()){
     sendSignal(cntrlblockref, GSN_DIH_RESTARTREF, signal, 1, JBB);
   } else {
     readGciFileLab(signal);
@@ -1745,12 +1775,15 @@
    *
    * But dont copy lastCompletedGCI:s
    */
+  Uint32 key = SYSFILE->m_restart_seq;
   Uint32 tempGCP[MAX_NDB_NODES];
   for(i = 0; i < MAX_NDB_NODES; i++)
     tempGCP[i] = SYSFILE->lastCompletedGCI[i];
 
   for(i = 0; i < Sysfile::SYSFILE_SIZE32; i++)
     sysfileData[i] = cdata[i];
+
+  SYSFILE->m_restart_seq = key;
   for(i = 0; i < MAX_NDB_NODES; i++)
     SYSFILE->lastCompletedGCI[i] = tempGCP[i];
 
@@ -1798,8 +1831,8 @@
     return;
   }//if
   if (getNodeStatus(nodeId) != NodeRecord::DEAD){
-    ndbout << "nodeStatus in START_PERMREQ = " 
-	   << (Uint32) getNodeStatus(nodeId) << endl;
+    g_eventLogger.error("nodeStatus in START_PERMREQ = %u",
+                        (Uint32) getNodeStatus(nodeId));
     ndbrequire(false);
   }//if
 
@@ -1908,11 +1941,6 @@
   ndbrequire(c_nodeStartMaster.startNode == Tnodeid);
   ndbrequire(getNodeStatus(Tnodeid) == NodeRecord::STARTING);
   
-  sendSTART_RECREQ(signal, Tnodeid);
-}//Dbdih::execSTART_MEREQ()
-
-void Dbdih::nodeRestartStartRecConfLab(Signal* signal) 
-{
   c_nodeStartMaster.blockLcp = true;
   if ((c_lcpState.lcpStatus != LCP_STATUS_IDLE) &&
       (c_lcpState.lcpStatus != LCP_TCGET)) {
@@ -2059,6 +2087,9 @@
     signal->theData[0] = reference();
     signal->theData[1] = c_nodeStartSlave.nodeId;
     sendSignal(BACKUP_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
+    
+    // Suma will not send response to this for now, later...
+    sendSignal(SUMA_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
     return;
   }//if
   if (TstartNode_or_blockref == numberToRef(BACKUP, getOwnNodeId())){
@@ -2735,13 +2766,14 @@
     return;
   }//if
   c_startToLock = takeOverPtrI;
+
+  takeOverPtr.p->toMasterStatus = TakeOverRecord::STARTING;
   StartToReq * const req = (StartToReq *)&signal->theData[0];
   req->userPtr = takeOverPtr.i;
   req->userRef = reference();
   req->startingNodeId = takeOverPtr.p->toStartingNode;
   req->nodeTakenOver = takeOverPtr.p->toFailedNode;
   req->nodeRestart = takeOverPtr.p->toNodeRestart;
-  takeOverPtr.p->toMasterStatus = TakeOverRecord::STARTING;
   sendLoopMacro(START_TOREQ, sendSTART_TOREQ);
 }//Dbdih::sendStartTo()
 
@@ -2785,9 +2817,166 @@
   CRASH_INSERTION(7134);
   c_startToLock = RNIL;
 
+  if (takeOverPtr.p->toNodeRestart)
+  {
+    jam();
+    takeOverPtr.p->toMasterStatus = TakeOverRecord::STARTING_LOCAL_FRAGMENTS;
+    nr_start_fragments(signal, takeOverPtr);
+    return;
+  }
+
   startNextCopyFragment(signal, takeOverPtr.i);
 }//Dbdih::execSTART_TOCONF()
 
+void
+Dbdih::nr_start_fragments(Signal* signal, 
+			  TakeOverRecordPtr takeOverPtr)
+{
+  Uint32 loopCount = 0 ;
+  TabRecordPtr tabPtr;
+  while (loopCount++ < 100) {
+    tabPtr.i = takeOverPtr.p->toCurrentTabref;
+    if (tabPtr.i >= ctabFileSize) {
+      jam();
+      nr_run_redo(signal, takeOverPtr);
+      return;
+    }//if
+    ptrAss(tabPtr, tabRecord);
+    if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE ||
+	tabPtr.p->tabStorage != TabRecord::ST_NORMAL)
+    {
+      jam();
+      takeOverPtr.p->toCurrentFragid = 0;
+      takeOverPtr.p->toCurrentTabref++;
+      continue;
+    }//if
+    Uint32 fragId = takeOverPtr.p->toCurrentFragid;
+    if (fragId >= tabPtr.p->totalfragments) {
+      jam();
+      takeOverPtr.p->toCurrentFragid = 0;
+      takeOverPtr.p->toCurrentTabref++;
+      continue;
+    }//if
+    FragmentstorePtr fragPtr;
+    getFragstore(tabPtr.p, fragId, fragPtr);
+    ReplicaRecordPtr loopReplicaPtr;
+    loopReplicaPtr.i = fragPtr.p->oldStoredReplicas;
+    while (loopReplicaPtr.i != RNIL) {
+      ptrCheckGuard(loopReplicaPtr, creplicaFileSize, replicaRecord);
+      if (loopReplicaPtr.p->procNode == takeOverPtr.p->toStartingNode) {
+        jam();
+	nr_start_fragment(signal, takeOverPtr, loopReplicaPtr);
+	break;
+      } else {
+        jam();
+        loopReplicaPtr.i = loopReplicaPtr.p->nextReplica;
+      }//if
+    }//while
+    takeOverPtr.p->toCurrentFragid++;
+  }//while
+  signal->theData[0] = DihContinueB::ZTO_START_FRAGMENTS;
+  signal->theData[1] = takeOverPtr.i;
+  sendSignal(reference(), GSN_CONTINUEB, signal, 2, JBB);
+}
+
+void
+Dbdih::nr_start_fragment(Signal* signal, 
+			 TakeOverRecordPtr takeOverPtr,
+			 ReplicaRecordPtr replicaPtr)
+{
+  Uint32 i, j = 0;
+  Uint32 maxLcpId = 0;
+  Uint32 maxLcpIndex = ~0;
+  
+  Uint32 restorableGCI = 0;
+  
+  ndbout_c("tab: %d frag: %d replicaP->nextLcp: %d",
+	   takeOverPtr.p->toCurrentTabref,
+	   takeOverPtr.p->toCurrentFragid,
+	   replicaPtr.p->nextLcp);
+  
+  Uint32 idx = replicaPtr.p->nextLcp;
+  for(i = 0; i<MAX_LCP_STORED; i++, idx = nextLcpNo(idx))
+  {
+    ndbout_c("scanning idx: %d lcpId: %d", idx, replicaPtr.p->lcpId[idx]);
+    if (replicaPtr.p->lcpStatus[idx] == ZVALID) 
+    {
+      ndbrequire(replicaPtr.p->lcpId[idx] > maxLcpId);
+      Uint32 startGci = replicaPtr.p->maxGciCompleted[idx];
+      Uint32 stopGci = replicaPtr.p->maxGciStarted[idx];
+      for (;j < replicaPtr.p->noCrashedReplicas; j++)
+      {
+	ndbout_c("crashed replica: %d(%d) replicaLastGci: %d",
+		 j, 
+		 replicaPtr.p->noCrashedReplicas,
+		 replicaPtr.p->replicaLastGci[j]);
+	if (replicaPtr.p->replicaLastGci[j] > stopGci)
+	{
+	  maxLcpId = replicaPtr.p->lcpId[idx];
+	  maxLcpIndex = idx;
+	  restorableGCI = replicaPtr.p->replicaLastGci[j];
+	  break;
+	}
+      }
+    }
+  }
+  
+  if (maxLcpIndex == ~ (Uint32) 0)
+  {
+    ndbout_c("Didnt find any LCP for node: %d tab: %d frag: %d",
+	     takeOverPtr.p->toStartingNode,
+	     takeOverPtr.p->toCurrentTabref,
+	     takeOverPtr.p->toCurrentFragid);
+    replicaPtr.p->lcpIdStarted = 0;
+    BlockReference ref = calcLqhBlockRef(takeOverPtr.p->toStartingNode);
+    StartFragReq *req = (StartFragReq *)signal->getDataPtrSend();
+    req->userPtr = 0;
+    req->userRef = reference();
+    req->lcpNo = ZNIL;
+    req->lcpId = 0;
+    req->tableId = takeOverPtr.p->toCurrentTabref;
+    req->fragId = takeOverPtr.p->toCurrentFragid;
+    req->noOfLogNodes = 0;
+    sendSignal(ref, GSN_START_FRAGREQ, signal, 
+	       StartFragReq::SignalLength, JBB);
+  }
+  else
+  {
+    ndbout_c("Found LCP: %d(%d) maxGciStarted: %d maxGciCompleted: %d restorable: %d(%d) newestRestorableGCI: %d",
+	     maxLcpId,
+	     maxLcpIndex,
+	     replicaPtr.p->maxGciStarted[maxLcpIndex],
+	     replicaPtr.p->maxGciCompleted[maxLcpIndex],	     
+	     restorableGCI,
+	     SYSFILE->lastCompletedGCI[takeOverPtr.p->toStartingNode],
+	     SYSFILE->newestRestorableGCI);
+
+    replicaPtr.p->lcpIdStarted = restorableGCI;
+    BlockReference ref = calcLqhBlockRef(takeOverPtr.p->toStartingNode);
+    StartFragReq *req = (StartFragReq *)signal->getDataPtrSend();
+    req->userPtr = 0;
+    req->userRef = reference();
+    req->lcpNo = maxLcpIndex;
+    req->lcpId = maxLcpId;
+    req->tableId = takeOverPtr.p->toCurrentTabref;
+    req->fragId = takeOverPtr.p->toCurrentFragid;
+    req->noOfLogNodes = 1;
+    req->lqhLogNode[0] = takeOverPtr.p->toStartingNode;
+    req->startGci[0] = replicaPtr.p->maxGciCompleted[maxLcpIndex];
+    req->lastGci[0] = restorableGCI;
+    sendSignal(ref, GSN_START_FRAGREQ, signal, 
+	       StartFragReq::SignalLength, JBB);
+  }
+}
+
+void
+Dbdih::nr_run_redo(Signal* signal, TakeOverRecordPtr takeOverPtr)
+{
+  takeOverPtr.p->toCurrentTabref = 0;
+  takeOverPtr.p->toCurrentFragid = 0;
+  sendSTART_RECREQ(signal, takeOverPtr.p->toStartingNode);
+}
+
 void Dbdih::initStartTakeOver(const StartToReq * req, 
 			      TakeOverRecordPtr takeOverPtr)
 {
@@ -3120,6 +3309,14 @@
     /*---------------------------------------------------------------------- */
     FragmentstorePtr fragPtr;
     getFragstore(tabPtr.p, fragId, fragPtr);
+    Uint32 gci = 0;
+    if (takeOverPtr.p->toNodeRestart)
+    {
+      ReplicaRecordPtr replicaPtr;
+      findReplica(replicaPtr, fragPtr.p, takeOverPtr.p->toStartingNode, true);
+      gci = replicaPtr.p->lcpIdStarted;
+      replicaPtr.p->lcpIdStarted = 0;
+    }
     takeOverPtr.p->toMasterStatus = TakeOverRecord::COPY_FRAG;
     BlockReference ref = calcLqhBlockRef(takeOverPtr.p->toCopyNode);
     CopyFragReq * const copyFragReq = (CopyFragReq *)&signal->theData[0];
@@ -3130,6 +3327,7 @@
     copyFragReq->nodeId = takeOverPtr.p->toStartingNode;
     copyFragReq->schemaVersion = tabPtr.p->schemaVersion;
     copyFragReq->distributionKey = fragPtr.p->distributionKey;
+    copyFragReq->gci = gci;
     copyFragReq->nodeCount = extractNodeInfo(fragPtr.p, 
 					     copyFragReq->nodeList);
     sendSignal(ref, GSN_COPY_FRAGREQ, signal, 
@@ -3662,6 +3860,7 @@
   /*     WE ALSO COPY TO OUR OWN NODE. TO ENABLE US TO DO THIS PROPERLY WE   */
   /*     START BY CLOSING THIS FILE.                                         */
   /* ----------------------------------------------------------------------- */
+  globalData.m_restart_seq = ++SYSFILE->m_restart_seq;
   closeFile(signal, filePtr);
   filePtr.p->reqStatus = FileRecord::CLOSING_GCP;
 }//Dbdih::readingGcpLab()
@@ -3870,6 +4069,11 @@
   Uint32 newMasterId = nodeFail->masterNodeId;
   const Uint32 noOfFailedNodes = nodeFail->noOfNodes;
 
+  if (ERROR_INSERTED(7179))
+  {
+    CLEAR_ERROR_INSERT_VALUE;
+  }
+
   /*-------------------------------------------------------------------------*/
   // The first step is to convert from a bit mask to an array of failed nodes.
   /*-------------------------------------------------------------------------*/
@@ -4041,9 +4245,9 @@
     jam();
     break;
   default:
-    ndbout_c("outstanding gsn: %s(%d)", 
-	     getSignalName(c_nodeStartMaster.m_outstandingGsn), 
-	     c_nodeStartMaster.m_outstandingGsn);
+    g_eventLogger.error("outstanding gsn: %s(%d)", 
+                        getSignalName(c_nodeStartMaster.m_outstandingGsn), 
+                        c_nodeStartMaster.m_outstandingGsn);
     ndbrequire(false);
   }
   
@@ -4180,6 +4384,8 @@
 						  Uint32 takeOverPtrI)
 {
   jam();
+  ndbout_c("checkTakeOverInMasterStartNodeFailure %x",
+	   takeOverPtrI);
   if (takeOverPtrI == RNIL) {
     jam();
     return;
@@ -4193,6 +4399,9 @@
   takeOverPtr.i = takeOverPtrI;
   ptrCheckGuard(takeOverPtr, MAX_NDB_NODES, takeOverRecord);
 
+  ndbout_c("takeOverPtr.p->toMasterStatus: %x", 
+	   takeOverPtr.p->toMasterStatus);
+  
   bool ok = false;
   switch (takeOverPtr.p->toMasterStatus) {
   case TakeOverRecord::IDLE:
@@ -4301,6 +4510,13 @@
     //-----------------------------------------------------------------------
     endTakeOver(takeOverPtr.i);
     break;
+
+  case TakeOverRecord::STARTING_LOCAL_FRAGMENTS:
+    ok = true;
+    jam();
+    endTakeOver(takeOverPtr.i);
+    break;
+    
     /**
      * The following are states that it should not be possible to "be" in
      */
@@ -4484,9 +4700,10 @@
       failedNodePtr.p->activeStatus = Sysfile::NS_NotActive_NotTakenOver;
       break;
     default:
-      ndbout << "activeStatus = " << (Uint32) failedNodePtr.p->activeStatus;
-      ndbout << " at failure after NODE_FAILREP of node = ";
-      ndbout << failedNodePtr.i << endl;
+      g_eventLogger.error("activeStatus = %u "
+                          "at failure after NODE_FAILREP of node = %u",
+                          (Uint32) failedNodePtr.p->activeStatus,
+                          failedNodePtr.i);
       ndbrequire(false);
       break;
     }//switch
@@ -4643,7 +4860,7 @@
     /**
      * Node failure during master take over...
      */
-    ndbout_c("Nodefail during master take over (old: %d)", oldNode);
+    g_eventLogger.info("Nodefail during master take over (old: %d)", oldNode);
   }
   
   NodeRecordPtr nodePtr;
@@ -4913,7 +5130,8 @@
   if (latestLcpId > SYSFILE->latestLCP_ID) {
     jam();
 #if 0
-    ndbout_c("Dbdih: Setting SYSFILE->latestLCP_ID to %d", latestLcpId);
+    g_eventLogger.info("Dbdih: Setting SYSFILE->latestLCP_ID to %d",
+                       latestLcpId);
     SYSFILE->latestLCP_ID = latestLcpId;
 #endif
     SYSFILE->keepGCI = oldestKeepGci;
@@ -5404,7 +5622,7 @@
 
   //const Uint32 lcpId = SYSFILE->latestLCP_ID;
   const bool lcpOngoingFlag = (tabPtr.p->tabLcpStatus== TabRecord::TLS_ACTIVE);
-  const bool temporary = !tabPtr.p->storedTable;
+  const bool unlogged = (tabPtr.p->tabStorage != TabRecord::ST_NORMAL);
   
   FragmentstorePtr fragPtr;
   for(Uint32 fragNo = 0; fragNo < tabPtr.p->totalfragments; fragNo++){
@@ -5425,7 +5643,7 @@
         jam();
 	found = true;
 	noOfRemovedReplicas++;
-	removeNodeFromStored(nodeId, fragPtr, replicaPtr, temporary);
+	removeNodeFromStored(nodeId, fragPtr, replicaPtr, unlogged);
 	if(replicaPtr.p->lcpOngoingFlag){
 	  jam();
 	  /**
@@ -5572,7 +5790,7 @@
 
   if (ERROR_INSERTED(7030))
   {
-    ndbout_c("Reenable GCP_PREPARE");
+    g_eventLogger.info("Reenable GCP_PREPARE");
     CLEAR_ERROR_INSERT_VALUE;
   }
   
@@ -5753,18 +5971,16 @@
     c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
 #if 0
     if(c_copyGCISlave.m_copyReason == CopyGCIReq::LOCAL_CHECKPOINT){
-      ndbout_c("Dbdih: Also resetting c_copyGCISlave");
+      g_eventLogger.info("Dbdih: Also resetting c_copyGCISlave");
       c_copyGCISlave.m_copyReason = CopyGCIReq::IDLE;
       c_copyGCISlave.m_expectedNextWord = 0;
     }
 #endif
   }
 
-  bool ok = false;
   MasterLCPConf::State lcpState;
   switch (c_lcpState.lcpStatus) {
   case LCP_STATUS_IDLE:
-    ok = true;
     jam();
     /*------------------------------------------------*/
     /*       LOCAL CHECKPOINT IS CURRENTLY NOT ACTIVE */
@@ -5775,7 +5991,6 @@
     lcpState = MasterLCPConf::LCP_STATUS_IDLE;
     break;
   case LCP_STATUS_ACTIVE:
-    ok = true;
     jam();
     /*--------------------------------------------------*/
     /*       COPY OF RESTART INFORMATION HAS BEEN       */
@@ -5784,7 +5999,6 @@
     lcpState = MasterLCPConf::LCP_STATUS_ACTIVE;
     break;
   case LCP_TAB_COMPLETED:
-    ok = true;
     jam();
     /*--------------------------------------------------------*/
     /*       ALL LCP_REPORT'S HAVE BEEN COMPLETED FOR         */
@@ -5794,7 +6008,6 @@
     lcpState = MasterLCPConf::LCP_TAB_COMPLETED;
     break;
   case LCP_TAB_SAVED:
-    ok = true;
     jam();
     /*--------------------------------------------------------*/
     /*       ALL LCP_REPORT'S HAVE BEEN COMPLETED FOR         */
@@ -5818,15 +6031,16 @@
     break;
   case LCP_COPY_GCI:
   case LCP_INIT_TABLES:
-    ok = true;
     /**
      * These two states are handled by if statements above
      */
     ndbrequire(false);
     lcpState= MasterLCPConf::LCP_STATUS_IDLE; // remove warning
     break;
+  default:
+    ndbrequire(false);
+    lcpState= MasterLCPConf::LCP_STATUS_IDLE; // remove warning
   }//switch
-  ndbrequire(ok);
 
   Uint32 failedNodeId = c_lcpState.m_MASTER_LCPREQ_FailedNodeId;
   MasterLCPConf * const conf = (MasterLCPConf *)&signal->theData[0];
@@ -5842,7 +6056,7 @@
 
   if(c_lcpState.lcpStatus == LCP_TAB_SAVED){
 #ifdef VM_TRACE
-    ndbout_c("Sending extra GSN_LCP_COMPLETE_REP to new master");    
+    g_eventLogger.info("Sending extra GSN_LCP_COMPLETE_REP to new master");    
 #endif
     sendLCP_COMPLETE_REP(signal);
   }
@@ -6000,7 +6214,7 @@
   CRASH_INSERTION(7180);
   
 #ifdef VM_TRACE
-  ndbout_c("MASTER_LCPCONF");
+  g_eventLogger.info("MASTER_LCPCONF");
   printMASTER_LCP_CONF(stdout, &signal->theData[0], 0, 0);
 #endif  
 
@@ -6077,7 +6291,7 @@
     // protocol.
     /* --------------------------------------------------------------------- */
 #ifdef VM_TRACE
-    ndbout_c("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart");
+    g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart");
 #endif
     checkLcpStart(signal, __LINE__);
     break;
@@ -6088,7 +6302,7 @@
     // protocol by calculating the keep gci and storing the new lcp id.
     /* --------------------------------------------------------------------- */
 #ifdef VM_TRACE
-    ndbout_c("MASTER_LCPhandling:: LMTOS_COPY_ONGOING -> storeNewLcpId");
+    g_eventLogger.info("MASTER_LCPhandling:: LMTOS_COPY_ONGOING -> storeNewLcpId");
 #endif
     if (c_lcpState.lcpStatus == LCP_STATUS_ACTIVE) {
       jam();
@@ -6099,7 +6313,7 @@
       /*---------------------------------------------------------------------*/
       Uint32 lcpId = SYSFILE->latestLCP_ID;
 #ifdef VM_TRACE
-      ndbout_c("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1);
+      g_eventLogger.info("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1);
 #endif
       SYSFILE->latestLCP_ID--;
     }//if
@@ -6116,10 +6330,10 @@
        * complete before finalising the LCP process.
        * ------------------------------------------------------------------ */
 #ifdef VM_TRACE
-      ndbout_c("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> "
-	       "startLcpRoundLoopLab(table=%u, fragment=%u)",
-	       c_lcpMasterTakeOverState.minTableId, 
-	       c_lcpMasterTakeOverState.minFragId);
+      g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> "
+                         "startLcpRoundLoopLab(table=%u, fragment=%u)",
+                         c_lcpMasterTakeOverState.minTableId, 
+                         c_lcpMasterTakeOverState.minFragId);
 #endif
     
       c_lcpState.keepGci = SYSFILE->keepGCI;
@@ -6426,96 +6640,147 @@
   3.7.1   A D D   T A B L E   M A I N L Y
   ***************************************
   */
-void Dbdih::execCREATE_FRAGMENTATION_REQ(Signal * signal){
+
+static inline void inc_node_or_group(Uint32 &node, Uint32 max_node)
+{
+  Uint32 next = node + 1;
+  node = (next == max_node ? 0 : next);
+}
+
+/*
+  Spread fragments in backwards compatible mode
+*/
+static void set_default_node_groups(Signal *signal, Uint32 noFrags)
+{
+  Uint16 *node_group_array = (Uint16*)&signal->theData[25];
+  Uint32 i;
+  node_group_array[0] = 0;
+  for (i = 1; i < noFrags; i++)
+    node_group_array[i] = UNDEF_NODEGROUP;
+}
+void Dbdih::execCREATE_FRAGMENTATION_REQ(Signal * signal)
+{
+  Uint16 node_group_id[MAX_NDB_PARTITIONS];
   jamEntry();
   CreateFragmentationReq * const req = 
     (CreateFragmentationReq*)signal->getDataPtr();
   
   const Uint32 senderRef = req->senderRef;
   const Uint32 senderData = req->senderData;
-  const Uint32 fragmentNode = req->fragmentNode;
-  const Uint32 fragmentType = req->fragmentationType;
-  //const Uint32 fragmentCount = req->noOfFragments;
+  Uint32 noOfFragments = req->noOfFragments;
+  const Uint32 fragType = req->fragmentationType;
   const Uint32 primaryTableId = req->primaryTableId;
 
   Uint32 err = 0;
   
   do {
-    Uint32 noOfFragments = 0;
-    Uint32 noOfReplicas = cnoReplicas;
-    switch(fragmentType){
-    case DictTabInfo::AllNodesSmallTable:
-      jam();
-      noOfFragments = csystemnodes;
-      break;
-    case DictTabInfo::AllNodesMediumTable:
-      jam();
-      noOfFragments = 2 * csystemnodes;
-      break;
-    case DictTabInfo::AllNodesLargeTable:
-      jam();
-      noOfFragments = 4 * csystemnodes;
-      break;
-    case DictTabInfo::SingleFragment:
-      jam();
-      noOfFragments = 1;
-      break;
-#if 0
-    case DictTabInfo::SpecifiedFragmentCount:
-      noOfFragments = (fragmentCount == 0 ? 1 : (fragmentCount + 1)/ 2);
-      break;
-#endif
-    default:
-      jam();
-      err = CreateFragmentationRef::InvalidFragmentationType;
-      break;
-    }
-    if(err)
-      break;
-   
     NodeGroupRecordPtr NGPtr;
     TabRecordPtr primTabPtr;
+    Uint32 count = 2;
+    Uint16 noOfReplicas = cnoReplicas;
+    Uint16 *fragments = (Uint16*)(signal->theData+25);
     if (primaryTableId == RNIL) {
-      if(fragmentNode == 0){
-        jam();
-        NGPtr.i = 0; 
-	if(noOfFragments < csystemnodes)
-	{
-	  NGPtr.i = c_nextNodeGroup; 
-	  c_nextNodeGroup = (NGPtr.i + 1 == cnoOfNodeGroups ? 0 : NGPtr.i + 1);
-	}
-      } else if(! (fragmentNode < MAX_NDB_NODES)) {
-        jam();
-        err = CreateFragmentationRef::InvalidNodeId;
-      } else {
-        jam();
-        const Uint32 stat = Sysfile::getNodeStatus(fragmentNode,
-                                                   SYSFILE->nodeStatus);
-        switch (stat) {
-        case Sysfile::NS_Active:
-        case Sysfile::NS_ActiveMissed_1:
-        case Sysfile::NS_ActiveMissed_2:
-        case Sysfile::NS_TakeOver:
+      jam();
+      switch ((DictTabInfo::FragmentType)fragType)
+      {
+        /*
+          Backward compatability and for all places in code not changed.
+        */
+        case DictTabInfo::AllNodesSmallTable:
+          jam();
+          noOfFragments = csystemnodes;
+          set_default_node_groups(signal, noOfFragments);
+          break;
+        case DictTabInfo::AllNodesMediumTable:
           jam();
+          noOfFragments = 2 * csystemnodes;
+          set_default_node_groups(signal, noOfFragments);
           break;
-        case Sysfile::NS_NotActive_NotTakenOver:
+        case DictTabInfo::AllNodesLargeTable:
           jam();
+          noOfFragments = 4 * csystemnodes;
+          set_default_node_groups(signal, noOfFragments);
           break;
-        case Sysfile::NS_HotSpare:
+        case DictTabInfo::SingleFragment:
           jam();
-        case Sysfile::NS_NotDefined:
+          noOfFragments = 1;
+          set_default_node_groups(signal, noOfFragments);
+          break;
+        case DictTabInfo::DistrKeyHash:
+          jam();
+        case DictTabInfo::DistrKeyLin:
           jam();
+          if (noOfFragments == 0)
+          {
+            jam();
+            noOfFragments = csystemnodes;
+            set_default_node_groups(signal, noOfFragments);
+          }
+          break;
         default:
           jam();
-          err = CreateFragmentationRef::InvalidNodeType;
+          if (noOfFragments == 0)
+          {
+            jam();
+            err = CreateFragmentationRef::InvalidFragmentationType;
+          }
           break;
+      }
+      if (err)
+        break;
+      /*
+        When we come here the the exact partition is specified
+        and there is an array of node groups sent along as well.
+      */
+      memcpy(&node_group_id[0], &signal->theData[25], 2 * noOfFragments);
+      Uint16 next_replica_node[MAX_NDB_NODES];
+      memset(next_replica_node,0,sizeof(next_replica_node));
+      Uint32 default_node_group= c_nextNodeGroup;
+      for(Uint32 fragNo = 0; fragNo < noOfFragments; fragNo++)
+      {
+        jam();
+        NGPtr.i = node_group_id[fragNo];
+        if (NGPtr.i == UNDEF_NODEGROUP)
+        {
+          jam();
+	  NGPtr.i = default_node_group; 
         }
-        if(err)
+        if (NGPtr.i > cnoOfNodeGroups)
+        {
+          jam();
+          err = CreateFragmentationRef::InvalidNodeGroup;
           break;
-        NGPtr.i = Sysfile::getNodeGroup(fragmentNode,
-                                        SYSFILE->nodeGroups);
+        }
+        ptrCheckGuard(NGPtr, MAX_NDB_NODES, nodeGroupRecord);
+        const Uint32 max = NGPtr.p->nodeCount;
+	
+	fragments[count++] = c_nextLogPart++; // Store logpart first
+	Uint32 tmp= next_replica_node[NGPtr.i];
+        for(Uint32 replicaNo = 0; replicaNo < noOfReplicas; replicaNo++)
+        {
+          jam();
+          const Uint16 nodeId = NGPtr.p->nodesInGroup[tmp];
+          fragments[count++]= nodeId;
+          inc_node_or_group(tmp, max);
+        }
+        inc_node_or_group(tmp, max);
+	next_replica_node[NGPtr.i]= tmp;
+	
+        /**
+         * Next node group for next fragment
+         */
+        inc_node_or_group(default_node_group, cnoOfNodeGroups);
+      }
+      if (err)
+      {
+        jam();
         break;
       }
+      else
+      {
+        jam();
+        c_nextNodeGroup = default_node_group;
+      }
     } else {
       if (primaryTableId >= ctabFileSize) {
         jam();
@@ -6529,48 +6794,14 @@
         err = CreateFragmentationRef::InvalidPrimaryTable;
         break;
       }
-      if (noOfFragments != primTabPtr.p->totalfragments) {
-        jam();
-        err = CreateFragmentationRef::InvalidFragmentationType;
-        break;
-      }
-    }
-    
-    Uint32 count = 2;
-    Uint16 *fragments = (Uint16*)(signal->theData+25);
-    if (primaryTableId == RNIL) {
-      jam();
-      Uint8 next_replica_node[MAX_NDB_NODES];
-      memset(next_replica_node,0,sizeof(next_replica_node));
-      for(Uint32 fragNo = 0; fragNo<noOfFragments; fragNo++){
-        jam();
-        ptrCheckGuard(NGPtr, MAX_NDB_NODES, nodeGroupRecord);      
-        const Uint32 max = NGPtr.p->nodeCount;
-	
-	Uint32 tmp= next_replica_node[NGPtr.i];
-        for(Uint32 replicaNo = 0; replicaNo<noOfReplicas; replicaNo++)
-        {
-          jam();
-          const Uint32 nodeId = NGPtr.p->nodesInGroup[tmp++];
-          fragments[count++] = nodeId;
-          tmp = (tmp >= max ? 0 : tmp);
-        }
-	tmp++;
-	next_replica_node[NGPtr.i]= (tmp >= max ? 0 : tmp);
-	
-        /**
-         * Next node group for next fragment
-         */
-        NGPtr.i++;
-        NGPtr.i = (NGPtr.i == cnoOfNodeGroups ? 0 : NGPtr.i);
-      }
-    } else {
+      noOfFragments= primTabPtr.p->totalfragments;
       for (Uint32 fragNo = 0;
-           fragNo < primTabPtr.p->totalfragments; fragNo++) {
+           fragNo < noOfFragments; fragNo++) {
         jam();
         FragmentstorePtr fragPtr;
         ReplicaRecordPtr replicaPtr;
         getFragstore(primTabPtr.p, fragNo, fragPtr);
+	fragments[count++] = fragPtr.p->m_log_part_id;
         fragments[count++] = fragPtr.p->preferredPrimary;
         for (replicaPtr.i = fragPtr.p->storedReplicas;
              replicaPtr.i != RNIL;
@@ -6579,9 +6810,9 @@
           ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
           if (replicaPtr.p->procNode != fragPtr.p->preferredPrimary) {
             jam();
-            fragments[count++] = replicaPtr.p->procNode;
-          }//if
-        }//for
+            fragments[count++]= replicaPtr.p->procNode;
+          }
+        }
         for (replicaPtr.i = fragPtr.p->oldStoredReplicas;
              replicaPtr.i != RNIL;
              replicaPtr.i = replicaPtr.p->nextReplica) {
@@ -6589,25 +6820,32 @@
           ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
           if (replicaPtr.p->procNode != fragPtr.p->preferredPrimary) {
             jam();
-            fragments[count++] = replicaPtr.p->procNode;
-          }//if
-        }//for
+            fragments[count++]= replicaPtr.p->procNode;
+          }
+        }
       }
     }
-    ndbrequire(count == (2 + noOfReplicas * noOfFragments)); 
+    if(count != (2U + (1 + noOfReplicas) * noOfFragments)){
+        char buf[255];
+        BaseString::snprintf(buf, sizeof(buf),
+                           "Illegal configuration change: NoOfReplicas."
+                           " Can't be applied online ");
+        progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+    }
     
     CreateFragmentationConf * const conf = 
       (CreateFragmentationConf*)signal->getDataPtrSend();
     conf->senderRef = reference();
     conf->senderData = senderData;
-    conf->noOfReplicas = noOfReplicas;
-    conf->noOfFragments = noOfFragments;
+    conf->noOfReplicas = (Uint32)noOfReplicas;
+    conf->noOfFragments = (Uint32)noOfFragments;
 
-    fragments[0] = noOfReplicas;
-    fragments[1] = noOfFragments;
+    fragments[0]= noOfReplicas;
+    fragments[1]= noOfFragments;
     
     if(senderRef != 0)
     {
+      jam();
       LinearSectionPtr ptr[3];
       ptr[0].p = (Uint32*)&fragments[0];
       ptr[0].sz = (count + 1) / 2;
@@ -6619,33 +6857,17 @@
 		 ptr,
 		 1);
     }
-    else
-    {
-      // Execute direct
-      signal->theData[0] = 0;
-    }
+    // Always ACK/NACK (here ACK)
+    signal->theData[0] = 0;
     return;
   } while(false);
-
-  if(senderRef != 0)
-  {
-    CreateFragmentationRef * const ref = 
-      (CreateFragmentationRef*)signal->getDataPtrSend();
-    ref->senderRef = reference();
-    ref->senderData = senderData;
-    ref->errorCode = err;
-    sendSignal(senderRef, GSN_CREATE_FRAGMENTATION_REF, signal, 
-	       CreateFragmentationRef::SignalLength, JBB);
-  }
-  else
-  {
-    // Execute direct
-    signal->theData[0] = err;
-  }
+  // Always ACK/NACK (here NACK)
+  signal->theData[0] = err;
 }
 
 void Dbdih::execDIADDTABREQ(Signal* signal) 
 {
+  Uint32 fragType;
   jamEntry();
 
   DiAddTabReq * const req = (DiAddTabReq*)signal->getDataPtr();
@@ -6670,6 +6892,7 @@
   ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
   tabPtr.p->connectrec = connectPtr.i;
   tabPtr.p->tableType = req->tableType;
+  fragType= req->fragType;
   tabPtr.p->schemaVersion = req->schemaVersion;
   tabPtr.p->primaryTableId = req->primaryTableId;
 
@@ -6705,15 +6928,46 @@
   /* BUT THEY DO NOT HAVE ANY INFORMATION ABOUT ANY TABLE*/
   /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
   tabPtr.p->tabStatus = TabRecord::TS_CREATING;
-  tabPtr.p->storedTable = req->storedTable;
-  tabPtr.p->method = TabRecord::HASH;
+  if(req->loggedTable)
+    tabPtr.p->tabStorage= TabRecord::ST_NORMAL;
+  else if(req->temporaryTable)
+    tabPtr.p->tabStorage= TabRecord::ST_TEMPORARY;
+  else
+    tabPtr.p->tabStorage= TabRecord::ST_NOLOGGING;
   tabPtr.p->kvalue = req->kValue;
 
+  switch ((DictTabInfo::FragmentType)fragType)
+  {
+    case DictTabInfo::AllNodesSmallTable:
+    case DictTabInfo::AllNodesMediumTable:
+    case DictTabInfo::AllNodesLargeTable:
+    case DictTabInfo::SingleFragment:
+      jam();
+    case DictTabInfo::DistrKeyLin:
+      jam();
+      tabPtr.p->method= TabRecord::LINEAR_HASH;
+      break;
+    case DictTabInfo::DistrKeyHash:
+    case DictTabInfo::DistrKeyUniqueHashIndex:
+    case DictTabInfo::DistrKeyOrderedIndex:
+      jam();
+      tabPtr.p->method= TabRecord::NORMAL_HASH;
+      break;
+    case DictTabInfo::UserDefined:
+      jam();
+      tabPtr.p->method= TabRecord::USER_DEFINED;
+      break;
+    default:
+      ndbrequire(false);
+  }
+
   union {
     Uint16 fragments[2 + MAX_FRAG_PER_NODE*MAX_REPLICAS*MAX_NDB_NODES];
     Uint32 align;
   };
   SegmentedSectionPtr fragDataPtr;
+  LINT_INIT(fragDataPtr.i);
+  LINT_INIT(fragDataPtr.sz);
   signal->getSection(fragDataPtr, DiAddTabReq::FRAGMENTATION);
   copy((Uint32*)fragments, fragDataPtr);
   releaseSections(signal);
@@ -6757,7 +7011,9 @@
     FragmentstorePtr fragPtr;
     Uint32 activeIndex = 0;
     getFragstore(tabPtr.p, fragId, fragPtr);
+    fragPtr.p->m_log_part_id = fragments[index++];
     fragPtr.p->preferredPrimary = fragments[index];
+    
     for (Uint32 i = 0; i<noReplicas; i++) {
       const Uint32 nodeId = fragments[index++];
       ReplicaRecordPtr replicaPtr;
@@ -6801,10 +7057,12 @@
 		      TabRecordPtr tabPtr, Uint32 fragId){
   jam();
   const Uint32 fragCount = tabPtr.p->totalfragments;
-  ReplicaRecordPtr replicaPtr; replicaPtr.i = RNIL;
+  ReplicaRecordPtr replicaPtr;
+  LINT_INIT(replicaPtr.p);
+  replicaPtr.i = RNIL;
+  FragmentstorePtr fragPtr;
   for(; fragId<fragCount; fragId++){
     jam();
-    FragmentstorePtr fragPtr;
     getFragstore(tabPtr.p, fragId, fragPtr);    
     
     replicaPtr.i = fragPtr.p->storedReplicas;
@@ -6844,7 +7102,7 @@
     ndbrequire(replicaPtr.p->procNode == getOwnNodeId());
 
     Uint32 requestInfo = 0;
-    if(!tabPtr.p->storedTable){
+    if(tabPtr.p->tabStorage != TabRecord::ST_NORMAL){
       requestInfo |= LqhFragReq::TemporaryTable;
     }
     
@@ -6862,6 +7120,7 @@
     req->nodeId = getOwnNodeId();
     req->totalFragments = fragCount;
     req->startGci = SYSFILE->newestRestorableGCI;
+    req->logPartId = fragPtr.p->m_log_part_id;
     sendSignal(DBDICT_REF, GSN_ADD_FRAGREQ, signal, 
 	       AddFragReq::SignalLength, JBB);
     return;
@@ -7143,17 +7402,40 @@
   tabPtr.i = req->tableId;
   Uint32 hashValue = req->hashValue;
   Uint32 ttabFileSize = ctabFileSize;
+  Uint32 fragId;
+  DiGetNodesConf * const conf = (DiGetNodesConf *)&signal->theData[0];
   TabRecord* regTabDesc = tabRecord;
   jamEntry();
   ptrCheckGuard(tabPtr, ttabFileSize, regTabDesc);
-  Uint32 fragId = hashValue & tabPtr.p->mask;
-  ndbrequire(tabPtr.p->tabStatus == TabRecord::TS_ACTIVE);
-  if (fragId < tabPtr.p->hashpointer) {
+  if (tabPtr.p->method == TabRecord::LINEAR_HASH)
+  {
     jam();
-    fragId = hashValue & ((tabPtr.p->mask << 1) + 1);
-  }//if
+    fragId = hashValue & tabPtr.p->mask;
+    ndbrequire(tabPtr.p->tabStatus == TabRecord::TS_ACTIVE);
+    if (fragId < tabPtr.p->hashpointer) {
+      jam();
+      fragId = hashValue & ((tabPtr.p->mask << 1) + 1);
+    }//if
+  }
+  else if (tabPtr.p->method == TabRecord::NORMAL_HASH)
+  {
+    jam();
+    fragId= hashValue % tabPtr.p->totalfragments;
+  }
+  else
+  {
+    jam();
+    ndbassert(tabPtr.p->method == TabRecord::USER_DEFINED);
+    fragId= hashValue;
+    if (fragId >= tabPtr.p->totalfragments)
+    {
+      jam();
+      conf->zero= 1; //Indicate error;
+      signal->theData[1]= ZUNDEFINED_FRAGMENT_ERROR;
+      return;
+    }
+  }
   getFragstore(tabPtr.p, fragId, fragPtr);
-  DiGetNodesConf * const conf = (DiGetNodesConf *)&signal->theData[0];
   Uint32 nodeCount = extractNodeInfo(fragPtr.p, conf->nodes);
   Uint32 sig2 = (nodeCount - 1) + 
     (fragPtr.p->distributionKey << 16);
@@ -7320,39 +7602,70 @@
 
 void Dbdih::execDI_FCOUNTREQ(Signal* signal) 
 {
+  DihFragCountReq * const req = (DihFragCountReq*)signal->getDataPtr();
   ConnectRecordPtr connectPtr;
   TabRecordPtr tabPtr;
+  const BlockReference senderRef = signal->senderBlockRef();
+  const Uint32 senderData = req->m_senderData;
   jamEntry();
-  connectPtr.i = signal->theData[0];
-  tabPtr.i = signal->theData[1];
+  connectPtr.i = req->m_connectionData;
+  tabPtr.i = req->m_tableRef;
   ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
 
-  ndbrequire(tabPtr.p->tabStatus == TabRecord::TS_ACTIVE);
+  if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE)
+  {
+    DihFragCountRef* ref = (DihFragCountRef*)signal->getDataPtrSend();
+    //connectPtr.i == RNIL -> question without connect record
+    if(connectPtr.i == RNIL)
+      ref->m_connectionData = RNIL;
+    else
+    {
+      jam();
+      ptrCheckGuard(connectPtr, cconnectFileSize, connectRecord);
+      ref->m_connectionData = connectPtr.p->userpointer;
+    }
+    ref->m_tableRef = tabPtr.i;
+    ref->m_senderData = senderData;
+    ref->m_error = DihFragCountRef::ErroneousTableState;
+    ref->m_tableStatus = tabPtr.p->tabStatus;
+    sendSignal(senderRef, GSN_DI_FCOUNTREF, signal, 
+               DihFragCountRef::SignalLength, JBB);
+    return;
+  }
 
   if(connectPtr.i != RNIL){
     ptrCheckGuard(connectPtr, cconnectFileSize, connectRecord);
     if (connectPtr.p->connectState == ConnectRecord::INUSE) {
       jam();
-      signal->theData[0] = connectPtr.p->userpointer;
-      signal->theData[1] = tabPtr.p->totalfragments;
-      sendSignal(connectPtr.p->userblockref, GSN_DI_FCOUNTCONF, signal,2, JBB);
-      return;
-    }//if
-    signal->theData[0] = connectPtr.p->userpointer;
-    signal->theData[1] = ZERRONOUSSTATE;
-    sendSignal(connectPtr.p->userblockref, GSN_DI_FCOUNTREF, signal, 2, JBB);
+      DihFragCountConf* conf = (DihFragCountConf*)signal->getDataPtrSend();
+      conf->m_connectionData = connectPtr.p->userpointer;
+      conf->m_tableRef = tabPtr.i;
+      conf->m_senderData = senderData;
+      conf->m_fragmentCount = tabPtr.p->totalfragments;
+      conf->m_noOfBackups = tabPtr.p->noOfBackups;
+      sendSignal(connectPtr.p->userblockref, GSN_DI_FCOUNTCONF, signal,
+                 DihFragCountConf::SignalLength, JBB);
+      return;
+    }//if
+    DihFragCountRef* ref = (DihFragCountRef*)signal->getDataPtrSend();
+    ref->m_connectionData = connectPtr.p->userpointer;
+    ref->m_tableRef = tabPtr.i;
+    ref->m_senderData = senderData;
+    ref->m_error = DihFragCountRef::ErroneousTableState;
+    ref->m_tableStatus = tabPtr.p->tabStatus;
+    sendSignal(connectPtr.p->userblockref, GSN_DI_FCOUNTREF, signal, 
+               DihFragCountRef::SignalLength, JBB);
     return;
   }//if
-
+  DihFragCountConf* conf = (DihFragCountConf*)signal->getDataPtrSend();
   //connectPtr.i == RNIL -> question without connect record
-  const Uint32 senderData = signal->theData[2];
-  const BlockReference senderRef = signal->senderBlockRef();
-  signal->theData[0] = RNIL;
-  signal->theData[1] = tabPtr.p->totalfragments;
-  signal->theData[2] = tabPtr.i;
-  signal->theData[3] = senderData;
-  signal->theData[4] = tabPtr.p->noOfBackups;
-  sendSignal(senderRef, GSN_DI_FCOUNTCONF, signal, 5, JBB);
+  conf->m_connectionData = RNIL;
+  conf->m_tableRef = tabPtr.i;
+  conf->m_senderData = senderData;
+  conf->m_fragmentCount = tabPtr.p->totalfragments;
+  conf->m_noOfBackups = tabPtr.p->noOfBackups;
+  sendSignal(senderRef, GSN_DI_FCOUNTCONF, signal, 
+             DihFragCountConf::SignalLength, JBB);
 }//Dbdih::execDI_FCOUNTREQ()
 
 void Dbdih::execDIGETPRIMREQ(Signal* signal) 
@@ -7424,8 +7737,8 @@
         if (cgcpSameCounter == 1200) {
           jam();
 #ifdef VM_TRACE
-          ndbout << "System crash due to GCP Stop in state = ";
-          ndbout << (Uint32) cgcpStatus << endl;
+          g_eventLogger.error("System crash due to GCP Stop in state = %u",
+                              (Uint32) cgcpStatus);
 #endif
           crashSystemAtGcpStop(signal);
           return;
@@ -7438,8 +7751,8 @@
           if (cgcpSameCounter == 1200) {
             jam();
 #ifdef VM_TRACE
-            ndbout << "System crash due to GCP Stop in state = ";
-            ndbout << (Uint32) cgcpStatus << endl;
+            g_eventLogger.error("System crash due to GCP Stop in state = %u",
+                                (Uint32) cgcpStatus);
 #endif
 	    crashSystemAtGcpStop(signal);
             return;
@@ -7630,7 +7943,7 @@
      getNodeState().startLevel == NodeState::SL_STARTED){
     jam();
 #if 0
-    ndbout_c("Dbdih: Clearing initial start ongoing");
+    g_eventLogger.info("Dbdih: Clearing initial start ongoing");
 #endif
     Sysfile::clearInitialStartOngoing(SYSFILE->systemRestartBits);
   }
@@ -7649,7 +7962,7 @@
   if (ERROR_INSERTED(7030))
   {
     cgckptflag = true;
-    ndbout_c("Delayed GCP_PREPARE 5s");
+    g_eventLogger.info("Delayed GCP_PREPARE 5s");
     sendSignalWithDelay(reference(), GSN_GCP_PREPARE, signal, 5000,
 			signal->getLength());
     return;
@@ -7669,7 +7982,7 @@
 
   if (ERROR_INSERTED(7031))
   {
-    ndbout_c("Crashing delayed in GCP_PREPARE 3s");
+    g_eventLogger.info("Crashing delayed in GCP_PREPARE 3s");
     signal->theData[0] = 9999;
     sendSignalWithDelay(CMVMI_REF, GSN_NDB_TAMPER, signal, 3000, 1);
     return;
@@ -8135,6 +8448,15 @@
   if (reason == CopyGCIReq::GLOBAL_CHECKPOINT) {
     jam();
     cgcpParticipantState = GCP_PARTICIPANT_READY;
+    
+    SubGcpCompleteRep * const rep = (SubGcpCompleteRep*)signal->getDataPtr();
+    rep->gci = coldgcp;
+    sendSignal(SUMA_REF, GSN_SUB_GCP_COMPLETE_REP, signal, 
+	       SubGcpCompleteRep::SignalLength, JBB);
+
+    EXECUTE_DIRECT(LGMAN, GSN_SUB_GCP_COMPLETE_REP, signal, 
+		   SubGcpCompleteRep::SignalLength);
+    jamEntry();
   }
   
   jam();
@@ -8193,7 +8515,7 @@
      * This is LCP master takeover
      */
 #ifdef VM_TRACE
-    ndbout_c("initLcpLab aborted due to LCP master takeover - 1");
+    g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 1");
 #endif
     c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
     sendMASTER_LCPCONF(signal);
@@ -8206,7 +8528,7 @@
      * Master take over but has not yet received MASTER_LCPREQ
      */
 #ifdef VM_TRACE
-    ndbout_c("initLcpLab aborted due to LCP master takeover - 2");    
+    g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 2");
 #endif
     return;
   }
@@ -8223,9 +8545,9 @@
       continue;
     }
 
-    if (tabPtr.p->storedTable == 0) {
+    if (tabPtr.p->tabStorage != TabRecord::ST_NORMAL) {
       /**
-       * Temporary table
+       * Table is not logged
        */
       jam();
       tabPtr.p->tabLcpStatus = TabRecord::TLS_COMPLETED;
@@ -8538,7 +8860,7 @@
 	    ConstPtr<ReplicaRecord> constReplicaPtr;
 	    constReplicaPtr.i = replicaPtr.i;
 	    constReplicaPtr.p = replicaPtr.p;
-	    if (tabPtr.p->storedTable == 0 ||
+	    if (tabPtr.p->tabStorage != TabRecord::ST_NORMAL ||
 		setup_create_replica(fragPtr,
 				     &createReplica, constReplicaPtr))
 	    {
@@ -8731,12 +9053,11 @@
   rf.rwfTabPtr.p->hashpointer = readPageWord(&rf);
   rf.rwfTabPtr.p->kvalue = readPageWord(&rf);
   rf.rwfTabPtr.p->mask = readPageWord(&rf);
-  ndbrequire(readPageWord(&rf) == TabRecord::HASH);
-  rf.rwfTabPtr.p->method = TabRecord::HASH;
-  /* ---------------------------------- */
-  /* Type of table, 2 = temporary table */
-  /* ---------------------------------- */
-  rf.rwfTabPtr.p->storedTable = readPageWord(&rf); 
+  rf.rwfTabPtr.p->method = (TabRecord::Method)readPageWord(&rf);
+  /* ------------- */
+  /* Type of table */
+  /* ------------- */
+  rf.rwfTabPtr.p->tabStorage = (TabRecord::Storage)(readPageWord(&rf)); 
 
   Uint32 noOfFrags = rf.rwfTabPtr.p->totalfragments;
   ndbrequire(noOfFrags > 0);
@@ -8826,8 +9147,8 @@
   writePageWord(&wf, tabPtr.p->hashpointer);
   writePageWord(&wf, tabPtr.p->kvalue);
   writePageWord(&wf, tabPtr.p->mask);
-  writePageWord(&wf, TabRecord::HASH);
-  writePageWord(&wf, tabPtr.p->storedTable);
+  writePageWord(&wf, tabPtr.p->method);
+  writePageWord(&wf, tabPtr.p->tabStorage);
 
   signal->theData[0] = DihContinueB::ZPACK_FRAG_INTO_PAGES;
   signal->theData[1] = tabPtr.i;
@@ -8927,6 +9248,80 @@
 /*****************************************************************************/
 /* **********     START FRAGMENT MODULE                          *************/
 /*****************************************************************************/
+void
+Dbdih::dump_replica_info()
+{
+  TabRecordPtr tabPtr;
+  FragmentstorePtr fragPtr;
+
+  for(tabPtr.i = 0; tabPtr.i < ctabFileSize; tabPtr.i++)
+  {
+    ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
+    if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE)
+      continue;
+    
+    for(Uint32 fid = 0; fid<tabPtr.p->totalfragments; fid++)
+    {
+      getFragstore(tabPtr.p, fid, fragPtr);
+      ndbout_c("tab: %d frag: %d gci: %d\n  -- storedReplicas:", 
+	       tabPtr.i, fid, SYSFILE->newestRestorableGCI);
+      
+      Uint32 i;
+      ReplicaRecordPtr replicaPtr;
+      replicaPtr.i = fragPtr.p->storedReplicas;
+      for(; replicaPtr.i != RNIL; replicaPtr.i = replicaPtr.p->nextReplica)
+      {
+	ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
+	ndbout_c("  node: %d initialGci: %d nextLcp: %d noCrashedReplicas: %d",
+		 replicaPtr.p->procNode,
+		 replicaPtr.p->initialGci,
+		 replicaPtr.p->nextLcp,
+		 replicaPtr.p->noCrashedReplicas);
+	for(i = 0; i<MAX_LCP_STORED; i++)
+	{
+	  ndbout_c("    i: %d %s : lcpId: %d maxGci Completed: %d Started: %d",
+		   i, 
+		   (replicaPtr.p->lcpStatus[i] == ZVALID ?"VALID":"INVALID"),
+		   replicaPtr.p->lcpId[i],
+		   replicaPtr.p->maxGciCompleted[i],
+		   replicaPtr.p->maxGciStarted[i]);
+	}
+	
+	for (i = 0; i < 8; i++)
+	{
+	  ndbout_c("    crashed replica: %d replicaLastGci: %d createGci: %d",
+		   i, 
+		   replicaPtr.p->replicaLastGci[i],
+		   replicaPtr.p->createGci[i]);
+	}
+      }
+      ndbout_c("  -- oldStoredReplicas");
+      replicaPtr.i = fragPtr.p->oldStoredReplicas;
+      for(; replicaPtr.i != RNIL; replicaPtr.i = replicaPtr.p->nextReplica)
+      {
+	ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
+	for(i = 0; i<MAX_LCP_STORED; i++)
+	{
+	  ndbout_c("    i: %d %s : lcpId: %d maxGci Completed: %d Started: %d",
+		   i, 
+		   (replicaPtr.p->lcpStatus[i] == ZVALID ?"VALID":"INVALID"),
+		   replicaPtr.p->lcpId[i],
+		   replicaPtr.p->maxGciCompleted[i],
+		   replicaPtr.p->maxGciStarted[i]);
+	}
+	
+	for (i = 0; i < 8; i++)
+	{
+	  ndbout_c("    crashed replica: %d replicaLastGci: %d createGci: %d",
+		   i, 
+		   replicaPtr.p->replicaLastGci[i],
+		   replicaPtr.p->createGci[i]);
+	}
+      }
+    }
+  }
+}
+
 void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId) 
 {
   Uint32 TloopCount = 0;
@@ -8958,7 +9353,7 @@
       continue;
     }
     
-    if(tabPtr.p->storedTable == 0){
+    if(tabPtr.p->tabStorage != TabRecord::ST_NORMAL){
       jam();
       TloopCount++;
       tableId++;
@@ -8988,6 +9383,7 @@
   /*     SEARCH FOR STORED REPLICAS THAT CAN BE USED TO RESTART THE SYSTEM.  */
   /* ----------------------------------------------------------------------- */
   searchStoredReplicas(fragPtr);
+
   if (cnoOfCreateReplicas == 0) {
     /* --------------------------------------------------------------------- */
     /*   THERE WERE NO STORED REPLICAS AVAILABLE THAT CAN SERVE AS REPLICA TO*/
@@ -9000,6 +9396,10 @@
     char buf[64];
     BaseString::snprintf(buf, sizeof(buf), "table: %d fragment: %d gci: %d",
 			 tableId, fragId, SYSFILE->newestRestorableGCI);
+
+    ndbout_c(buf);
+    dump_replica_info();
+    
     progError(__LINE__, NDBD_EXIT_NO_RESTORABLE_REPLICA, buf);
     ndbrequire(false);
     return;
@@ -9076,8 +9476,8 @@
     // otherwise we have a problem.
     /* --------------------------------------------------------------------- */
     jam();
-    ndbrequire(senderNodeId == c_nodeStartMaster.startNode);
-    nodeRestartStartRecConfLab(signal);
+    ndbout_c("startNextCopyFragment");
+    startNextCopyFragment(signal, findTakeOver(senderNodeId));
     return;
   } else {
     /* --------------------------------------------------------------------- */
@@ -9437,9 +9837,10 @@
 {
   CRASH_INSERTION(7009);
   if (c_lcpState.lcpStatus != LCP_STATUS_IDLE) {
-    ndbout << "lcpStatus = " << (Uint32) c_lcpState.lcpStatus;
-    ndbout << "lcpStatusUpdatedPlace = " << 
-      c_lcpState.lcpStatusUpdatedPlace << endl;
+    g_eventLogger.error("lcpStatus = %u"
+                        "lcpStatusUpdatedPlace = %d",
+                        (Uint32) c_lcpState.lcpStatus,
+                        c_lcpState.lcpStatusUpdatedPlace);
     ndbrequire(false);
     return;
   }//if
@@ -9578,7 +9979,7 @@
     }//if
     ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
     if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE || 
-	tabPtr.p->storedTable == 0) {
+	tabPtr.p->tabStorage != TabRecord::ST_NORMAL) {
       if (TloopCount > 100) {
         jam();
         signal->theData[0] = DihContinueB::ZCALCULATE_KEEP_GCI;
@@ -9938,12 +10339,42 @@
   Uint32 fragId = lcpReport->fragId;
   
   jamEntry();
+
+  if (ERROR_INSERTED(7178) && nodeId != getOwnNodeId())
+  {
+    jam();
+    Uint32 owng =Sysfile::getNodeGroup(getOwnNodeId(), SYSFILE->nodeGroups);
+    Uint32 nodeg = Sysfile::getNodeGroup(nodeId, SYSFILE->nodeGroups);
+    if (owng == nodeg)
+    {
+      jam();
+      ndbout_c("throwing away LCP_FRAG_REP from  (and killing) %d", nodeId);
+      SET_ERROR_INSERT_VALUE(7179);
+      signal->theData[0] = 9999;
+      sendSignal(numberToRef(CMVMI, nodeId), 
+		 GSN_NDB_TAMPER, signal, 1, JBA);  
+      return;
+    }
+  }
  
+  if (ERROR_INSERTED(7179) && nodeId != getOwnNodeId())
+  {
+    jam();
+    Uint32 owng =Sysfile::getNodeGroup(getOwnNodeId(), SYSFILE->nodeGroups);
+    Uint32 nodeg = Sysfile::getNodeGroup(nodeId, SYSFILE->nodeGroups);
+    if (owng == nodeg)
+    {
+      jam();
+      ndbout_c("throwing away LCP_FRAG_REP from %d", nodeId);
+      return;
+    }
+  }    
+
   CRASH_INSERTION2(7025, isMaster());
   CRASH_INSERTION2(7016, !isMaster());
-
+  
   bool fromTimeQueue = (signal->senderBlockRef() == reference());
-
+  
   TabRecordPtr tabPtr;
   tabPtr.i = tableId;
   ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
@@ -9992,9 +10423,8 @@
 
     if(tabPtr.p->tabStatus == TabRecord::TS_DROPPING){
       jam();
-      ndbout_c("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ",
-	       tableId,
-	       fragId);
+      g_eventLogger.info("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ",
+                         tableId, fragId);
     } else {
       jam();
       /**
@@ -10107,9 +10537,11 @@
 }
 
 void Dbdih::findReplica(ReplicaRecordPtr& replicaPtr, 
-			Fragmentstore* fragPtrP, Uint32 nodeId)
+			Fragmentstore* fragPtrP, 
+			Uint32 nodeId,
+			bool old)
 {
-  replicaPtr.i = fragPtrP->storedReplicas;
+  replicaPtr.i = old ? fragPtrP->oldStoredReplicas : fragPtrP->storedReplicas;
   while(replicaPtr.i != RNIL){
     ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
     if (replicaPtr.p->procNode == nodeId) {
@@ -10122,7 +10554,7 @@
   };
 
 #ifdef VM_TRACE
-  ndbout_c("Fragment Replica(node=%d) not found", nodeId);
+  g_eventLogger.info("Fragment Replica(node=%d) not found", nodeId);
   replicaPtr.i = fragPtrP->oldStoredReplicas;
   while(replicaPtr.i != RNIL){
     ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
@@ -10135,14 +10567,45 @@
     }//if
   };
   if(replicaPtr.i != RNIL){
-    ndbout_c("...But was found in oldStoredReplicas");
+    g_eventLogger.info("...But was found in oldStoredReplicas");
   } else {
-    ndbout_c("...And wasn't found in oldStoredReplicas");
+    g_eventLogger.info("...And wasn't found in oldStoredReplicas");
   }
 #endif
   ndbrequire(false);
 }//Dbdih::findReplica()
 
+
+int
+Dbdih::handle_invalid_lcp_no(const LcpFragRep* rep, 
+			     ReplicaRecordPtr replicaPtr)
+{
+  ndbrequire(!isMaster());
+  Uint32 lcpNo = rep->lcpNo;
+  Uint32 lcpId = rep->lcpId;
+  Uint32 replicaLcpNo = replicaPtr.p->nextLcp;
+  Uint32 prevReplicaLcpNo = prevLcpNo(replicaLcpNo);
+
+  warningEvent("Detected previous node failure of %d during lcp",
+	       rep->nodeId);
+  replicaPtr.p->nextLcp = lcpNo;
+  replicaPtr.p->lcpId[lcpNo] = 0;
+  replicaPtr.p->lcpStatus[lcpNo] = ZINVALID;
+  
+  for (Uint32 i = lcpNo; i != lcpNo; i = nextLcpNo(i))
+  {
+    jam();
+    if (replicaPtr.p->lcpStatus[i] == ZVALID &&
+	replicaPtr.p->lcpId[i] >= lcpId)
+    {
+      ndbout_c("i: %d lcpId: %d", i, replicaPtr.p->lcpId[i]);
+      ndbrequire(false);
+    }
+  }
+
+  return 0;
+}
+
 /**
  * Return true  if table is all fragment replicas have been checkpointed
  *                 to disk (in all LQHs)
@@ -10171,9 +10634,12 @@
   
   ndbrequire(replicaPtr.p->lcpOngoingFlag == true);
   if(lcpNo != replicaPtr.p->nextLcp){
-    ndbout_c("lcpNo = %d replicaPtr.p->nextLcp = %d", 
-	     lcpNo, replicaPtr.p->nextLcp);
-    ndbrequire(false);
+    if (handle_invalid_lcp_no(lcpReport, replicaPtr))
+    {
+      g_eventLogger.error("lcpNo = %d replicaPtr.p->nextLcp = %d",
+                          lcpNo, replicaPtr.p->nextLcp);
+      ndbrequire(false);
+    }
   }
   ndbrequire(lcpNo == replicaPtr.p->nextLcp);
   ndbrequire(lcpNo < MAX_LCP_STORED);
@@ -10207,7 +10673,7 @@
       // Not all fragments in table have been checkpointed.
       /* ----------------------------------------------------------------- */
       if(0)
-	ndbout_c("reportLcpCompletion: fragment %d not ready", fid);
+	g_eventLogger.info("reportLcpCompletion: fragment %d not ready", fid);
       return false;
     }//if
   }//for
@@ -10335,7 +10801,7 @@
   jamEntry();
 
 #if 0
-  ndbout_c("LCP_COMPLETE_REP"); 
+  g_eventLogger.info("LCP_COMPLETE_REP"); 
   printLCP_COMPLETE_REP(stdout, 
 			signal->getDataPtr(),
 			signal->length(), number());
@@ -10421,7 +10887,7 @@
   if(c_lcpMasterTakeOverState.state != LMTOS_IDLE){
     jam();
 #ifdef VM_TRACE
-    ndbout_c("Exiting from allNodesLcpCompletedLab");
+    g_eventLogger.info("Exiting from allNodesLcpCompletedLab");
 #endif
     return;
   }
@@ -10517,6 +10983,14 @@
 /* ------------------------------------------------------------------------- */
 void Dbdih::tableUpdateLab(Signal* signal, TabRecordPtr tabPtr) {
   FileRecordPtr filePtr;
+  if(tabPtr.p->tabStorage == TabRecord::ST_TEMPORARY) {
+    // For temporary tables we do not write to disk. Mark both copies 0 and 1
+    // as done, and go straight to the after-close code.
+    filePtr.i = tabPtr.p->tabFile[1];
+    ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
+    tableCloseLab(signal, filePtr);
+    return;
+  }
   filePtr.i = tabPtr.p->tabFile[0];
   ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
   createFileRw(signal, filePtr);
@@ -10650,14 +11124,14 @@
     
     infoEvent("Detected GCP stop...sending kill to %s", 
 	      c_GCP_SAVEREQ_Counter.getText());
-    ndbout_c("Detected GCP stop...sending kill to %s", 
-	     c_GCP_SAVEREQ_Counter.getText());
+    g_eventLogger.error("Detected GCP stop...sending kill to %s", 
+                        c_GCP_SAVEREQ_Counter.getText());
     return;
   }
   case GCP_SAVE_LQH_FINISHED:
-    ndbout_c("m_copyReason: %d m_waiting: %d",
-	     c_copyGCIMaster.m_copyReason,
-	     c_copyGCIMaster.m_waiting);
+    g_eventLogger.error("m_copyReason: %d m_waiting: %d",
+                        c_copyGCIMaster.m_copyReason,
+                        c_copyGCIMaster.m_waiting);
     break;
   case GCP_READY: // shut up lint
   case GCP_PREPARE_SENT:
@@ -10665,11 +11139,11 @@
     break;
   }
   
-  ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d",
-	   c_copyGCISlave.m_senderData,
-	   c_copyGCISlave.m_senderRef,
-	   c_copyGCISlave.m_copyReason,
-	   c_copyGCISlave.m_expectedNextWord);
+  g_eventLogger.error("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d",
+                      c_copyGCISlave.m_senderData,
+                      c_copyGCISlave.m_senderRef,
+                      c_copyGCISlave.m_copyReason,
+                      c_copyGCISlave.m_expectedNextWord);
 
   FileRecordPtr file0Ptr;
   file0Ptr.i = crestartInfoFile[0];
@@ -11135,6 +11609,7 @@
 {
   ConstPtr<ReplicaRecord> fblFoundReplicaPtr;
   ConstPtr<ReplicaRecord> fblReplicaPtr;
+  LINT_INIT(fblFoundReplicaPtr.p);
   
   /* --------------------------------------------------------------------- */
   /*       WE START WITH ZERO AS FOUND TO ENSURE THAT FIRST HIT WILL BE    */
@@ -11377,6 +11852,7 @@
   cnoHotSpare = 0;
   cnoOfActiveTables = 0;
   cnoOfNodeGroups = 0;
+  c_nextNodeGroup = 0;
   cnoReplicas = 0;
   coldgcp = 0;
   coldGcpId = 0;
@@ -11396,6 +11872,7 @@
   c_newest_restorable_gci = 0;
   cverifyQueueCounter = 0;
   cwaitLcpSr = false;
+  c_nextLogPart = 0;
 
   nodeResetStart();
   c_nodeStartMaster.wait = ZFALSE;
@@ -11403,7 +11880,7 @@
   memset(&sysfileData[0], 0, sizeof(sysfileData));
 
   const ndb_mgm_configuration_iterator * p = 
-    theConfiguration.getOwnConfigIterator();
+    m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
   
   c_lcpState.clcpDelay = 20;
@@ -11482,6 +11959,8 @@
     SYSFILE->takeOver[i] = 0;
   }//for
   Sysfile::setInitialStartOngoing(SYSFILE->systemRestartBits);
+  srand(time(0));
+  globalData.m_restart_seq = SYSFILE->m_restart_seq = 0;
 }//Dbdih::initRestartInfo()
 
 /*--------------------------------------------------------------------*/
@@ -11548,7 +12027,7 @@
   tabPtr.p->kvalue = 0;
   tabPtr.p->hashpointer = (Uint32)-1;
   tabPtr.p->mask = 0;
-  tabPtr.p->storedTable = 1;
+  tabPtr.p->tabStorage = TabRecord::ST_NORMAL;
   tabPtr.p->tabErrorCode = 0;
   tabPtr.p->schemaVersion = (Uint32)-1;
   tabPtr.p->tabRemoveNode = RNIL;
@@ -12232,6 +12711,8 @@
     jam();
     fragPtr.p->distributionKey = TdistKey;
   }//if
+
+  fragPtr.p->m_log_part_id = readPageWord(rf);
 }//Dbdih::readFragment()
 
 Uint32 Dbdih::readPageWord(RWFragment* rf) 
@@ -12872,9 +13353,9 @@
       nodePtr.i = getOwnNodeId();
       ptrAss(nodePtr, nodeRecord);
       ndbrequire(nodePtr.p->activeStatus == Sysfile::NS_Active);
-      ndbout_c("NR: setLcpActiveStatusEnd - m_participatingLQH");
+      g_eventLogger.info("NR: setLcpActiveStatusEnd - m_participatingLQH");
     } else {
-      ndbout_c("NR: setLcpActiveStatusEnd - !m_participatingLQH");
+      g_eventLogger.info("NR: setLcpActiveStatusEnd - !m_participatingLQH");
     }
   }
   
@@ -13328,6 +13809,7 @@
   writePageWord(wf, fragPtr.p->noStoredReplicas);
   writePageWord(wf, fragPtr.p->noOldStoredReplicas);
   writePageWord(wf, fragPtr.p->distributionKey);
+  writePageWord(wf, fragPtr.p->m_log_part_id);
 }//Dbdih::writeFragment()
 
 void Dbdih::writePageWord(RWFragment* wf, Uint32 dataWord)
@@ -13394,7 +13876,7 @@
   signal->theData[0] = filePtr.p->fileRef;
   signal->theData[1] = reference();
   signal->theData[2] = filePtr.i;
-  signal->theData[3] = ZLIST_OF_PAIRS;
+  signal->theData[3] = ZLIST_OF_PAIRS_SYNCH;
   signal->theData[4] = ZVAR_NO_WORD;
   signal->theData[5] = tab->noPages;
   for (Uint32 i = 0; i < tab->noPages; i++) {
@@ -13705,8 +14187,8 @@
   }
 
   if(arg == DumpStateOrd::EnableUndoDelayDataWrite){
-    ndbout << "Dbdih:: delay write of datapages for table = " 
-	   << dumpState->args[1]<< endl;
+    g_eventLogger.info("Dbdih:: delay write of datapages for table = %d", 
+                       dumpState->args[1]);
     // Send this dump to ACC and TUP
     EXECUTE_DIRECT(DBACC, GSN_DUMP_STATE_ORD, signal, 2);
     EXECUTE_DIRECT(DBTUP, GSN_DUMP_STATE_ORD, signal, 2);
@@ -13723,13 +14205,13 @@
   }//if
   if (signal->theData[0] == DumpStateOrd::DihMinTimeBetweenLCP) {
     // Set time between LCP to min value
-    ndbout << "Set time between LCP to min value" << endl;
+    g_eventLogger.info("Set time between LCP to min value");
     c_lcpState.clcpDelay = 0; // TimeBetweenLocalCheckpoints.min
     return;
   }
   if (signal->theData[0] == DumpStateOrd::DihMaxTimeBetweenLCP) {
     // Set time between LCP to max value
-    ndbout << "Set time between LCP to max value" << endl;
+    g_eventLogger.info("Set time between LCP to max value");
     c_lcpState.clcpDelay = 31; // TimeBetweenLocalCheckpoints.max
     return;
   }
@@ -13757,7 +14239,7 @@
     if (signal->getLength() == 1)
     {
       const ndb_mgm_configuration_iterator * p = 
-	theConfiguration.getOwnConfigIterator();
+	m_ctx.m_config.getOwnConfigIterator();
       ndbrequire(p != 0);
       ndb_mgm_get_int_parameter(p, CFG_DB_GCP_INTERVAL, &cgcpDelay);
     }
@@ -13765,7 +14247,7 @@
     {
       cgcpDelay = signal->theData[1];
     }
-    ndbout_c("Setting time between gcp : %d", cgcpDelay);
+    g_eventLogger.info("Setting time between gcp : %d", cgcpDelay);
   }
 
   if (arg == 7021 && signal->getLength() == 2)
@@ -13888,7 +14370,7 @@
 	while(index < count){
 	  if(nodePtr.p->queuedChkpt[index].tableId == tabPtr.i){
 	    jam();
-	    //	    ndbout_c("Unqueuing %d", index);
+	    //	    g_eventLogger.info("Unqueuing %d", index);
 	    
 	    count--;
 	    for(Uint32 i = index; i<count; i++){
@@ -13928,7 +14410,7 @@
       if(checkLcpAllTablesDoneInLqh()){
 	jam();
 	
-	ndbout_c("This is the last table");
+	g_eventLogger.info("This is the last table");
 	
 	/**
 	 * Then check if saving of tab info is done for all tables
@@ -13937,7 +14419,7 @@
 	checkLcpCompletedLab(signal);
 	
 	if(a != c_lcpState.lcpStatus){
-	  ndbout_c("And all tables are written to already written disk");
+	  g_eventLogger.info("And all tables are written to already written disk");
 	}
       }
       break;
@@ -14882,13 +15364,14 @@
   {
     Uint32 masterVersion = getNodeInfo(cmasterNodeId).m_version;
 
-    unsigned int get_major = getMajor(masterVersion);
-    unsigned int get_minor = getMinor(masterVersion);
-    unsigned int get_build = getBuild(masterVersion);
-
-    ndbrequire(get_major == 4 || get_major == 5);
+    const unsigned int get_major = getMajor(masterVersion);
+    const unsigned int get_minor = getMinor(masterVersion);
+    const unsigned int get_build = getBuild(masterVersion);
+    ndbrequire(get_major >= 4);
 
     if (masterVersion < NDBD_DICT_LOCK_VERSION_5 ||
+        masterVersion < NDBD_DICT_LOCK_VERSION_5_1 &&
+          get_major == 5 && get_minor == 1 ||
         ERROR_INSERTED(7176)) {
       jam();
 
@@ -14959,10 +15442,13 @@
   {
     Uint32 masterVersion = getNodeInfo(cmasterNodeId).m_version;
 
-    unsigned int get_major = getMajor(masterVersion);
-    ndbrequire(get_major == 4 || get_major == 5);
+    const unsigned int get_major = getMajor(masterVersion);
+    const unsigned int get_minor = getMinor(masterVersion);
+    ndbrequire(get_major >= 4);
 
     if (masterVersion < NDBD_DICT_LOCK_VERSION_5 ||
+        masterVersion < NDBD_DICT_LOCK_VERSION_5_1 &&
+          get_major == 5 && get_minor == 1 ||
         ERROR_INSERTED(7176)) {
       return;
     }

--- 1.13.19.1/ndb/test/ndbapi/testNodeRestart.cpp	2007-03-20 16:32:16 +01:00
+++ 1.44/storage/ndb/test/ndbapi/testNodeRestart.cpp	2007-03-20 16:32:16 +01:00
@@ -2,8 +2,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; version 2 of the License.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -698,7 +697,10 @@
       do { 
 	int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());
 	if (tmp == -1)
-	  break;
+	{
+	  ctx->stopTest();
+	  return NDBT_OK;
+	}
 	node1 = tmp;
       } while(nodesmask.get(node1));
       
@@ -878,12 +880,18 @@
   HugoOperations hugoOps(*ctx->getTab());
   Ndb* pNdb = GETNDB(step);
   
+  const int masterNode = restarter.getMasterNodeId();
+
   int dump[] = { 7090, 20 } ;
   if (restarter.dumpStateAllNodes(dump, 2))
     return NDBT_FAILED;
   
   NdbSleep_MilliSleep(3000);
-
+  Vector<int> nodes;
+  for (Uint32 i = 0; i<restarter.getNumDbNodes(); i++)
+    nodes.push_back(restarter.getDbNodeId(i));
+  
+retry:
   if(hugoOps.startTransaction(pNdb) != 0)
     return NDBT_FAILED;
   
@@ -893,17 +901,28 @@
   if (hugoOps.execute_NoCommit(pNdb) != 0)
     return NDBT_FAILED;
   
-  int nodeId;
   const int node = hugoOps.getTransaction()->getConnectedNodeId();
+  if (node != masterNode)
+  {
+    hugoOps.closeTransaction(pNdb);
+    goto retry;
+  } 
+  
+  int nodeId;
   do {
     nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
   } while (nodeId == node);
   
-  if (restarter.insertErrorInAllNodes(7030))
-    return NDBT_FAILED;
-  
+  ndbout_c("7031 to %d", nodeId);
   if (restarter.insertErrorInNode(nodeId, 7031))
     return NDBT_FAILED;
+
+  for (Uint32 i = 0; i<nodes.size(); i++)
+  {
+    if (nodes[i] != nodeId)
+      if (restarter.insertErrorInNode(nodes[i], 7030))
+	return NDBT_FAILED;
+  }
   
   NdbSleep_MilliSleep(500);
   
@@ -991,7 +1010,129 @@
     if (restarter.waitNodesStarted(nodes, 2))
       return NDBT_FAILED;
   }
+
+  return NDBT_OK;
+}
+  
+int 
+runBug21271(NDBT_Context* ctx, NDBT_Step* step){
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int records = ctx->getNumRecords();
+  NdbRestarter restarter;
+  HugoOperations hugoOps(*ctx->getTab());
+  Ndb* pNdb = GETNDB(step);
+  
+  const int masterNode = restarter.getMasterNodeId();
+  const int nodeId = restarter.getRandomNodeSameNodeGroup(masterNode, rand());
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+  if (restarter.dumpStateOneNode(nodeId, val2, 2))
+    return NDBT_FAILED;
+  
+  Uint32 tableId = ctx->getTab()->getTableId();
+  int dump[] = { DumpStateOrd::LqhErrorInsert5042, 0, 5044 };
+  dump[1] = tableId;
+
+  if (restarter.dumpStateOneNode(nodeId, dump, 3))
+    return NDBT_FAILED;
+  
+  restarter.waitNodesNoStart(&nodeId, 1);
+  ctx->stopTest();
+
+  restarter.startNodes(&nodeId, 1);
+
+  if (restarter.waitClusterStarted() != 0)
+    return NDBT_FAILED;
+
+  return NDBT_OK;
+  return NDBT_OK;
+}
+
+int 
+runBug24543(NDBT_Context* ctx, NDBT_Step* step){
+  NdbRestarter restarter;
+  
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+  if (restarter.dumpStateAllNodes(val2, 2))
+    return NDBT_FAILED;
+
+  int nodes[2];
+  nodes[0] = restarter.getMasterNodeId();
+  restarter.insertErrorInNode(nodes[0], 934);
+
+  nodes[1] = restarter.getRandomNodeOtherNodeGroup(nodes[0], rand());
+  if (nodes[1] == -1)
+  {
+    nodes[1] = restarter.getRandomNodeSameNodeGroup(nodes[0], rand());
+  }
+  
+  restarter.restartOneDbNode(nodes[1], false, true, true);
+  if (restarter.waitNodesNoStart(nodes, 2))
+    return NDBT_FAILED;
+  
+  restarter.startNodes(nodes, 2);
+  if (restarter.waitNodesStarted(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  return NDBT_OK;
+}
+
+int runBug25468(NDBT_Context* ctx, NDBT_Step* step){
+  
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int records = ctx->getNumRecords();
+  NdbRestarter restarter;
+  
+  for (int i = 0; i<loops; i++)
+  {
+    int master = restarter.getMasterNodeId();
+    int node1, node2;
+    switch(i % 5){
+    case 0:
+      node1 = master;
+      node2 = restarter.getRandomNodeSameNodeGroup(master, rand());
+      break;
+    case 1:
+      node1 = restarter.getRandomNodeSameNodeGroup(master, rand());
+      node2 = master;
+      break;
+    case 2:
+    case 3:
+    case 4:
+      node1 = restarter.getRandomNodeOtherNodeGroup(master, rand());
+      if (node1 == -1)
+	node1 = master;
+      node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
+      break;
+    }
+
+    ndbout_c("node1: %d node2: %d master: %d", node1, node2, master);
+
+    int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
   
+    if (restarter.dumpStateOneNode(node2, val2, 2))
+      return NDBT_FAILED;
+
+    if (restarter.insertErrorInNode(node1, 7178))
+      return NDBT_FAILED;
+
+    int val1 = 7099;
+    if (restarter.dumpStateOneNode(master, &val1, 1))
+      return NDBT_FAILED;
+
+    if (restarter.waitNodesNoStart(&node2, 1))
+      return NDBT_FAILED;
+
+    if (restarter.startAll())
+      return NDBT_FAILED;
+
+    if (restarter.waitClusterStarted())
+      return NDBT_FAILED;
+  }
+
   return NDBT_OK;
 }
 
@@ -1125,6 +1266,68 @@
   return NDBT_OK;
 }
 
+int 
+runBug26450(NDBT_Context* ctx, NDBT_Step* step)
+{
+  Uint32 i;
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int records = ctx->getNumRecords();
+  NdbRestarter res;
+  Ndb* pNdb = GETNDB(step);
+  
+  int node = res.getRandomNotMasterNodeId(rand());
+  Vector<int> nodes;
+  for (unsigned i = 0; i<res.getNumDbNodes(); i++)
+  {
+    if (res.getDbNodeId(i) != node)
+      nodes.push_back(res.getDbNodeId(i));
+  }
+  
+  if (res.restartAll())
+    return NDBT_FAILED;
+
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  ndbout_c("node: %d", node);
+  if (res.restartOneDbNode(node, false, true, true))
+    return NDBT_FAILED;
+  
+  if (res.waitNodesNoStart(&node, 1))
+    return NDBT_FAILED;
+
+  if (runClearTable(ctx, step))
+    return NDBT_FAILED;
+
+  for (i = 0; i < 2; i++)
+  {
+    if (res.restartAll(false, true, i > 0))
+      return NDBT_FAILED;
+    
+    if (res.waitClusterNoStart())
+      return NDBT_FAILED;
+    
+    if (res.startNodes(nodes.getBase(), nodes.size()))
+      return NDBT_FAILED;
+
+    if (res.waitNodesStarted(nodes.getBase(), nodes.size()))
+      return NDBT_FAILED;
+  }
+
+  if (res.startNodes(&node, 1))
+    return NDBT_FAILED;
+
+  if (res.waitNodesStarted(&node, 1))
+    return NDBT_FAILED;
+
+  HugoTransactions trans (* ctx->getTab());
+  if (trans.selectCount(pNdb) != 0)
+    return NDBT_FAILED;
+
+  return NDBT_OK;
+}
+
 int
 runBug27003(NDBT_Context* ctx, NDBT_Step* step)
 {
@@ -1137,7 +1340,7 @@
 
   int node = res.getRandomNotMasterNodeId(rand());
   ndbout_c("node: %d", node);
-  if (res.restartOneDbNode(node, false, true, true))
+  if (res.restartOneDbNode(node, true, true, true))
     return NDBT_FAILED;
 
   Uint32 pos = 0;
@@ -1156,7 +1359,7 @@
       if (res.insertErrorInNode(node, errnos[pos]))
 	return NDBT_FAILED;
       
-      int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+      int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 3 };
       if (res.dumpStateOneNode(node, val2, 2))
 	return NDBT_FAILED;
       
@@ -1532,12 +1735,26 @@
   STEP(runBug20185);
   FINALIZER(runClearTable);
 }
+TESTCASE("Bug24543", "")
+{
+  INITIALIZER(runBug24543);
+}
+TESTCASE("Bug21271",
+	 ""){
+  INITIALIZER(runLoadTable);
+  STEP(runBug21271);
+  STEP(runPkUpdateUntilStopped);
+  FINALIZER(runClearTable);
+}
 TESTCASE("Bug24717", ""){
   INITIALIZER(runBug24717);
 }
 TESTCASE("Bug25364", ""){
   INITIALIZER(runBug25364);
 }
+TESTCASE("Bug25468", ""){
+  INITIALIZER(runBug25468);
+}
 TESTCASE("Bug25554", ""){
   INITIALIZER(runBug25554);
 }
@@ -1546,6 +1763,10 @@
 }
 TESTCASE("Bug26481", ""){
   INITIALIZER(runBug26481);
+}
+TESTCASE("Bug26450", ""){
+  INITIALIZER(runLoadTable);
+  INITIALIZER(runBug26450);
 }
 TESTCASE("Bug27003", ""){
   INITIALIZER(runBug27003);
Thread
bk commit into 5.1 tree (jonas:1.2442)jonas20 Mar