mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 23:40:57 +01:00
ircd::db: Support SST dump tooling.
This commit is contained in:
parent
f2cfa87d49
commit
f7da7d9be8
3 changed files with 49 additions and 0 deletions
|
@ -11,6 +11,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define HAVE_IRCD_DB_DATABASE_FILEINFO_H
|
#define HAVE_IRCD_DB_DATABASE_FILEINFO_H
|
||||||
|
|
||||||
|
namespace ircd::db
|
||||||
|
{
|
||||||
|
void sst_dump(const vector_view<const string_view> &args);
|
||||||
|
}
|
||||||
|
|
||||||
/// Database snapshot object. Maintaining this object will maintain a
|
/// Database snapshot object. Maintaining this object will maintain a
|
||||||
/// consistent state of access to the database at the sequence number
|
/// consistent state of access to the database at the sequence number
|
||||||
/// from when it's acquired.
|
/// from when it's acquired.
|
||||||
|
|
31
ircd/db.cc
31
ircd/db.cc
|
@ -26,6 +26,7 @@
|
||||||
#include <rocksdb/filter_policy.h>
|
#include <rocksdb/filter_policy.h>
|
||||||
#include <rocksdb/table.h>
|
#include <rocksdb/table.h>
|
||||||
#include <rocksdb/sst_file_manager.h>
|
#include <rocksdb/sst_file_manager.h>
|
||||||
|
#include <rocksdb/sst_dump_tool.h>
|
||||||
#include <rocksdb/compaction_filter.h>
|
#include <rocksdb/compaction_filter.h>
|
||||||
|
|
||||||
// ircd::db interfaces requiring complete RocksDB (frontside).
|
// ircd::db interfaces requiring complete RocksDB (frontside).
|
||||||
|
@ -2488,6 +2489,36 @@ const noexcept
|
||||||
// database::fileinfo
|
// database::fileinfo
|
||||||
//
|
//
|
||||||
|
|
||||||
|
void
|
||||||
|
ircd::db::sst_dump(const vector_view<const string_view> &args)
|
||||||
|
{
|
||||||
|
thread_local char arg[16][256]
|
||||||
|
{
|
||||||
|
"./sst_dump"
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t i(0);
|
||||||
|
char *argv[16] { arg[i++] };
|
||||||
|
for(; i < 15 && i - 1 < args.size(); ++i)
|
||||||
|
{
|
||||||
|
strlcpy(arg[i], args.at(i - 1));
|
||||||
|
argv[i] = arg[i];
|
||||||
|
}
|
||||||
|
argv[i] = nullptr;
|
||||||
|
|
||||||
|
rocksdb::SSTDumpTool tool;
|
||||||
|
const int ret
|
||||||
|
{
|
||||||
|
tool.Run(i, argv)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(ret != 0)
|
||||||
|
throw error
|
||||||
|
{
|
||||||
|
"Error from SST dump tool: return value: %d", ret
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// fileinfo::vector
|
// fileinfo::vector
|
||||||
//
|
//
|
||||||
|
|
|
@ -1936,6 +1936,19 @@ catch(const std::out_of_range &e)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__db__sstdump(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
string_view buf[16];
|
||||||
|
const vector_view<const string_view> args
|
||||||
|
{
|
||||||
|
buf, tokens(line, " ", buf)
|
||||||
|
};
|
||||||
|
|
||||||
|
db::sst_dump(args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__db__files(opt &out, const string_view &line)
|
console_cmd__db__files(opt &out, const string_view &line)
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue