-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add ImportWAL tool with WAL replay controls #18516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0f2d66b
ver1
jt2594838 a25258a
add on_success
jt2594838 2cd41b6
add thread_num
jt2594838 fa7f2dd
add detailed prompt
jt2594838 bd9c691
retain wals with skipped entries
jt2594838 e298e31
support replaying table deletion
jt2594838 48e2ae7
Add command-line replay policies to ImportWAL
jt2594838 5e5eea7
Add ImportWAL database inference and corruption policies
jt2594838 c8de966
Add ImportWAL README
jt2594838 1873faf
Reject table snapshots with extra TAG segments
jt2594838 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
155 changes: 155 additions & 0 deletions
155
iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/ImportWALMessages.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.iotdb.db.i18n; | ||
|
|
||
| /** Compile-time i18n constants for the WAL import tool (English). */ | ||
| public final class ImportWALMessages { | ||
|
|
||
| public static final String MESSAGE_IMPORT_WAL_5E42804E = "import-wal"; | ||
| public static final String | ||
| MESSAGE_PATH_OF_A_WAL_FILE_OR_A_DIRECTORY_CONTAINING_WAL_FILES_473D0554 = | ||
| "Path of a WAL file or a directory containing WAL files."; | ||
| public static final String MESSAGE_TARGET_IOTDB_HOST_DEFAULT_127_0_0_1_3729156F = | ||
| "Target IoTDB host. Default: 127.0.0.1."; | ||
| public static final String MESSAGE_TARGET_IOTDB_RPC_PORT_DEFAULT_6667_FC0D345D = | ||
| "Target IoTDB RPC port. Default: 6667."; | ||
| public static final String MESSAGE_TARGET_IOTDB_USERNAME_DEFAULT_ROOT_EB91453B = | ||
| "Target IoTDB username. Default: root."; | ||
| public static final String | ||
| MESSAGE_TARGET_IOTDB_PASSWORD_PROMPTED_INTERACTIVELY_IF_OMITTED_29681961 = | ||
| "Target IoTDB password. Prompted interactively if omitted."; | ||
| public static final String MESSAGE_PASSWORD_PROMPT_F2D0E794 = "Password: "; | ||
| public static final String MESSAGE_TARGET_DATABASE_FOR_TABLE_MODEL_WAL_ENTRIES_27BACD1C = | ||
| "Target database for table-model WAL entries."; | ||
| public static final String | ||
| MESSAGE_WHEN_ALL_WAL_FILES_ARE_REPLAYED_SUCCESSFULLY_DO_OPERATION_ON_SOURCE_WAL_FILES_OPTIONAL_PARAMETERS_ARE_NONE_DEFAULT_AND_DELETE_41963A66 = | ||
| "When all WAL files are replayed successfully, do operation on source WAL files. Optional parameters are none (default) and delete."; | ||
| public static final String | ||
| MESSAGE_NUMBER_OF_THREADS_USED_TO_REPLAY_WAL_DIRECTORIES_IN_PARALLEL_DEFAULT_1_6AEF4F50 = | ||
| "Number of threads used to replay WAL directories in parallel. Default: 1."; | ||
| public static final String MESSAGE_PRINT_THIS_HELP_MESSAGE_E800AF7A = | ||
| "Print this help message."; | ||
| public static final String MESSAGE_ARGUMENT_ERROR_ARG_A9767F62 = "Argument error: %s"; | ||
| public static final String MESSAGE_WAL_IMPORT_FAILED_ARG_55C014BA = "WAL import failed: %s"; | ||
| public static final String EXCEPTION_SOURCE_PATH_DOES_NOT_EXIST_ARG_7C806CA2 = | ||
| "Source path does not exist: %s"; | ||
| public static final String EXCEPTION_SOURCE_FILE_IS_NOT_A_WAL_FILE_ARG_14A43F76 = | ||
| "Source file is not a WAL file: %s"; | ||
| public static final String EXCEPTION_NO_WAL_FILES_FOUND_UNDER_ARG_45F7FA22 = | ||
| "No WAL files found under: %s"; | ||
| public static final String EXCEPTION_INVALID_PORT_ARG_A7CDD5AC = "Invalid port: %s"; | ||
| public static final String | ||
| EXCEPTION_INVALID_THREAD_COUNT_ARG_EXPECTED_A_POSITIVE_INTEGER_F3AE2CFD = | ||
| "Invalid thread count: %s. Expected a positive integer."; | ||
| public static final String EXCEPTION_WAL_REPLAY_WAS_INTERRUPTED_770BA8AD = | ||
| "WAL replay was interrupted."; | ||
| public static final String | ||
| MESSAGE_REPLAYED_ARG_OPERATIONS_FROM_ARG_WAL_FILES_SKIPPED_ARG_ENTRIES_F0D37E3A = | ||
| "Replayed %d operations from %d WAL files; skipped %d entries."; | ||
| public static final String | ||
| MESSAGE_PROGRESS_ARG_COMPLETED_FILES_ARG_TOTAL_FILES_ARG_PROCESSED_BYTES_ARG_TOTAL_BYTES_ARG_PERCENT_ARG_ELAPSED_SECONDS_ARG_RATE_ARG_MB_PER_SECOND_F1C1356F = | ||
| "Progress: %d/%d WAL files completed, %d/%d bytes (%.1f%%), elapsed %.1f s, rate %.1f MB/s."; | ||
| public static final String | ||
| MESSAGE_IMPORT_DURATION_ARG_SECONDS_TOTAL_SIZE_ARG_BYTES_AVERAGE_RATE_ARG_MB_PER_SECOND_4B4EA58D = | ||
| "Import duration: %.1f s; total size: %d bytes; average rate: %.1f MB/s."; | ||
| public static final String MESSAGE_DELETED_ARG_SOURCE_WAL_FILES_C7A5AA1B = | ||
| "Deleted %d source WAL files."; | ||
| public static final String EXCEPTION_FAILED_TO_REPLAY_WAL_FILE_ARG_AT_OFFSET_ARG_ARG_FCFAF7F9 = | ||
| "Failed to replay WAL file %s at offset %d: %s"; | ||
| public static final String EXCEPTION_FAILED_TO_DELETE_SOURCE_WAL_FILE_ARG_ARG_236AF580 = | ||
| "Failed to delete source WAL file %s: %s"; | ||
| public static final String | ||
| EXCEPTION_UNSUPPORTED_ON_SUCCESS_VALUE_ARG_EXPECTED_NONE_OR_DELETE_F1C8EACE = | ||
| "Unsupported on_success value: %s. Expected none or delete."; | ||
| public static final String EXCEPTION_TABLE_MODEL_WAL_ENTRIES_REQUIRE_DB_DATABASE_F7597726 = | ||
| "Table-model WAL entries require -db/--database."; | ||
| public static final String EXCEPTION_UNSUPPORTED_WAL_OPERATION_ARG_ABD227A0 = | ||
| "Unsupported WAL operation: %s"; | ||
| public static final String | ||
| MESSAGE_TREE_MODEL_DELETE_OPERATION_DETECTED_ARG_CHOOSE_E_EXECUTE_S_SKIP_A_EXECUTE_ALL_L_SKIP_ALL_Q_QUIT_11E39FD7 = | ||
| "Tree-model delete operation detected: %s. Choose e=execute, s=skip, a=execute all, l=skip all, q=quit: "; | ||
| public static final String | ||
| MESSAGE_UNSUPPORTED_WAL_OPERATION_ARG_CHOOSE_S_SKIP_L_SKIP_ALL_Q_QUIT_0A734E52 = | ||
| "Unsupported WAL operation: %s. Choose s=skip, l=skip all, q=quit: "; | ||
| public static final String EXCEPTION_WAL_REPLAY_WAS_TERMINATED_BY_THE_USER_E0BD6197 = | ||
| "WAL replay was terminated by the user."; | ||
| public static final String EXCEPTION_INSERT_NODE_ARG_CONTAINS_NO_REPLAYABLE_DATA_5DA13453 = | ||
| "Insert node %s contains no replayable data."; | ||
| public static final String EXCEPTION_UNSUPPORTED_SNAPSHOT_DATA_TYPE_ARG_7A32D312 = | ||
| "Unsupported snapshot data type: %s"; | ||
| public static final String EXCEPTION_THE_WAL_FILE_IS_TRUNCATED_OR_CORRUPTED_6B0734C5 = | ||
| "The WAL file is truncated or corrupted."; | ||
| public static final String | ||
| EXCEPTION_PASSWORD_WAS_NOT_PROVIDED_AND_INTERACTIVE_INPUT_IS_UNAVAILABLE_40F42BCD = | ||
| "Password was not provided and interactive input is unavailable. Specify -pw/--password."; | ||
|
|
||
| public static final String MESSAGE_TABLE_MODEL_DELETE_OPERATION_DETECTED_ARG_CHOOSE_E_EXECUTE_S_SKIP_A_EXECUTE_ALL_L_SKIP_ALL_Q_QUIT_0C8D178A = | ||
| "Table-model delete operation detected: %s. Choose e=execute, s=skip, a=execute all, l=skip all, q=quit: "; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_COLUMN_SPECIFIC_DELETION_FOR_TABLE_ARG_AS_DELETE_FROM_4A7ACC93 = | ||
| "Cannot replay column-specific deletion for table %s as DELETE FROM."; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_TABLE_DELETION_TARGET_TABLE_ARG_HAS_NO_TIME_COLUMN_55B1C25C = | ||
| "Cannot replay table deletion: target table %s has no TIME column."; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_TABLE_DELETION_TAG_SEGMENT_INDEX_ARG_IS_INCOMPATIBLE_WITH_TARGET_TABLE_ARG_D5E3CCEE = | ||
| "Cannot replay table deletion: TAG segment index %d is incompatible with target table %s."; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_TABLE_DELETION_DEVICE_ARG_IS_INCOMPATIBLE_WITH_TARGET_TABLE_ARG_A6320535 = | ||
| "Cannot replay table deletion: device %s is incompatible with target table %s."; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_TABLE_DELETION_UNSUPPORTED_TAG_PREDICATE_ARG_AD0753A8 = | ||
| "Cannot replay table deletion: unsupported TAG predicate %s."; | ||
|
|
||
| public static final String MESSAGE_POLICY_FOR_TREE_TABLE_DELETIONS_ASK_DEFAULT_EXECUTE_SKIP_TERMINATE_C485B75F = | ||
| "Policy for tree/table deletions: ask (default), execute, skip, terminate."; | ||
| public static final String MESSAGE_POLICY_FOR_OBJECTNODE_ENTRIES_ASK_DEFAULT_SKIP_TERMINATE_7C94280F = | ||
| "Policy for ObjectNode entries: ask (default), skip, terminate."; | ||
| public static final String MESSAGE_POLICY_FOR_UNSUPPORTED_OPERATIONS_INCLUDING_UNCONVERTIBLE_TABLE_DELETIONS_ASK_DEFAULT_SKIP_TERMINATE_46ED9D3B = | ||
| "Policy for unsupported operations, including unconvertible table deletions: ask (default), skip, terminate."; | ||
| public static final String EXCEPTION_INVALID_VALUE_FOR_ARG_ARG_EXPECTED_ARG_73B78522 = | ||
| "Invalid value for --%s: %s. Expected %s."; | ||
|
|
||
| public static final String MESSAGE_POLICY_FOR_CORRUPTED_WAL_FILES_ASK_DEFAULT_SKIP_TERMINATE_SKIPS_THE_REST_OF_THE_FILE_ALREADY_REPLAYED_OPERATIONS_ARE_NOT_ROLLED_BACK_BF097791 = | ||
| "Policy for corrupted WAL files: ask (default), skip, terminate. Skips the rest of the file; already replayed operations are not rolled back."; | ||
| public static final String MESSAGE_WAL_CORRUPTION_DETECTED_ARG_ALREADY_REPLAYED_OPERATIONS_ARE_NOT_ROLLED_BACK_CHOOSE_S_SKIP_FILE_L_SKIP_ALL_CORRUPTED_FILES_Q_QUIT_BFED14E4 = | ||
| "WAL corruption detected: %s. Already replayed operations are not rolled back. Choose s=skip file, l=skip all corrupted files, q=quit: "; | ||
| public static final String MESSAGE_SKIPPED_CORRUPTED_WAL_FILE_ARG_SOURCE_FILE_RETAINED_C20FF968 = | ||
| "Skipped corrupted WAL file: %s. Source file retained."; | ||
| public static final String MESSAGE_SKIPPED_ARG_CORRUPTED_WAL_FILES_SOURCE_FILES_RETAINED_A889CCE2 = | ||
| "Skipped %d corrupted WAL files; source files retained."; | ||
|
|
||
| public static final String MESSAGE_TARGET_DATABASE_FOR_TABLE_MODEL_WAL_ENTRIES_IF_OMITTED_INFER_FROM_THE_WAL_PARENT_DIRECTORY_AND_ASK_FOR_CONFIRMATION_4B1E409D = | ||
| "Target database for table-model WAL entries. If omitted, infer from the WAL parent directory and ask for confirmation."; | ||
| public static final String MESSAGE_INFERRED_TABLE_DATABASE_ARG_FROM_WAL_DIRECTORY_ARG_REPLAY_INTO_THIS_DATABASE_Y_YES_A_ACCEPT_ALL_INFERRED_DATABASES_N_QUIT_5B59D833 = | ||
| "Inferred table database %s from WAL directory %s. Replay into this database? [y] yes, [a] accept all inferred databases, [N] quit: "; | ||
| public static final String EXCEPTION_DATABASE_CONFIRMATION_REQUIRED_FOR_WAL_DIRECTORY_ARG_INFERRED_DATABASE_ARG_SPECIFY_DB_DATABASE_OR_SKIP_DB_CONFIRMATION_WHEN_INTERACTIVE_INPUT_IS_UNAVAILABLE_14DF6D36 = | ||
| "Database confirmation required for WAL directory %s (inferred database: %s). Specify -db/--database or --skip_db_confirmation when interactive input is unavailable."; | ||
| public static final String EXCEPTION_REPLAY_INTO_INFERRED_DATABASE_ARG_WAS_NOT_CONFIRMED_SPECIFY_DB_DATABASE_TO_SELECT_THE_TARGET_EXPLICITLY_86F81190 = | ||
| "Replay into inferred database %s was not confirmed. Specify -db/--database to select the target explicitly."; | ||
|
|
||
| public static final String MESSAGE_ACCEPT_ALL_INFERRED_DATABASE_NAMES_WITHOUT_CONFIRMATION_DB_DATABASE_STILL_TAKES_PRECEDENCE_FA49A73C = | ||
| "Accept all inferred database names without confirmation; -db/--database still takes precedence."; | ||
|
|
||
| public static final String EXCEPTION_CANNOT_REPLAY_TABLE_SNAPSHOT_DEVICE_ARG_HAS_ARG_TAG_SEGMENTS_BUT_TARGET_TABLE_ARG_HAS_ONLY_ARG_TAG_COLUMNS_012AF9B6 = | ||
| "Cannot replay table snapshot: device %s has %d TAG segments, but target table %s has only %d TAG columns."; | ||
|
|
||
| private ImportWALMessages() {} | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Centralizing the import tool messages in the English locale keeps all user-facing CLI and replay errors localizable and gives the Chinese locale a stable key set to mirror.