Skip to content

Commit

Permalink
Make indexSuffix a parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
  • Loading branch information
mikaylathompson committed Apr 19, 2024
1 parent 4ec659b commit 384401e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions RFS/src/main/java/com/rfs/ReindexFromSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public static class Args {

@Parameter(names = {"--log-level"}, description = "What log level you want. Default: 'info'", required = false, converter = Logging.ArgsConverter.class)
public Level logLevel = Level.INFO;

@Parameter(names = {"--index_suffix"}, description = "An optional suffix to add to index names as they're transfered. Default: none", required = false)
public String indexSuffix = "";
}

public static void main(String[] args) throws InterruptedException {
Expand Down Expand Up @@ -118,6 +121,7 @@ public static void main(String[] args) throws InterruptedException {
List<String> componentTemplateWhitelist = arguments.componentTemplateWhitelist;
MovementType movementType = arguments.movementType;
Level logLevel = arguments.logLevel;
String indexSuffix = arguments.indexSuffix;

Logging.setLevel(logLevel);

Expand Down Expand Up @@ -297,7 +301,7 @@ public static void main(String[] args) throws InterruptedException {
logger.info("==================================================================");
logger.info("Attempting to recreate the indices...");
for (IndexMetadata.Data indexMetadata : indexMetadatas) {
String reindexName = indexMetadata.getName() + "_reindexed";
String reindexName = indexMetadata.getName() + indexSuffix;
logger.info("Recreating index " + indexMetadata.getName() + " as " + reindexName + " on target...");

ObjectNode root = indexMetadata.toObjectNode();
Expand Down Expand Up @@ -355,7 +359,7 @@ public static void main(String[] args) throws InterruptedException {
logger.info("Documents read successfully");

for (Document document : documents) {
String targetIndex = indexMetadata.getName() + "_reindexed";
String targetIndex = indexMetadata.getName() + indexSuffix;
DocumentReindexer.reindex(targetIndex, document, targetConnection);
}
}
Expand Down

0 comments on commit 384401e

Please sign in to comment.