From 0890735c7a96d7dc425f1281ab3ca04a9ad7314d Mon Sep 17 00:00:00 2001
From: unknown <jonas@perch.ndb.mysql.com>
Date: Thu, 6 Jul 2006 09:38:18 +0200
Subject: [PATCH 1/3] ndb - revert bug fix for bug#20442

---
 ndb/src/ndbapi/NdbScanOperation.cpp | 60 -----------------------------
 1 file changed, 60 deletions(-)

diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index 6b587be688f..f14b5409ce8 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -1503,66 +1503,6 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
     return -1;
   }
   
-  bool holdLock = false;
-  if (theSCAN_TABREQ)
-  {
-    ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
-    holdLock = ScanTabReq::getHoldLockFlag(req->requestInfo);
-  }
-
-  /**
-   * When using locks, force close of scan directly
-   */
-  if (holdLock && theError.code == 0 && 
-      (m_sent_receivers_count + m_conf_receivers_count + m_api_receivers_count))
-  {
-    TransporterFacade * tp = TransporterFacade::instance();
-    NdbApiSignal tSignal(theNdb->theMyRef);
-    tSignal.setSignal(GSN_SCAN_NEXTREQ);
-    
-    Uint32* theData = tSignal.getDataPtrSend();
-    Uint64 transId = theNdbCon->theTransactionId;
-    theData[0] = theNdbCon->theTCConPtr;
-    theData[1] = 1;
-    theData[2] = transId;
-    theData[3] = (Uint32) (transId >> 32);
-
-    tSignal.setLength(4);
-    int ret = tp->sendSignal(&tSignal, nodeId);
-    if (ret)
-    {
-      setErrorCode(4008);
-      return -1;
-    }
-    checkForceSend(forceSend);
-
-    /**
-     * If no receiver is outstanding...
-     *   set it to 1 as execCLOSE_SCAN_REP resets it
-     */
-    m_sent_receivers_count = m_sent_receivers_count ? m_sent_receivers_count : 1;
-    
-    while(theError.code == 0 && (m_sent_receivers_count + m_conf_receivers_count))
-    {
-      theNdb->theImpl->theWaiter.m_node = nodeId;
-      theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
-      int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
-      switch(return_code){
-      case 0:
-	break;
-      case -1:
-	setErrorCode(4008);
-      case -2:
-	m_api_receivers_count = 0;
-	m_conf_receivers_count = 0;
-	m_sent_receivers_count = 0;
-	theNdbCon->theReleaseOnClose = true;
-	return -1;
-      }
-    }
-    return 0;
-  }
-  
   /**
    * Wait for outstanding
    */

From c66b8fccf0502db46638605853298b4ae37e8395 Mon Sep 17 00:00:00 2001
From: unknown <jonas@perch.ndb.mysql.com>
Date: Thu, 6 Jul 2006 15:51:35 +0200
Subject: [PATCH 2/3] ndb - bug#20860   Better error message when failing to
 read either of 2 DIH schema files

ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Better error message when failing to read either of 2 DIH schema files
---
 ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index 3ebad7f0cd2..92cc0d429fc 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -8209,11 +8209,20 @@ void Dbdih::openingTableErrorLab(Signal* signal, FileRecordPtr filePtr)
   /*    WE FAILED IN OPENING A FILE. IF THE FIRST FILE THEN TRY WITH THE    */
   /*    DUPLICATE FILE, OTHERWISE WE REPORT AN ERROR IN THE SYSTEM RESTART. */
   /* ---------------------------------------------------------------------- */
-  ndbrequire(filePtr.i == tabPtr.p->tabFile[0]);
-  filePtr.i = tabPtr.p->tabFile[1];
-  ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
-  openFileRw(signal, filePtr);
-  filePtr.p->reqStatus = FileRecord::OPENING_TABLE;
+  if (filePtr.i == tabPtr.p->tabFile[0])
+  {
+    filePtr.i = tabPtr.p->tabFile[1];
+    ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
+    openFileRw(signal, filePtr);
+    filePtr.p->reqStatus = FileRecord::OPENING_TABLE;
+  }
+  else
+  {
+    char buf[256];
+    BaseString::snprintf(buf, "Error opening DIH schema files for table: %d",
+			 tabPtr.i);
+    progError(__LINE__, NDBD_EXIT_AFS_NO_SUCH_FILE, buf);
+  }
 }//Dbdih::openingTableErrorLab()
 
 void Dbdih::readingTableLab(Signal* signal, FileRecordPtr filePtr) 

From 31e3e753042bf6e51fc26d38fa5eb6794e7ebccd Mon Sep 17 00:00:00 2001
From: unknown <jonas@perch.ndb.mysql.com>
Date: Fri, 7 Jul 2006 16:01:35 +0200
Subject: [PATCH 3/3] ndb - bug#20904   Reset logpartstate if
 file_change_problem after writeing of zero page is done

---
 ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index 42e38b41b4b..e4289715c38 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -12508,6 +12508,20 @@ void Dblqh::lastWriteInFileLab(Signal* signal)
 
 void Dblqh::writePageZeroLab(Signal* signal) 
 {
+  if (logPartPtr.p->logPartState == LogPartRecord::FILE_CHANGE_PROBLEM) 
+  {
+    if (logPartPtr.p->firstLogQueue == RNIL) 
+    {
+      jam();
+      logPartPtr.p->logPartState = LogPartRecord::IDLE;
+    } 
+    else 
+    {
+      jam();
+      logPartPtr.p->logPartState = LogPartRecord::ACTIVE;
+    }
+  }
+  
   logFilePtr.p->fileChangeState = LogFileRecord::NOT_ONGOING;
 /*---------------------------------------------------------------------------*/
 /* IT COULD HAVE ARRIVED PAGE WRITES TO THE CURRENT FILE WHILE WE WERE       */