| 13 | #define die(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while(false) |
| 14 | |
| 15 | static void usage(const char* binary) { |
| 16 | fprintf(stderr, "Usage: %s COMMAND ARGS\n\n", binary); |
| 17 | fprintf(stderr, "Commands:\n"); |
| 18 | fprintf(stderr, " verify-equal DB1_PATH DB2_PATH\n"); |
| 19 | fprintf(stderr, " Verifies two databases are the same.\n"); |
| 20 | fprintf(stderr, " unreleased-state DB_PATH\n"); |
| 21 | fprintf(stderr, " Outputs state of unreleased entries in DB.\n"); |
| 22 | fprintf(stderr, " fsck DB_PATH\n"); |
| 23 | fprintf(stderr, " Performs various integrity checks on the RocksDB state. The RocksDB database will be opened as read only.\n"); |
| 24 | fprintf(stderr, " shard-log-entries DB_PATH START_LOG_IDX ENTRY_COUNT\n"); |
| 25 | fprintf(stderr, " Outputs entries from distributed log. The RocksDB database will be opened as read only.\n"); |
| 26 | fprintf(stderr, " cdc-log-entries DB_PATH START_LOG_IDX ENTRY_COUNT\n"); |
| 27 | fprintf(stderr, " Outputs entries from distributed log. The RocksDB database will be opened as read only.\n"); |
| 28 | fprintf(stderr, " sample-files DB_PATH OUTPUT_FILE_PATH\n"); |
| 29 | fprintf(stderr, " Outputs per directory usage statistics in binary format. The RocksDB database will be opened as read only.\n"); |
| 30 | fprintf(stderr, " find-failure-domain-duplicates DB_PATH OUTPUT_FILE_PATH\n"); |
| 31 | fprintf(stderr, " Outputs files with spans that have duplicate failure domain, along with how many failure domain failures they can tolerate.\n"); |
| 32 | fprintf(stderr, " block-service-usage DB_PATH OUTPUT_FILE_PATH\n"); |
| 33 | fprintf(stderr, " Aggregates expected block usage per block service\n"); |
| 34 | } |
| 35 | |
| 36 | int main(int argc, char** argv) { |
| 37 | const auto dieWithUsage = [&argv]() { |