mirror of https://gitee.com/bigwinds/arangodb
better error reporting
This commit is contained in:
parent
1132d0820e
commit
818ffbdc49
|
@ -1758,6 +1758,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
std::vector<TRI_datafile_t*> journals;
|
||||
std::vector<TRI_datafile_t*> sealed;
|
||||
bool stop = false;
|
||||
int result = TRI_ERROR_NO_ERROR;
|
||||
|
||||
TRI_ASSERT(collection->cid() != 0);
|
||||
|
||||
|
@ -1842,6 +1843,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
LOG_TOPIC(ERR, Logger::DATAFILES)
|
||||
<< "unable to rename compaction file '" << filename << "' to '"
|
||||
<< newName << "'";
|
||||
result = res;
|
||||
stop = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1851,6 +1853,8 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
filename = newName;
|
||||
}
|
||||
|
||||
TRI_set_errno(TRI_ERROR_NO_ERROR);
|
||||
|
||||
std::unique_ptr<TRI_datafile_t> df(TRI_datafile_t::open(filename, ignoreErrors));
|
||||
|
||||
if (df == nullptr) {
|
||||
|
@ -1858,6 +1862,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
<< filename
|
||||
<< "': " << TRI_last_error();
|
||||
|
||||
result = TRI_errno();
|
||||
stop = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1878,7 +1883,8 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
LOG(ERR) << "collection header mismatch in file '" << filename
|
||||
<< "', expected TRI_DF_MARKER_COL_HEADER, found "
|
||||
<< cm->base.getType();
|
||||
|
||||
|
||||
result = TRI_ERROR_ARANGO_CORRUPTED_DATAFILE;
|
||||
stop = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1887,6 +1893,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
LOG(ERR) << "collection identifier mismatch, expected "
|
||||
<< collection->cid() << ", found " << cm->_cid;
|
||||
|
||||
result = TRI_ERROR_ARANGO_CORRUPTED_DATAFILE;
|
||||
stop = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1918,6 +1925,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
LOG_TOPIC(ERR, Logger::DATAFILES)
|
||||
<< "datafile '" << filename
|
||||
<< "' is not sealed, this should never happen";
|
||||
result = TRI_ERROR_ARANGO_CORRUPTED_DATAFILE;
|
||||
stop = true;
|
||||
break;
|
||||
} else {
|
||||
|
@ -1946,6 +1954,7 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
datafiles.emplace_back(datafile);
|
||||
LOG(DEBUG) << "renamed sealed journal to '" << filename << "'";
|
||||
} else {
|
||||
result = res;
|
||||
stop = true;
|
||||
LOG(ERR) << "cannot rename sealed log-file to " << filename
|
||||
<< ", this should not happen: " << TRI_errno_string(res);
|
||||
|
@ -1961,6 +1970,9 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
|||
delete datafile;
|
||||
}
|
||||
|
||||
if (result != TRI_ERROR_NO_ERROR) {
|
||||
return result;
|
||||
}
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1316,35 +1316,37 @@ bool TRI_datafile_t::check(bool ignoreFailures) {
|
|||
}
|
||||
}
|
||||
|
||||
if (ignoreFailures) {
|
||||
return fix(currentSize);
|
||||
if (!ignoreFailures) {
|
||||
_lastError = TRI_set_errno(TRI_ERROR_ARANGO_CORRUPTED_DATAFILE);
|
||||
_currentSize = currentSize;
|
||||
_next = _data + _currentSize;
|
||||
_state = TRI_DF_STATE_OPEN_ERROR;
|
||||
|
||||
LOG(WARN) << "crc mismatch found in datafile '" << getName() << "' of size "
|
||||
<< _maximalSize << ", at position " << currentSize;
|
||||
|
||||
LOG(WARN) << "crc mismatch found inside marker of type '" << TRI_NameMarkerDatafile(marker)
|
||||
<< "' and size " << size
|
||||
<< ". expected crc: " << CalculateCrcValue(marker) << ", actual crc: " << marker->getCrc();
|
||||
|
||||
if (lastGood != nullptr) {
|
||||
LOG(INFO) << "last good marker found at: " << hexValue(static_cast<uint64_t>(static_cast<uintptr_t>(lastGood - _data)));
|
||||
}
|
||||
printMarker(marker, size, _data, end);
|
||||
|
||||
if (nextMarkerOk) {
|
||||
LOG(INFO) << "data directly following this marker looks ok so repairing the marker manually may recover it...";
|
||||
LOG(INFO) << "to truncate the file at this marker, please restart the server with the parameter '--wal.ignore-logfile-errors true' if the error happening during WAL recovery, or with parameter '--database.ignore-datafile-errors true' if it happened after WAL recovery";
|
||||
} else {
|
||||
LOG(WARN) << "data directly following this marker cannot be analyzed";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_lastError = TRI_set_errno(TRI_ERROR_ARANGO_CORRUPTED_DATAFILE);
|
||||
_currentSize = currentSize;
|
||||
_next = _data + _currentSize;
|
||||
_state = TRI_DF_STATE_OPEN_ERROR;
|
||||
|
||||
LOG(WARN) << "crc mismatch found in datafile '" << getName() << "' of size "
|
||||
<< _maximalSize << ", at position " << currentSize;
|
||||
|
||||
LOG(WARN) << "crc mismatch found inside marker of type '" << TRI_NameMarkerDatafile(marker)
|
||||
<< "' and size " << size
|
||||
<< ". expected crc: " << CalculateCrcValue(marker) << ", actual crc: " << marker->getCrc();
|
||||
|
||||
if (lastGood != nullptr) {
|
||||
LOG(INFO) << "last good marker found at: " << hexValue(static_cast<uint64_t>(static_cast<uintptr_t>(lastGood - _data)));
|
||||
}
|
||||
printMarker(marker, size, _data, end);
|
||||
|
||||
if (nextMarkerOk) {
|
||||
LOG(INFO) << "data directly following this marker looks ok so repairing the marker may recover it";
|
||||
LOG(INFO) << "please restart the server with the parameter '--wal.ignore-logfile-errors true' to repair the marker";
|
||||
} else {
|
||||
LOG(WARN) << "data directly following this marker cannot be analyzed";
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
// ignore failures...
|
||||
// truncate
|
||||
return fix(currentSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue