ldb_cmd_impl.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include <map>
  7. #include <string>
  8. #include <utility>
  9. #include <vector>
  10. #include "rocksdb/utilities/ldb_cmd.h"
  11. namespace ROCKSDB_NAMESPACE {
  12. class CompactorCommand : public LDBCommand {
  13. public:
  14. static std::string Name() { return "compact"; }
  15. CompactorCommand(const std::vector<std::string>& params,
  16. const std::map<std::string, std::string>& options,
  17. const std::vector<std::string>& flags);
  18. static void Help(std::string& ret);
  19. void DoCommand() override;
  20. private:
  21. bool null_from_;
  22. std::string from_;
  23. bool null_to_;
  24. std::string to_;
  25. };
  26. class DBFileDumperCommand : public LDBCommand {
  27. public:
  28. static std::string Name() { return "dump_live_files"; }
  29. DBFileDumperCommand(const std::vector<std::string>& params,
  30. const std::map<std::string, std::string>& options,
  31. const std::vector<std::string>& flags);
  32. static void Help(std::string& ret);
  33. void DoCommand() override;
  34. private:
  35. bool decode_blob_index_;
  36. bool dump_uncompressed_blobs_;
  37. };
  38. class DBLiveFilesMetadataDumperCommand : public LDBCommand {
  39. public:
  40. static std::string Name() { return "list_live_files_metadata"; }
  41. DBLiveFilesMetadataDumperCommand(
  42. const std::vector<std::string>& params,
  43. const std::map<std::string, std::string>& options,
  44. const std::vector<std::string>& flags);
  45. static void Help(std::string& ret);
  46. void DoCommand() override;
  47. private:
  48. bool sort_by_filename_;
  49. static const std::string ARG_SORT_BY_FILENAME;
  50. };
  51. class DBDumperCommand : public LDBCommand {
  52. public:
  53. static std::string Name() { return "dump"; }
  54. DBDumperCommand(const std::vector<std::string>& params,
  55. const std::map<std::string, std::string>& options,
  56. const std::vector<std::string>& flags);
  57. static void Help(std::string& ret);
  58. void DoCommand() override;
  59. private:
  60. /**
  61. * Extract file name from the full path. We handle both the forward slash (/)
  62. * and backslash (\) to make sure that different OS-s are supported.
  63. */
  64. static std::string GetFileNameFromPath(const std::string& s) {
  65. std::size_t n = s.find_last_of("/\\");
  66. if (std::string::npos == n) {
  67. return s;
  68. } else {
  69. return s.substr(n + 1);
  70. }
  71. }
  72. void DoDumpCommand();
  73. bool null_from_;
  74. std::string from_;
  75. bool null_to_;
  76. std::string to_;
  77. int max_keys_;
  78. std::string delim_;
  79. bool count_only_;
  80. bool count_delim_;
  81. bool print_stats_;
  82. std::string path_;
  83. bool decode_blob_index_;
  84. bool dump_uncompressed_blobs_;
  85. static const std::string ARG_COUNT_ONLY;
  86. static const std::string ARG_COUNT_DELIM;
  87. static const std::string ARG_STATS;
  88. static const std::string ARG_TTL_BUCKET;
  89. };
  90. class InternalDumpCommand : public LDBCommand {
  91. public:
  92. static std::string Name() { return "idump"; }
  93. InternalDumpCommand(const std::vector<std::string>& params,
  94. const std::map<std::string, std::string>& options,
  95. const std::vector<std::string>& flags);
  96. static void Help(std::string& ret);
  97. void DoCommand() override;
  98. private:
  99. bool has_from_;
  100. std::string from_;
  101. bool has_to_;
  102. std::string to_;
  103. int max_keys_;
  104. std::string delim_;
  105. bool count_only_;
  106. bool count_delim_;
  107. bool print_stats_;
  108. bool is_input_key_hex_;
  109. bool decode_blob_index_;
  110. static const std::string ARG_DELIM;
  111. static const std::string ARG_COUNT_ONLY;
  112. static const std::string ARG_COUNT_DELIM;
  113. static const std::string ARG_STATS;
  114. static const std::string ARG_INPUT_KEY_HEX;
  115. };
  116. class DBLoaderCommand : public LDBCommand {
  117. public:
  118. static std::string Name() { return "load"; }
  119. DBLoaderCommand(std::string& db_name, std::vector<std::string>& args);
  120. DBLoaderCommand(const std::vector<std::string>& params,
  121. const std::map<std::string, std::string>& options,
  122. const std::vector<std::string>& flags);
  123. static void Help(std::string& ret);
  124. void DoCommand() override;
  125. void OverrideBaseOptions() override;
  126. private:
  127. bool disable_wal_;
  128. bool bulk_load_;
  129. bool compact_;
  130. static const std::string ARG_DISABLE_WAL;
  131. static const std::string ARG_BULK_LOAD;
  132. static const std::string ARG_COMPACT;
  133. };
  134. class ManifestDumpCommand : public LDBCommand {
  135. public:
  136. static std::string Name() { return "manifest_dump"; }
  137. ManifestDumpCommand(const std::vector<std::string>& params,
  138. const std::map<std::string, std::string>& options,
  139. const std::vector<std::string>& flags);
  140. static void Help(std::string& ret);
  141. void DoCommand() override;
  142. bool NoDBOpen() override { return true; }
  143. private:
  144. bool verbose_;
  145. bool json_;
  146. std::string path_;
  147. static const std::string ARG_VERBOSE;
  148. static const std::string ARG_JSON;
  149. static const std::string ARG_PATH;
  150. };
  151. class UpdateManifestCommand : public LDBCommand {
  152. public:
  153. static std::string Name() { return "update_manifest"; }
  154. UpdateManifestCommand(const std::vector<std::string>& params,
  155. const std::map<std::string, std::string>& options,
  156. const std::vector<std::string>& flags);
  157. static void Help(std::string& ret);
  158. void DoCommand() override;
  159. bool NoDBOpen() override { return true; }
  160. private:
  161. bool verbose_;
  162. bool update_temperatures_;
  163. // TODO future: checksum_func for populating checksums
  164. static const std::string ARG_VERBOSE;
  165. static const std::string ARG_UPDATE_TEMPERATURES;
  166. };
  167. class FileChecksumDumpCommand : public LDBCommand {
  168. public:
  169. static std::string Name() { return "file_checksum_dump"; }
  170. FileChecksumDumpCommand(const std::vector<std::string>& params,
  171. const std::map<std::string, std::string>& options,
  172. const std::vector<std::string>& flags);
  173. static void Help(std::string& ret);
  174. void DoCommand() override;
  175. bool NoDBOpen() override { return true; }
  176. private:
  177. std::string path_;
  178. bool is_checksum_hex_;
  179. static const std::string ARG_PATH;
  180. };
  181. class GetPropertyCommand : public LDBCommand {
  182. public:
  183. static std::string Name() { return "get_property"; }
  184. GetPropertyCommand(const std::vector<std::string>& params,
  185. const std::map<std::string, std::string>& options,
  186. const std::vector<std::string>& flags);
  187. static void Help(std::string& ret);
  188. void DoCommand() override;
  189. private:
  190. std::string property_;
  191. };
  192. class ListColumnFamiliesCommand : public LDBCommand {
  193. public:
  194. static std::string Name() { return "list_column_families"; }
  195. ListColumnFamiliesCommand(const std::vector<std::string>& params,
  196. const std::map<std::string, std::string>& options,
  197. const std::vector<std::string>& flags);
  198. static void Help(std::string& ret);
  199. void DoCommand() override;
  200. bool NoDBOpen() override { return true; }
  201. };
  202. class CreateColumnFamilyCommand : public LDBCommand {
  203. public:
  204. static std::string Name() { return "create_column_family"; }
  205. CreateColumnFamilyCommand(const std::vector<std::string>& params,
  206. const std::map<std::string, std::string>& options,
  207. const std::vector<std::string>& flags);
  208. static void Help(std::string& ret);
  209. void DoCommand() override;
  210. bool NoDBOpen() override { return false; }
  211. private:
  212. std::string new_cf_name_;
  213. };
  214. class DropColumnFamilyCommand : public LDBCommand {
  215. public:
  216. static std::string Name() { return "drop_column_family"; }
  217. DropColumnFamilyCommand(const std::vector<std::string>& params,
  218. const std::map<std::string, std::string>& options,
  219. const std::vector<std::string>& flags);
  220. static void Help(std::string& ret);
  221. void DoCommand() override;
  222. bool NoDBOpen() override { return false; }
  223. private:
  224. std::string cf_name_to_drop_;
  225. };
  226. class ReduceDBLevelsCommand : public LDBCommand {
  227. public:
  228. static std::string Name() { return "reduce_levels"; }
  229. ReduceDBLevelsCommand(const std::vector<std::string>& params,
  230. const std::map<std::string, std::string>& options,
  231. const std::vector<std::string>& flags);
  232. void OverrideBaseCFOptions(ColumnFamilyOptions* cf_opts) override;
  233. void DoCommand() override;
  234. bool NoDBOpen() override { return true; }
  235. static void Help(std::string& msg);
  236. static std::vector<std::string> PrepareArgs(const std::string& db_path,
  237. int new_levels,
  238. bool print_old_level = false);
  239. private:
  240. int old_levels_;
  241. int new_levels_;
  242. bool print_old_levels_;
  243. static const std::string ARG_NEW_LEVELS;
  244. static const std::string ARG_PRINT_OLD_LEVELS;
  245. Status GetOldNumOfLevels(Options& opt, int* levels);
  246. };
  247. class ChangeCompactionStyleCommand : public LDBCommand {
  248. public:
  249. static std::string Name() { return "change_compaction_style"; }
  250. ChangeCompactionStyleCommand(
  251. const std::vector<std::string>& params,
  252. const std::map<std::string, std::string>& options,
  253. const std::vector<std::string>& flags);
  254. void OverrideBaseCFOptions(ColumnFamilyOptions* cf_opts) override;
  255. void DoCommand() override;
  256. static void Help(std::string& msg);
  257. private:
  258. int old_compaction_style_;
  259. int new_compaction_style_;
  260. static const std::string ARG_OLD_COMPACTION_STYLE;
  261. static const std::string ARG_NEW_COMPACTION_STYLE;
  262. };
  263. class WALDumperCommand : public LDBCommand {
  264. public:
  265. static std::string Name() { return "dump_wal"; }
  266. WALDumperCommand(const std::vector<std::string>& params,
  267. const std::map<std::string, std::string>& options,
  268. const std::vector<std::string>& flags);
  269. bool NoDBOpen() override { return no_db_open_; }
  270. static void Help(std::string& ret);
  271. void DoCommand() override;
  272. private:
  273. bool print_header_;
  274. std::string wal_file_;
  275. bool print_values_;
  276. bool only_print_seqno_gaps_;
  277. bool is_write_committed_; // default will be set to true
  278. bool no_db_open_ = true;
  279. static const std::string ARG_WAL_FILE;
  280. static const std::string ARG_WRITE_COMMITTED;
  281. static const std::string ARG_PRINT_HEADER;
  282. static const std::string ARG_PRINT_VALUE;
  283. static const std::string ARG_ONLY_PRINT_SEQNO_GAPS;
  284. };
  285. class GetCommand : public LDBCommand {
  286. public:
  287. static std::string Name() { return "get"; }
  288. GetCommand(const std::vector<std::string>& params,
  289. const std::map<std::string, std::string>& options,
  290. const std::vector<std::string>& flags);
  291. void DoCommand() override;
  292. static void Help(std::string& ret);
  293. private:
  294. std::string key_;
  295. };
  296. class MultiGetCommand : public LDBCommand {
  297. public:
  298. static std::string Name() { return "multi_get"; }
  299. MultiGetCommand(const std::vector<std::string>& params,
  300. const std::map<std::string, std::string>& options,
  301. const std::vector<std::string>& flags);
  302. void DoCommand() override;
  303. static void Help(std::string& ret);
  304. private:
  305. std::vector<std::string> keys_;
  306. };
  307. class GetEntityCommand : public LDBCommand {
  308. public:
  309. static std::string Name() { return "get_entity"; }
  310. GetEntityCommand(const std::vector<std::string>& params,
  311. const std::map<std::string, std::string>& options,
  312. const std::vector<std::string>& flags);
  313. void DoCommand() override;
  314. static void Help(std::string& ret);
  315. private:
  316. std::string key_;
  317. };
  318. class MultiGetEntityCommand : public LDBCommand {
  319. public:
  320. static std::string Name() { return "multi_get_entity"; }
  321. MultiGetEntityCommand(const std::vector<std::string>& params,
  322. const std::map<std::string, std::string>& options,
  323. const std::vector<std::string>& flags);
  324. void DoCommand() override;
  325. static void Help(std::string& ret);
  326. private:
  327. std::vector<std::string> keys_;
  328. };
  329. class ApproxSizeCommand : public LDBCommand {
  330. public:
  331. static std::string Name() { return "approxsize"; }
  332. ApproxSizeCommand(const std::vector<std::string>& params,
  333. const std::map<std::string, std::string>& options,
  334. const std::vector<std::string>& flags);
  335. void DoCommand() override;
  336. static void Help(std::string& ret);
  337. private:
  338. std::string start_key_;
  339. std::string end_key_;
  340. };
  341. class BatchPutCommand : public LDBCommand {
  342. public:
  343. static std::string Name() { return "batchput"; }
  344. BatchPutCommand(const std::vector<std::string>& params,
  345. const std::map<std::string, std::string>& options,
  346. const std::vector<std::string>& flags);
  347. void DoCommand() override;
  348. static void Help(std::string& ret);
  349. void OverrideBaseOptions() override;
  350. private:
  351. /**
  352. * The key-values to be inserted.
  353. */
  354. std::vector<std::pair<std::string, std::string>> key_values_;
  355. };
  356. class ScanCommand : public LDBCommand {
  357. public:
  358. static std::string Name() { return "scan"; }
  359. ScanCommand(const std::vector<std::string>& params,
  360. const std::map<std::string, std::string>& options,
  361. const std::vector<std::string>& flags);
  362. void DoCommand() override;
  363. static void Help(std::string& ret);
  364. private:
  365. std::string start_key_;
  366. std::string end_key_;
  367. bool start_key_specified_;
  368. bool end_key_specified_;
  369. int max_keys_scanned_;
  370. bool no_value_;
  371. bool get_write_unix_time_;
  372. };
  373. class DeleteCommand : public LDBCommand {
  374. public:
  375. static std::string Name() { return "delete"; }
  376. DeleteCommand(const std::vector<std::string>& params,
  377. const std::map<std::string, std::string>& options,
  378. const std::vector<std::string>& flags);
  379. void DoCommand() override;
  380. static void Help(std::string& ret);
  381. private:
  382. std::string key_;
  383. };
  384. class SingleDeleteCommand : public LDBCommand {
  385. public:
  386. static std::string Name() { return "singledelete"; }
  387. SingleDeleteCommand(const std::vector<std::string>& params,
  388. const std::map<std::string, std::string>& options,
  389. const std::vector<std::string>& flags);
  390. void DoCommand() override;
  391. static void Help(std::string& ret);
  392. private:
  393. std::string key_;
  394. };
  395. class DeleteRangeCommand : public LDBCommand {
  396. public:
  397. static std::string Name() { return "deleterange"; }
  398. DeleteRangeCommand(const std::vector<std::string>& params,
  399. const std::map<std::string, std::string>& options,
  400. const std::vector<std::string>& flags);
  401. void DoCommand() override;
  402. static void Help(std::string& ret);
  403. private:
  404. std::string begin_key_;
  405. std::string end_key_;
  406. };
  407. class PutCommand : public LDBCommand {
  408. public:
  409. static std::string Name() { return "put"; }
  410. PutCommand(const std::vector<std::string>& params,
  411. const std::map<std::string, std::string>& options,
  412. const std::vector<std::string>& flags);
  413. void DoCommand() override;
  414. static void Help(std::string& ret);
  415. void OverrideBaseOptions() override;
  416. private:
  417. std::string key_;
  418. std::string value_;
  419. };
  420. class PutEntityCommand : public LDBCommand {
  421. public:
  422. static std::string Name() { return "put_entity"; }
  423. PutEntityCommand(const std::vector<std::string>& params,
  424. const std::map<std::string, std::string>& options,
  425. const std::vector<std::string>& flags);
  426. void DoCommand() override;
  427. static void Help(std::string& ret);
  428. void OverrideBaseOptions() override;
  429. private:
  430. std::string key_;
  431. std::vector<std::string> column_names_;
  432. std::vector<std::string> column_values_;
  433. };
  434. /**
  435. * Command that starts up a REPL shell that allows
  436. * get/put/delete.
  437. */
  438. class DBQuerierCommand : public LDBCommand {
  439. public:
  440. static std::string Name() { return "query"; }
  441. DBQuerierCommand(const std::vector<std::string>& params,
  442. const std::map<std::string, std::string>& options,
  443. const std::vector<std::string>& flags);
  444. static void Help(std::string& ret);
  445. void DoCommand() override;
  446. private:
  447. static const char* HELP_CMD;
  448. static const char* GET_CMD;
  449. static const char* PUT_CMD;
  450. static const char* DELETE_CMD;
  451. static const char* COUNT_CMD;
  452. };
  453. class CheckConsistencyCommand : public LDBCommand {
  454. public:
  455. static std::string Name() { return "checkconsistency"; }
  456. CheckConsistencyCommand(const std::vector<std::string>& params,
  457. const std::map<std::string, std::string>& options,
  458. const std::vector<std::string>& flags);
  459. void DoCommand() override;
  460. bool NoDBOpen() override { return true; }
  461. static void Help(std::string& ret);
  462. };
  463. class CheckPointCommand : public LDBCommand {
  464. public:
  465. static std::string Name() { return "checkpoint"; }
  466. CheckPointCommand(const std::vector<std::string>& params,
  467. const std::map<std::string, std::string>& options,
  468. const std::vector<std::string>& flags);
  469. void DoCommand() override;
  470. static void Help(std::string& ret);
  471. std::string checkpoint_dir_;
  472. private:
  473. static const std::string ARG_CHECKPOINT_DIR;
  474. };
  475. class RepairCommand : public LDBCommand {
  476. public:
  477. static std::string Name() { return "repair"; }
  478. RepairCommand(const std::vector<std::string>& params,
  479. const std::map<std::string, std::string>& options,
  480. const std::vector<std::string>& flags);
  481. void DoCommand() override;
  482. bool NoDBOpen() override { return true; }
  483. void OverrideBaseOptions() override;
  484. static void Help(std::string& ret);
  485. protected:
  486. bool verbose_;
  487. private:
  488. static const std::string ARG_VERBOSE;
  489. };
  490. class BackupEngineCommand : public LDBCommand {
  491. public:
  492. BackupEngineCommand(const std::vector<std::string>& params,
  493. const std::map<std::string, std::string>& options,
  494. const std::vector<std::string>& flags);
  495. protected:
  496. static void Help(const std::string& name, std::string& ret);
  497. std::string backup_env_uri_;
  498. std::string backup_fs_uri_;
  499. std::string backup_dir_;
  500. int num_threads_;
  501. std::unique_ptr<Logger> logger_;
  502. std::shared_ptr<Env> backup_env_guard_;
  503. private:
  504. static const std::string ARG_BACKUP_DIR;
  505. static const std::string ARG_BACKUP_ENV_URI;
  506. static const std::string ARG_BACKUP_FS_URI;
  507. static const std::string ARG_NUM_THREADS;
  508. static const std::string ARG_STDERR_LOG_LEVEL;
  509. };
  510. class BackupCommand : public BackupEngineCommand {
  511. public:
  512. static std::string Name() { return "backup"; }
  513. BackupCommand(const std::vector<std::string>& params,
  514. const std::map<std::string, std::string>& options,
  515. const std::vector<std::string>& flags);
  516. void DoCommand() override;
  517. static void Help(std::string& ret);
  518. };
  519. class RestoreCommand : public BackupEngineCommand {
  520. public:
  521. static std::string Name() { return "restore"; }
  522. RestoreCommand(const std::vector<std::string>& params,
  523. const std::map<std::string, std::string>& options,
  524. const std::vector<std::string>& flags);
  525. void DoCommand() override;
  526. bool NoDBOpen() override { return true; }
  527. static void Help(std::string& ret);
  528. };
  529. class WriteExternalSstFilesCommand : public LDBCommand {
  530. public:
  531. static std::string Name() { return "write_extern_sst"; }
  532. WriteExternalSstFilesCommand(
  533. const std::vector<std::string>& params,
  534. const std::map<std::string, std::string>& options,
  535. const std::vector<std::string>& flags);
  536. void DoCommand() override;
  537. bool NoDBOpen() override { return false; }
  538. void OverrideBaseOptions() override;
  539. static void Help(std::string& ret);
  540. private:
  541. std::string output_sst_path_;
  542. };
  543. class IngestExternalSstFilesCommand : public LDBCommand {
  544. public:
  545. static std::string Name() { return "ingest_extern_sst"; }
  546. IngestExternalSstFilesCommand(
  547. const std::vector<std::string>& params,
  548. const std::map<std::string, std::string>& options,
  549. const std::vector<std::string>& flags);
  550. void DoCommand() override;
  551. bool NoDBOpen() override { return false; }
  552. void OverrideBaseOptions() override;
  553. static void Help(std::string& ret);
  554. private:
  555. std::string input_sst_path_;
  556. bool move_files_;
  557. bool snapshot_consistency_;
  558. bool allow_global_seqno_;
  559. bool allow_blocking_flush_;
  560. bool ingest_behind_;
  561. bool write_global_seqno_;
  562. static const std::string ARG_MOVE_FILES;
  563. static const std::string ARG_SNAPSHOT_CONSISTENCY;
  564. static const std::string ARG_ALLOW_GLOBAL_SEQNO;
  565. static const std::string ARG_ALLOW_BLOCKING_FLUSH;
  566. static const std::string ARG_INGEST_BEHIND;
  567. static const std::string ARG_WRITE_GLOBAL_SEQNO;
  568. };
  569. // Command that prints out range delete tombstones in SST files.
  570. class ListFileRangeDeletesCommand : public LDBCommand {
  571. public:
  572. static std::string Name() { return "list_file_range_deletes"; }
  573. ListFileRangeDeletesCommand(const std::map<std::string, std::string>& options,
  574. const std::vector<std::string>& flags);
  575. void DoCommand() override;
  576. static void Help(std::string& ret);
  577. private:
  578. int max_keys_ = 1000;
  579. };
  580. // Command that removes the SST file forcibly from the manifest.
  581. class UnsafeRemoveSstFileCommand : public LDBCommand {
  582. public:
  583. static std::string Name() { return "unsafe_remove_sst_file"; }
  584. UnsafeRemoveSstFileCommand(const std::vector<std::string>& params,
  585. const std::map<std::string, std::string>& options,
  586. const std::vector<std::string>& flags);
  587. static void Help(std::string& ret);
  588. void DoCommand() override;
  589. bool NoDBOpen() override { return true; }
  590. private:
  591. uint64_t sst_file_number_;
  592. };
  593. class CompactionProgressDumpCommand : public LDBCommand {
  594. public:
  595. static std::string Name() { return "compaction_progress_dump"; }
  596. CompactionProgressDumpCommand(
  597. const std::vector<std::string>& params,
  598. const std::map<std::string, std::string>& options,
  599. const std::vector<std::string>& flags);
  600. static void Help(std::string& ret);
  601. void DoCommand() override;
  602. bool NoDBOpen() override { return true; }
  603. private:
  604. std::string path_;
  605. static const std::string ARG_PATH;
  606. };
  607. } // namespace ROCKSDB_NAMESPACE