0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::db: Give RocksDB its own logging facility.

This commit is contained in:
Jason Volk 2017-09-29 23:07:55 -07:00
parent 19451ab914
commit 3d754bffba

View file

@ -243,6 +243,15 @@ ircd::log::log ircd::db::log
"db", 'D' "db", 'D'
}; };
namespace ircd::db
{
// Dedicated logging facility for rocksdb's log callbacks
log::log rog
{
"rdb", 'R'
};
}
std::map<ircd::string_view, ircd::db::database *> std::map<ircd::string_view, ircd::db::database *>
ircd::db::database::dbs ircd::db::database::dbs
{}; {};
@ -1042,7 +1051,7 @@ ircd::db::database::logs::Logv(const rocksdb::InfoLogLevel level,
if(startswith(str, "Options")) if(startswith(str, "Options"))
return; return;
log(translate(level), "'%s': (rdb) %s", d->name, str); rog(translate(level), "'%s': %s", d->name, str);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1173,7 +1182,7 @@ void
ircd::db::database::events::OnFlushCompleted(rocksdb::DB *const db, ircd::db::database::events::OnFlushCompleted(rocksdb::DB *const db,
const rocksdb::FlushJobInfo &info) const rocksdb::FlushJobInfo &info)
{ {
log.debug("'%s' @%p: flushed: column[%s] path[%s] tid[%lu] job[%d] writes[slow:%d stop:%d]", rog.debug("'%s' @%p: flushed: column[%s] path[%s] tid[%lu] job[%d] writes[slow:%d stop:%d]",
d->name, d->name,
db, db,
info.cf_name, info.cf_name,
@ -1188,7 +1197,7 @@ void
ircd::db::database::events::OnCompactionCompleted(rocksdb::DB *const db, ircd::db::database::events::OnCompactionCompleted(rocksdb::DB *const db,
const rocksdb::CompactionJobInfo &info) const rocksdb::CompactionJobInfo &info)
{ {
log.debug("'%s' @%p: compacted: column[%s] status[%d] tid[%lu] job[%d]", rog.debug("'%s' @%p: compacted: column[%s] status[%d] tid[%lu] job[%d]",
d->name, d->name,
db, db,
info.cf_name, info.cf_name,
@ -1200,7 +1209,7 @@ ircd::db::database::events::OnCompactionCompleted(rocksdb::DB *const db,
void void
ircd::db::database::events::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo &info) ircd::db::database::events::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo &info)
{ {
log.debug("'%s': table file deleted: db[%s] path[%s] status[%d] job[%d]", rog.debug("'%s': table file deleted: db[%s] path[%s] status[%d] job[%d]",
d->name, d->name,
info.db_name, info.db_name,
info.file_path, info.file_path,
@ -1211,7 +1220,7 @@ ircd::db::database::events::OnTableFileDeleted(const rocksdb::TableFileDeletionI
void void
ircd::db::database::events::OnTableFileCreated(const rocksdb::TableFileCreationInfo &info) ircd::db::database::events::OnTableFileCreated(const rocksdb::TableFileCreationInfo &info)
{ {
log.debug("'%s': table file created: db[%s] path[%s] status[%d] job[%d]", rog.debug("'%s': table file created: db[%s] path[%s] status[%d] job[%d]",
d->name, d->name,
info.db_name, info.db_name,
info.file_path, info.file_path,
@ -1222,7 +1231,7 @@ ircd::db::database::events::OnTableFileCreated(const rocksdb::TableFileCreationI
void void
ircd::db::database::events::OnTableFileCreationStarted(const rocksdb::TableFileCreationBriefInfo &info) ircd::db::database::events::OnTableFileCreationStarted(const rocksdb::TableFileCreationBriefInfo &info)
{ {
log.debug("'%s': table file creating: db[%s] column[%s] path[%s] job[%d]", rog.debug("'%s': table file creating: db[%s] column[%s] path[%s] job[%d]",
d->name, d->name,
info.db_name, info.db_name,
info.cf_name, info.cf_name,
@ -1233,7 +1242,7 @@ ircd::db::database::events::OnTableFileCreationStarted(const rocksdb::TableFileC
void void
ircd::db::database::events::OnMemTableSealed(const rocksdb::MemTableInfo &info) ircd::db::database::events::OnMemTableSealed(const rocksdb::MemTableInfo &info)
{ {
log.debug("'%s': memory table sealed: column[%s] entries[%lu] deletes[%lu]", rog.debug("'%s': memory table sealed: column[%s] entries[%lu] deletes[%lu]",
d->name, d->name,
info.cf_name, info.cf_name,
info.num_entries, info.num_entries,
@ -1243,7 +1252,7 @@ ircd::db::database::events::OnMemTableSealed(const rocksdb::MemTableInfo &info)
void void
ircd::db::database::events::OnColumnFamilyHandleDeletionStarted(rocksdb::ColumnFamilyHandle *const h) ircd::db::database::events::OnColumnFamilyHandleDeletionStarted(rocksdb::ColumnFamilyHandle *const h)
{ {
log.debug("'%s': column[%s] handle closing @ %p", rog.debug("'%s': column[%s] handle closing @ %p",
d->name, d->name,
h->GetName(), h->GetName(),
h); h);