Skip to content

Commit

Permalink
fix inspect won't run in imitative mode (#3807) (#3809)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jan 6, 2022
1 parent a1ea1a0 commit 202a9df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dbms/src/Server/DTTool/DTTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ static constexpr char MAIN_HELP[] =
"Usage: dttool <subcommand> [args]\n"
"Available Subcommands:\n"
" help Print help message and exit.\n"
" migrate Migrate dmfile version.\n"
" inspect Inspect dmfile info.\n"
" bench Benchmark dmfile IO performance.";
" migrate Migrate dtfile version.\n"
" inspect Inspect dtfile info.\n"
" bench Benchmark dtfile IO performance.";
// clang-format on

extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Server/DTTool/DTToolBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static constexpr char BENCH_HELP[] =
"Usage: bench [args]\n"
"Available Arguments:\n"
" --help Print help message and exit.\n"
" --version DMFile version. [default: 2] [available: 1, 2]\n"
" --version DTFile version. [default: 2] [available: 1, 2]\n"
" --algorithm Checksum algorithm. [default: xxh3] [available: xxh3, city128, crc32, crc64, none]\n"
" --frame Checksum frame length. [default: " TO_STRING(TIFLASH_DEFAULT_CHECKSUM_FRAME_SIZE) "]\n"
" --column Column number. [default: 100]\n"
Expand Down Expand Up @@ -215,7 +215,7 @@ int benchEntry(const std::vector<std::string> & opts)
auto version = vm["version"].as<size_t>();
if (version < 1 || version > 2)
{
std::cerr << "invalid dmfile version: " << version << std::endl;
std::cerr << "invalid dtfile version: " << version << std::endl;
return -EINVAL;
}
auto algorithm_ = vm["algorithm"].as<std::string>();
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Server/DTTool/DTToolInspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ static constexpr char INSPECT_HELP[] =
"Usage: inspect [args]\n"
"Available Arguments:\n"
" --help Print help message and exit.\n"
" --config-file Tiflash config file.\n"
" --config-file TiFlash config file.\n"
" --check Iterate data files to check integrity.\n"
" --file-id Target DMFile ID.\n"
" --file-id Target DTFile ID.\n"
" --imitative Use imitative context instead. (encryption is not supported in this mode)\n"
" --workdir Target directory.";

Expand Down Expand Up @@ -179,7 +179,6 @@ int inspectEntry(const std::vector<std::string> & opts, RaftStoreFFIFunc ffi_fun

auto workdir = vm["workdir"].as<std::string>();
auto file_id = vm["file-id"].as<size_t>();
auto config_file = vm["config-file"].as<std::string>();
auto args = InspectArgs{check, file_id, workdir};

if (imitative)
Expand All @@ -189,6 +188,7 @@ int inspectEntry(const std::vector<std::string> & opts, RaftStoreFFIFunc ffi_fun
}
else
{
auto config_file = vm["config-file"].as<std::string>();
CLIService service(inspectServiceMain, args, config_file, ffi_function);
return service.run({""});
}
Expand Down
10 changes: 5 additions & 5 deletions dbms/src/Server/DTTool/DTToolMigrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static constexpr char MIGRATE_HELP[] =
"Usage: migrate [args]\n"
"Available Arguments:\n"
" --help Print help message and exit.\n"
" --version Target dmfile version. [default: 2] [available: 1, 2]\n"
" --version Target dtfile version. [default: 2] [available: 1, 2]\n"
" --algorithm Checksum algorithm. [default: xxh3] [available: xxh3, city128, crc32, crc64, none]\n"
" --frame Checksum frame length. [default: " TO_STRING(TIFLASH_DEFAULT_CHECKSUM_FRAME_SIZE) "]\n"
" --compression Compression method. [default: lz4] [available: lz4, lz4hc, zstd, none]\n"
Expand Down Expand Up @@ -189,10 +189,10 @@ int migrateServiceMain(DB::Context & context, const MigrateArgs & args)
keeper.setStorageVersion(DB::STORAGE_FORMAT_V2);
break;
default:
throw DB::Exception(fmt::format("invalid dmfile version: {}", args.version));
throw DB::Exception(fmt::format("invalid dtfile version: {}", args.version));
}

LOG_FMT_INFO(logger, "creating new dmfile");
LOG_FMT_INFO(logger, "creating new dtfile");
auto new_file = DB::DM::DMFile::create(args.file_id, keeper.migration_temp_dir.path(), false, std::move(option));

LOG_FMT_INFO(logger, "creating input stream");
Expand All @@ -212,7 +212,7 @@ int migrateServiceMain(DB::Context & context, const MigrateArgs & args)
auto stat_iter = src_file->pack_stats.begin();
auto properties_iter = src_file->pack_properties.property().begin();
size_t counter = 0;
// iterate all blocks and rewrite them to new dmfile
// iterate all blocks and rewrite them to new dtfile
while (auto block = input_stream->read())
{
LOG_FMT_INFO(logger, "migrating block {} ( size: {} )", counter++, block.bytes());
Expand Down Expand Up @@ -296,7 +296,7 @@ int migrateEntry(const std::vector<std::string> & opts, RaftStoreFFIFunc ffi_fun
args.version = vm["version"].as<size_t>();
if (args.version < 1 || args.version > 2)
{
std::cerr << "invalid dmfile version: " << args.version << std::endl;
std::cerr << "invalid dtfile version: " << args.version << std::endl;
return -EINVAL;
}
args.no_keep = no_keep;
Expand Down

0 comments on commit 202a9df

Please sign in to comment.