You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-10 22:42:30 +03:00
add Replicator KPIs
This commit is contained in:
@@ -69,6 +69,7 @@ Replicator::Replicator()
|
|||||||
mpLogger->log(LOG_CRIT, "Failed to create %s, got: %s", msCachePath.c_str(), e.what());
|
mpLogger->log(LOG_CRIT, "Failed to create %s, got: %s", msCachePath.c_str(), e.what());
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
repUserDataWritten = repHeaderDataWritten = replicatorObjectsCreated = replicatorJournalsCreated = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Replicator::~Replicator()
|
Replicator::~Replicator()
|
||||||
@@ -86,6 +87,16 @@ Replicator * Replicator::get()
|
|||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Replicator::printKPIs() const
|
||||||
|
{
|
||||||
|
cout << "Replicator" << endl;
|
||||||
|
cout << "\treplicatorUserDataWritten = " << repUserDataWritten << endl;
|
||||||
|
cout << "\treplicatorHeaderDataWritten = " << repHeaderDataWritten << endl;
|
||||||
|
|
||||||
|
cout << "\treplicatorObjectsCreated = " << replicatorObjectsCreated << endl;
|
||||||
|
cout << "\treplicatorJournalsCreated = " << replicatorJournalsCreated << endl;
|
||||||
|
}
|
||||||
|
|
||||||
#define OPEN(name, mode) \
|
#define OPEN(name, mode) \
|
||||||
fd = ::open(name, mode, 0600); \
|
fd = ::open(name, mode, 0600); \
|
||||||
if (fd < 0) \
|
if (fd < 0) \
|
||||||
@@ -110,7 +121,8 @@ int Replicator::newObject(const boost::filesystem::path &filename, const uint8_t
|
|||||||
}
|
}
|
||||||
count += err;
|
count += err;
|
||||||
}
|
}
|
||||||
|
repUserDataWritten += count;
|
||||||
|
++replicatorObjectsCreated;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,9 +146,11 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
|
|||||||
string header = (boost::format("{ \"version\" : \"%03i\", \"max_offset\" : \"%011u\" }") % version % thisEntryMaxOffset).str();
|
string header = (boost::format("{ \"version\" : \"%03i\", \"max_offset\" : \"%011u\" }") % version % thisEntryMaxOffset).str();
|
||||||
err = ::write(fd, header.c_str(), header.length() + 1);
|
err = ::write(fd, header.c_str(), header.length() + 1);
|
||||||
assert((uint) err == header.length() + 1);
|
assert((uint) err == header.length() + 1);
|
||||||
|
repHeaderDataWritten += (header.length() + 1);
|
||||||
if (err <= 0)
|
if (err <= 0)
|
||||||
return err;
|
return err;
|
||||||
Cache::get()->newJournalEntry(firstDir, header.length() + 1);
|
Cache::get()->newJournalEntry(firstDir, header.length() + 1);
|
||||||
|
++replicatorJournalsCreated;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -154,6 +168,7 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
|
|||||||
string header = (boost::format("{ \"version\" : \"%03i\", \"max_offset\" : \"%011u\" }") % version % thisEntryMaxOffset).str();
|
string header = (boost::format("{ \"version\" : \"%03i\", \"max_offset\" : \"%011u\" }") % version % thisEntryMaxOffset).str();
|
||||||
err = ::pwrite(fd, header.c_str(), header.length() + 1,0);
|
err = ::pwrite(fd, header.c_str(), header.length() + 1,0);
|
||||||
assert((uint) err == header.length() + 1);
|
assert((uint) err == header.length() + 1);
|
||||||
|
repHeaderDataWritten += (header.length() + 1);
|
||||||
if (err <= 0)
|
if (err <= 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -166,6 +181,7 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
|
|||||||
|
|
||||||
err = ::write(fd, offlen, JOURNAL_ENTRY_HEADER_SIZE);
|
err = ::write(fd, offlen, JOURNAL_ENTRY_HEADER_SIZE);
|
||||||
assert(err == JOURNAL_ENTRY_HEADER_SIZE);
|
assert(err == JOURNAL_ENTRY_HEADER_SIZE);
|
||||||
|
repHeaderDataWritten += JOURNAL_ENTRY_HEADER_SIZE;
|
||||||
if (err <= 0)
|
if (err <= 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -183,6 +199,7 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
|
|||||||
count += err;
|
count += err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repUserDataWritten += count;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class Replicator
|
|||||||
|
|
||||||
int updateMetadata(const boost::filesystem::path &filename, MetadataFile &meta);
|
int updateMetadata(const boost::filesystem::path &filename, MetadataFile &meta);
|
||||||
|
|
||||||
|
void printKPIs() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Replicator();
|
Replicator();
|
||||||
Config *mpConfig;
|
Config *mpConfig;
|
||||||
@@ -42,6 +44,10 @@ class Replicator
|
|||||||
std::string msJournalPath;
|
std::string msJournalPath;
|
||||||
std::string msCachePath;
|
std::string msCachePath;
|
||||||
//ThreadPool threadPool;
|
//ThreadPool threadPool;
|
||||||
|
|
||||||
|
size_t repUserDataWritten, repHeaderDataWritten;
|
||||||
|
size_t replicatorObjectsCreated, replicatorJournalsCreated;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ void printKPIs(int sig)
|
|||||||
Cache::get()->printKPIs();
|
Cache::get()->printKPIs();
|
||||||
Synchronizer::get()->printKPIs();
|
Synchronizer::get()->printKPIs();
|
||||||
CloudStorage::get()->printKPIs();
|
CloudStorage::get()->printKPIs();
|
||||||
|
Replicator::get()->printKPIs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdownSM(int sig)
|
void shutdownSM(int sig)
|
||||||
|
|||||||
Reference in New Issue
Block a user