0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

ircd::db: Use cfmd rather than live-files way to get column family metadata.

This commit is contained in:
Jason Volk 2018-09-24 22:26:44 -07:00
parent ca8082d01b
commit 4e3efb73d3
4 changed files with 38 additions and 9 deletions

View file

@ -34,6 +34,7 @@ namespace rocksdb
struct PerfContext; struct PerfContext;
struct IOStatsContext; struct IOStatsContext;
struct LiveFileMetaData; struct LiveFileMetaData;
struct SstFileMetaData;
struct SstFileWriter; struct SstFileWriter;
} }

View file

@ -40,6 +40,7 @@ struct ircd::db::database::sst::info
uint64_t entries {0}; uint64_t entries {0};
info() = default; info() = default;
info(rocksdb::SstFileMetaData &&);
info(rocksdb::LiveFileMetaData &&); info(rocksdb::LiveFileMetaData &&);
info(const database &, const string_view &filename); info(const database &, const string_view &filename);
}; };
@ -49,6 +50,7 @@ struct ircd::db::database::sst::info::vector
{ {
vector() = default; vector() = default;
explicit vector(const database &); explicit vector(const database &);
explicit vector(const db::column &);
}; };
struct ircd::db::database::sst::dump struct ircd::db::database::sst::dump

View file

@ -2608,6 +2608,26 @@ ircd::db::database::sst::info::vector::vector(const database &d)
}); });
} }
ircd::db::database::sst::info::vector::vector(const db::column &column)
{
const ctx::uninterruptible::nothrow ui;
database::column &c(const_cast<db::column &>(column));
database &d(*c.d);
rocksdb::ColumnFamilyMetaData cfmd;
d.d->GetColumnFamilyMetaData(c, &cfmd);
this->reserve(cfmd.file_count);
for(rocksdb::LevelMetaData &level : cfmd.levels)
{
for(rocksdb::SstFileMetaData md : level.files)
{
this->emplace_back(std::move(md));
this->back().column = db::name(column);
this->back().level = level.level;
}
}
}
// //
// sst::info::info // sst::info::info
// //
@ -2649,6 +2669,19 @@ ircd::db::database::sst::info::info(rocksdb::LiveFileMetaData &&md)
{ {
} }
ircd::db::database::sst::info::info(rocksdb::SstFileMetaData &&md)
:name{std::move(md.name)}
,path{std::move(md.db_path)}
,size{md.size}
,min_seq{md.smallest_seqno}
,max_seq{md.largest_seqno}
,min_key{std::move(md.smallestkey)}
,max_key{std::move(md.largestkey)}
,num_reads{md.num_reads_sampled}
,compacting{md.being_compacted}
{
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// database::env // database::env

View file

@ -2120,16 +2120,9 @@ try
database, colname database, colname
}; };
const auto files const db::database::sst::info::vector vector{column};
{ for(const auto &info : vector)
db::files(column)
};
for(const auto &file : files)
{
const db::database::sst::info info{database, file};
_print_sst_info(out, info); _print_sst_info(out, info);
}
return true; return true;
} }