1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4566 Fixes after review.

Added:
1. More output logs.
2. Save EM to file after rebuilding.
This commit is contained in:
Denis Khalikov
2021-08-27 13:35:50 +03:00
committed by Denis Khalikov
parent 5c5f103f98
commit a591de666f
2 changed files with 12 additions and 17 deletions

View File

@ -89,8 +89,7 @@ int main(int argc, char** argv)
std::cout << "The launch of mcsRebuildEM tool must be sanctioned by MariaDB support. " std::cout << "The launch of mcsRebuildEM tool must be sanctioned by MariaDB support. "
<< std::endl; << std::endl;
std::cout << "Requirement: all DBRoots must be on this node. " << std::endl; std::cout << "Requirement: all DBRoots must be on this node. " << std::endl;
std::cout << "Note: that the launch can break the cluster." << std::endl; std::cout << "Do you want to continue Y/N? ";
std::cout << "Do you want to continue Y/N? " << std::endl;
std::string confirmation; std::string confirmation;
cin >> confirmation; cin >> confirmation;
if (confirmation.size() == 0) if (confirmation.size() == 0)
@ -124,6 +123,7 @@ int main(int argc, char** argv)
std::cout << "If `BRM_saves_em` " std::cout << "If `BRM_saves_em` "
"exists extent map will be restored from it. " "exists extent map will be restored from it. "
<< std::endl; << std::endl;
std::cout << "Exiting. " << std::endl;
return 0; return 0;
} }
@ -131,6 +131,8 @@ int main(int argc, char** argv)
auto rc = emReBuilder.initializeSystemExtents(); auto rc = emReBuilder.initializeSystemExtents();
if (rc == -1) if (rc == -1)
{ {
std::cerr << "Cannot initialize system extents from binary blob." << std::endl;
std::cerr << "Exiting. " << std::endl;
return 1; return 1;
} }
@ -151,5 +153,8 @@ int main(int argc, char** argv)
emReBuilder.clear(); emReBuilder.clear();
} }
// Save restored extent map.
emReBuilder.getEM().save(BRMSavesEM);
std::cout << "Completed." << std::endl;
return 0; return 0;
} }

View File

@ -65,9 +65,7 @@ int32_t EMReBuilder::collectExtent(const std::string& fullFileName)
auto rc = WriteEngine::Convertor::fileName2Oid(fullFileName, oid, auto rc = WriteEngine::Convertor::fileName2Oid(fullFileName, oid,
partition, segment); partition, segment);
if (rc != 0) if (rc != 0)
{
return rc; return rc;
}
// Open the given file. // Open the given file.
std::unique_ptr<IDBDataFile> dbFile(IDBDataFile::open( std::unique_ptr<IDBDataFile> dbFile(IDBDataFile::open(
@ -97,12 +95,11 @@ int32_t EMReBuilder::collectExtent(const std::string& fullFileName)
// have a header block, so header verification fails in this case, // have a header block, so header verification fails in this case,
// currently we skip it, because we cannot deduce needed data to create // currently we skip it, because we cannot deduce needed data to create
// a column extent from the blob file. // a column extent from the blob file.
if (doVerbose()) // Skip fileID from system catalog.
if (doVerbose() && oid > 3000)
{ {
std::cerr std::cerr << "Cannot read file header from the file " << fullFileName
<< "Cannot read file header from the file " << fullFileName << ", probably this file was created without compression. " << std::endl;
<< ", probably this file was created without compression. "
<< std::endl;
} }
return rc; return rc;
} }
@ -138,9 +135,8 @@ int32_t EMReBuilder::collectExtent(const std::string& fullFileName)
if (colDataType == execplan::CalpontSystemCatalog::UNDEFINED) if (colDataType == execplan::CalpontSystemCatalog::UNDEFINED)
{ {
if (doVerbose()) if (doVerbose())
{
std::cout << "File header has invalid data. " << std::endl; std::cout << "File header has invalid data. " << std::endl;
}
return -1; return -1;
} }
@ -158,14 +154,10 @@ int32_t EMReBuilder::collectExtent(const std::string& fullFileName)
rc = searchHWMInSegmentFile(oid, getDBRoot(), partition, segment, colDataType, colWidth, rc = searchHWMInSegmentFile(oid, getDBRoot(), partition, segment, colDataType, colWidth,
blockCount, isDict, compressionType, hwm); blockCount, isDict, compressionType, hwm);
if (rc != 0) if (rc != 0)
{
return rc; return rc;
}
if (doVerbose()) if (doVerbose())
{
std::cout << "HWM is: " << hwm << std::endl; std::cout << "HWM is: " << hwm << std::endl;
}
const uint32_t extentMaxBlockCount = getEM().getExtentRows() * colWidth / BLOCK_SIZE; const uint32_t extentMaxBlockCount = getEM().getExtentRows() * colWidth / BLOCK_SIZE;
// We found multiple extents per one segment file. // We found multiple extents per one segment file.
@ -198,9 +190,7 @@ int32_t EMReBuilder::collectExtent(const std::string& fullFileName)
extentMap.push_back(fileId); extentMap.push_back(fileId);
if (doVerbose()) if (doVerbose())
{
std::cout << "FileId is collected " << fileId << std::endl; std::cout << "FileId is collected " << fileId << std::endl;
}
} }
return 0; return 0;