1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-17 01:02:23 +03:00

Update Metadata and Replicator to use configure file paths. Update unit_tests to work and cleanup as expected.

This commit is contained in:
Ben Thompson
2019-03-26 17:24:03 -05:00
parent c5e04a1a6f
commit c1a33111f6
6 changed files with 99 additions and 15 deletions

View File

@@ -26,6 +26,32 @@ namespace storagemanager
Replicator::Replicator()
{
mpConfig = Config::get();
mpLogger = SMLogging::get();
try
{
msJournalPath = mpConfig->getValue("ObjectStorage", "journal_path");
if (msJournalPath.empty())
{
mpLogger->log(LOG_CRIT, "ObjectStorage/journal_path is not set");
throw runtime_error("Please set ObjectStorage/journal_path in the storagemanager.cnf file");
}
}
catch (...)
{
mpLogger->log(LOG_CRIT, "Could not load metadata_path from storagemanger.cnf file.");
throw runtime_error("Please set ObjectStorage/metadata_path in the storagemanager.cnf file");
}
boost::filesystem::create_directories(msJournalPath);
try
{
boost::filesystem::create_directories(msJournalPath);
}
catch (exception &e)
{
syslog(LOG_CRIT, "Failed to create %s, got: %s", msJournalPath.c_str(), e.what());
throw e;
}
}
Replicator::~Replicator()
@@ -84,7 +110,7 @@ int Replicator::addJournalEntry(const char *filename, const uint8_t *data, off_t
uint64_t offlen[] = {offset,length};
size_t count = 0;
int version = 1;
string journalFilename = string(filename) + ".journal";
string journalFilename = msJournalPath + "/" + string(filename) + ".journal";
uint64_t thisEntryMaxOffset = (offset + length - 1);
if (!boost::filesystem::exists(journalFilename))
{