mirror of https://gitee.com/bigwinds/arangodb
fix a rare recovery error, add diagnostic output (#8931)
This commit is contained in:
parent
1ae5f8daec
commit
445d020bac
|
@ -1196,6 +1196,9 @@ MMFilesDatafile* MMFilesCollection::createDatafile(TRI_voc_fid_t fid, uint32_t j
|
|||
std::string jname("journal-" + std::to_string(datafile->fid()) + ".db");
|
||||
std::string filename = arangodb::basics::FileUtils::buildFilename(path(), jname);
|
||||
|
||||
LOG_TOPIC("3e87e", TRACE, arangodb::Logger::DATAFILES)
|
||||
<< "renaming journal '" << datafile->getName() << "' to '" << filename << "'";
|
||||
|
||||
int res = datafile->rename(filename);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -345,6 +345,11 @@ MMFilesRenameDatafileDitch* MMFilesDitches::createMMFilesRenameDatafileDitch(
|
|||
try {
|
||||
auto ditch = new MMFilesRenameDatafileDitch(this, datafile, compactor, collection,
|
||||
callback, filename, line);
|
||||
TRI_IF_FAILURE("no-rename-datafile") {
|
||||
// exit prematurely
|
||||
return ditch;
|
||||
}
|
||||
|
||||
link(ditch);
|
||||
|
||||
return ditch;
|
||||
|
|
|
@ -2784,6 +2784,9 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase,
|
|||
next.erase(next.begin());
|
||||
std::string qualifier = StringUtils::join(next, '-');
|
||||
|
||||
LOG_TOPIC("1b99a", TRACE, Logger::DATAFILES)
|
||||
<< "found file '" << file << "', filetype: " << filetype << ", size: " << TRI_SizeFile(filename.c_str());
|
||||
|
||||
// .............................................................................
|
||||
// file is dead
|
||||
// .............................................................................
|
||||
|
@ -2812,10 +2815,13 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase,
|
|||
|
||||
// found a compaction file. now rename it back
|
||||
if (filetype == "compaction") {
|
||||
std::string relName = "datafile-" + qualifier + "." + extension;
|
||||
std::string newName = FileUtils::buildFilename(physical->path(), relName);
|
||||
std::string relNameDatafile = "datafile-" + qualifier + "." + extension;
|
||||
std::string newName = FileUtils::buildFilename(physical->path(), relNameDatafile);
|
||||
|
||||
if (FileUtils::exists(newName)) {
|
||||
std::string relNameJournal = "journal-" + qualifier + "." + extension;
|
||||
std::string nameJournal = FileUtils::buildFilename(physical->path(), relNameJournal);
|
||||
|
||||
if (FileUtils::exists(newName) || FileUtils::exists(nameJournal)) {
|
||||
// we have a compaction-xxxx and a datafile-xxxx file. we'll keep
|
||||
// the datafile
|
||||
FileUtils::remove(filename);
|
||||
|
|
Loading…
Reference in New Issue