1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-09 10:41:14 +03:00

add Replicator KPIs

This commit is contained in:
benthompson15
2019-08-08 12:29:17 -05:00
parent 363fda35f3
commit dfbd29a7af
3 changed files with 25 additions and 1 deletions

View File

@@ -69,6 +69,7 @@ Replicator::Replicator()
mpLogger->log(LOG_CRIT, "Failed to create %s, got: %s", msCachePath.c_str(), e.what());
throw e;
}
repUserDataWritten = repHeaderDataWritten = replicatorObjectsCreated = replicatorJournalsCreated = 0;
}
Replicator::~Replicator()
@@ -86,6 +87,16 @@ Replicator * Replicator::get()
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) \
fd = ::open(name, mode, 0600); \
if (fd < 0) \
@@ -110,7 +121,8 @@ int Replicator::newObject(const boost::filesystem::path &filename, const uint8_t
}
count += err;
}
repUserDataWritten += count;
++replicatorObjectsCreated;
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();
err = ::write(fd, header.c_str(), header.length() + 1);
assert((uint) err == header.length() + 1);
repHeaderDataWritten += (header.length() + 1);
if (err <= 0)
return err;
Cache::get()->newJournalEntry(firstDir, header.length() + 1);
++replicatorJournalsCreated;
}
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();
err = ::pwrite(fd, header.c_str(), header.length() + 1,0);
assert((uint) err == header.length() + 1);
repHeaderDataWritten += (header.length() + 1);
if (err <= 0)
return err;
}
@@ -166,6 +181,7 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
err = ::write(fd, offlen, JOURNAL_ENTRY_HEADER_SIZE);
assert(err == JOURNAL_ENTRY_HEADER_SIZE);
repHeaderDataWritten += JOURNAL_ENTRY_HEADER_SIZE;
if (err <= 0)
return err;
@@ -183,6 +199,7 @@ int Replicator::addJournalEntry(const boost::filesystem::path &filename, const u
count += err;
}
repUserDataWritten += count;
return count;
}

View File

@@ -35,6 +35,8 @@ class Replicator
int updateMetadata(const boost::filesystem::path &filename, MetadataFile &meta);
void printKPIs() const;
private:
Replicator();
Config *mpConfig;
@@ -42,6 +44,10 @@ class Replicator
std::string msJournalPath;
std::string msCachePath;
//ThreadPool threadPool;
size_t repUserDataWritten, repHeaderDataWritten;
size_t replicatorObjectsCreated, replicatorJournalsCreated;
};
}

View File

@@ -35,6 +35,7 @@ void printKPIs(int sig)
Cache::get()->printKPIs();
Synchronizer::get()->printKPIs();
CloudStorage::get()->printKPIs();
Replicator::get()->printKPIs();
}
void shutdownSM(int sig)