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