Print information about all column families when using ldb (#9719)
Summary: Before this PR, the following command prints only the default column family's information in the end: ``` ldb --db=. --hex manifest_dump --verbose ``` We should print all column families instead. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9719 Test Plan: `make check` makes sure nothing breaks. Generate a DB, use the above command to verify all column families are printed. Reviewed By: akankshamahajan15 Differential Revision: D34992453 Pulled By: riversand963 fbshipit-source-id: de1d38c4539cd89f74e1a6240ad7a6e2416bf198
This commit is contained in:
parent
f07eec1bf8
commit
3bd150c442
@ -5126,9 +5126,6 @@ Status VersionSet::TryRecoverFromOneManifest(
|
||||
Status VersionSet::ListColumnFamilies(std::vector<std::string>* column_families,
|
||||
const std::string& dbname,
|
||||
FileSystem* fs) {
|
||||
// these are just for performance reasons, not correctness,
|
||||
// so we're fine using the defaults
|
||||
FileOptions soptions;
|
||||
// Read "CURRENT" file, which contains a pointer to the current manifest file
|
||||
std::string manifest_path;
|
||||
uint64_t manifest_file_number;
|
||||
@ -5137,16 +5134,24 @@ Status VersionSet::ListColumnFamilies(std::vector<std::string>* column_families,
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
return ListColumnFamiliesFromManifest(manifest_path, fs, column_families);
|
||||
}
|
||||
|
||||
Status VersionSet::ListColumnFamiliesFromManifest(
|
||||
const std::string& manifest_path, FileSystem* fs,
|
||||
std::vector<std::string>* column_families) {
|
||||
std::unique_ptr<SequentialFileReader> file_reader;
|
||||
Status s;
|
||||
{
|
||||
std::unique_ptr<FSSequentialFile> file;
|
||||
s = fs->NewSequentialFile(manifest_path, soptions, &file, nullptr);
|
||||
// these are just for performance reasons, not correctness,
|
||||
// so we're fine using the defaults
|
||||
s = fs->NewSequentialFile(manifest_path, FileOptions(), &file, nullptr);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
file_reader.reset(new SequentialFileReader(std::move(file), manifest_path,
|
||||
nullptr /*IOTracer*/));
|
||||
}
|
||||
file_reader = std::make_unique<SequentialFileReader>(
|
||||
std::move(file), manifest_path, /*io_tracer=*/nullptr);
|
||||
}
|
||||
|
||||
VersionSet::LogReporter reporter;
|
||||
@ -5336,9 +5341,16 @@ Status VersionSet::GetLiveFilesChecksumInfo(FileChecksumList* checksum_list) {
|
||||
|
||||
Status VersionSet::DumpManifest(Options& options, std::string& dscname,
|
||||
bool verbose, bool hex, bool json) {
|
||||
assert(options.env);
|
||||
std::vector<std::string> column_families;
|
||||
Status s = ListColumnFamiliesFromManifest(
|
||||
dscname, options.env->GetFileSystem().get(), &column_families);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// Open the specified manifest file.
|
||||
std::unique_ptr<SequentialFileReader> file_reader;
|
||||
Status s;
|
||||
{
|
||||
std::unique_ptr<FSSequentialFile> file;
|
||||
const std::shared_ptr<FileSystem>& fs = options.env->GetFileSystem();
|
||||
@ -5349,14 +5361,16 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname,
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
file_reader.reset(new SequentialFileReader(
|
||||
std::move(file), dscname, db_options_->log_readahead_size, io_tracer_));
|
||||
file_reader = std::make_unique<SequentialFileReader>(
|
||||
std::move(file), dscname, db_options_->log_readahead_size, io_tracer_);
|
||||
}
|
||||
|
||||
std::vector<ColumnFamilyDescriptor> column_families(
|
||||
1, ColumnFamilyDescriptor(kDefaultColumnFamilyName, options));
|
||||
DumpManifestHandler handler(column_families, this, io_tracer_, verbose, hex,
|
||||
json);
|
||||
std::vector<ColumnFamilyDescriptor> cf_descs;
|
||||
for (const auto& cf : column_families) {
|
||||
cf_descs.emplace_back(cf, options);
|
||||
}
|
||||
|
||||
DumpManifestHandler handler(cf_descs, this, io_tracer_, verbose, hex, json);
|
||||
{
|
||||
VersionSet::LogReporter reporter;
|
||||
reporter.status = &s;
|
||||
|
@ -1090,6 +1090,9 @@ class VersionSet {
|
||||
// column_families.
|
||||
static Status ListColumnFamilies(std::vector<std::string>* column_families,
|
||||
const std::string& dbname, FileSystem* fs);
|
||||
static Status ListColumnFamiliesFromManifest(
|
||||
const std::string& manifest_path, FileSystem* fs,
|
||||
std::vector<std::string>* column_families);
|
||||
|
||||
#ifndef ROCKSDB_LITE
|
||||
// Try to reduce the number of levels. This call is valid when
|
||||
|
Loading…
Reference in New Issue
Block a user