diff options
author | joreland@mysql.com <> | 2005-06-08 16:55:06 +0200 |
---|---|---|
committer | joreland@mysql.com <> | 2005-06-08 16:55:06 +0200 |
commit | 7bcc81c87b52a44371660d333f9f5682173f5187 (patch) | |
tree | 76cc090a86aec7dcae3a4d44cc449a1e3bb0cc22 /ndb/tools | |
parent | 730c3a260f0b51fe51c05c40b3dad86140618cab (diff) | |
parent | dc78a77206cfd810c8812fd09a562241c89e6848 (diff) | |
download | mariadb-git-7bcc81c87b52a44371660d333f9f5682173f5187.tar.gz |
Merge mysql.com:/home/jonas/src/mysql-4.1
into mysql.com:/home/jonas/src/mysql-5.0
Diffstat (limited to 'ndb/tools')
-rw-r--r-- | ndb/tools/restore/Restore.cpp | 8 | ||||
-rw-r--r-- | ndb/tools/restore/Restore.hpp | 1 | ||||
-rw-r--r-- | ndb/tools/restore/consumer_restore.cpp | 36 |
3 files changed, 36 insertions, 9 deletions
diff --git a/ndb/tools/restore/Restore.cpp b/ndb/tools/restore/Restore.cpp index 81a8d4aba41..b53255820db 100644 --- a/ndb/tools/restore/Restore.cpp +++ b/ndb/tools/restore/Restore.cpp @@ -765,6 +765,7 @@ RestoreLogIterator::RestoreLogIterator(const RestoreMetaData & md) setLogFile(md, 0); m_count = 0; + m_last_gci = 0; } const LogEntry * @@ -772,7 +773,6 @@ RestoreLogIterator::getNextLogEntry(int & res) { // Read record length typedef BackupFormat::LogFile::LogEntry LogE; - Uint32 gcp= 0; LogE * logE= 0; Uint32 len= ~0; const Uint32 stopGCP = m_metaData.getStopGCP(); @@ -802,10 +802,10 @@ RestoreLogIterator::getNextLogEntry(int & res) { if(hasGcp){ len--; - gcp = ntohl(logE->Data[len-2]); + m_last_gci = ntohl(logE->Data[len-2]); } - } while(gcp > stopGCP + 1); - + } while(m_last_gci > stopGCP + 1); + m_logEntry.m_table = m_metaData.getTable(logE->TableId); switch(logE->TriggerEvent){ case TriggerEvent::TE_INSERT: diff --git a/ndb/tools/restore/Restore.hpp b/ndb/tools/restore/Restore.hpp index d7f6e3b7799..85793baf9df 100644 --- a/ndb/tools/restore/Restore.hpp +++ b/ndb/tools/restore/Restore.hpp @@ -361,6 +361,7 @@ private: const RestoreMetaData & m_metaData; Uint32 m_count; + Uint32 m_last_gci; LogEntry m_logEntry; public: RestoreLogIterator(const RestoreMetaData &); diff --git a/ndb/tools/restore/consumer_restore.cpp b/ndb/tools/restore/consumer_restore.cpp index d72b82569e2..b20f9fd3204 100644 --- a/ndb/tools/restore/consumer_restore.cpp +++ b/ndb/tools/restore/consumer_restore.cpp @@ -526,7 +526,14 @@ BackupRestore::logEntry(const LogEntry & tup) << " Exiting..."; exit(-1); } + + if (check != 0) + { + err << "Error defining op: " << trans->getNdbError() << endl; + exit(-1); + } // if + Bitmask<4096> keys; for (Uint32 i= 0; i < tup.size(); i++) { const AttributeS * attr = tup[i]; @@ -539,9 +546,21 @@ BackupRestore::logEntry(const LogEntry & tup) const Uint32 length = (size / 8) * arraySize; if (attr->Desc->m_column->getPrimaryKey()) - op->equal(attr->Desc->attrId, dataPtr, length); + { + if(!keys.get(attr->Desc->attrId)) + { + keys.set(attr->Desc->attrId); + check= op->equal(attr->Desc->attrId, dataPtr, length); + } + } else - op->setValue(attr->Desc->attrId, dataPtr, length); + check= op->setValue(attr->Desc->attrId, dataPtr, length); + + if (check != 0) + { + err << "Error defining op: " << trans->getNdbError() << endl; + exit(-1); + } // if } const int ret = trans->execute(NdbTransaction::Commit); @@ -550,18 +569,25 @@ BackupRestore::logEntry(const LogEntry & tup) // Both insert update and delete can fail during log running // and it's ok // TODO: check that the error is either tuple exists or tuple does not exist? + bool ok= false; + NdbError errobj= trans->getNdbError(); switch(tup.m_type) { case LogEntry::LE_INSERT: + if(errobj.status == NdbError::PermanentError && + errobj.classification == NdbError::ConstraintViolation) + ok= true; break; case LogEntry::LE_UPDATE: - break; case LogEntry::LE_DELETE: + if(errobj.status == NdbError::PermanentError && + errobj.classification == NdbError::NoDataFound) + ok= true; break; } - if (false) + if (!ok) { - err << "execute failed: " << trans->getNdbError() << endl; + err << "execute failed: " << errobj << endl; exit(-1); } } |