Skip to content

Commit 4d016aa

Browse files
committed
success log argument deprecated and added new cli argument
1 parent 47524ad commit 4d016aa

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataimport/ImportCommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ private void validateDeprecatedOptions() {
286286
DEPRECATED_THREADS_OPTION,
287287
MAX_THREADS_OPTION,
288288
MAX_THREADS_OPTION_SHORT);
289+
validateDeprecatedOptionPair(
290+
spec.commandLine(),
291+
DEPRECATED_LOG_SUCCESS_RECORDS_OPTION,
292+
ENABLE_LOG_SUCCESS_RECORDS_OPTION,
293+
ENABLE_LOG_SUCCESS_RECORDS_OPTION_SHORT);
289294
}
290295

291296
/**
@@ -303,7 +308,7 @@ private ImportOptions createImportOptions(ControlFile controlFile) {
303308
.controlFile(controlFile)
304309
.controlFileValidationLevel(controlFileValidation)
305310
.logRawRecord(logRawRecord)
306-
.logSuccessRecords(logSuccessRecords)
311+
.logSuccessRecords(enableLogSuccessRecords)
307312
.ignoreNullValues(ignoreNullValues)
308313
.namespace(namespace)
309314
.dataChunkSize(dataChunkSize)

data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataimport/ImportCommandOptions.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ public class ImportCommandOptions {
1313
public static final String MAX_THREADS_OPTION_SHORT = "-mt";
1414
public static final String DEPRECATED_THREADS_OPTION = "--threads";
1515

16+
public static final String ENABLE_LOG_SUCCESS_RECORDS_OPTION = "--enable-log-success";
17+
public static final String ENABLE_LOG_SUCCESS_RECORDS_OPTION_SHORT = "-ls";
18+
public static final String DEPRECATED_LOG_SUCCESS_RECORDS_OPTION = "--log-success";
19+
1620
@CommandLine.Option(
1721
names = {"--mode", "-m"},
1822
description = "ScalarDB mode (STORAGE, TRANSACTION) (default: STORAGE)",
@@ -69,11 +73,19 @@ public class ImportCommandOptions {
6973
description = "Path to the JSON control file for data mapping")
7074
protected String controlFilePath;
7175

76+
// Deprecated option - kept for backward compatibility
7277
@CommandLine.Option(
73-
names = {"--log-success", "-ls"},
78+
names = {"--log-success"},
79+
description = "Deprecated: Use --enable-log-success",
80+
hidden = true)
81+
@Deprecated
82+
protected boolean logSuccessRecordsDeprecated;
83+
84+
@CommandLine.Option(
85+
names = {"--enable-log-success", "-ls"},
7486
description = "Enable logging of successfully processed records (default: false)",
7587
defaultValue = "false")
76-
protected boolean logSuccessRecords;
88+
protected boolean enableLogSuccessRecords;
7789

7890
@CommandLine.Option(
7991
names = {"--log-dir", "-ld"},
@@ -183,5 +195,8 @@ public void applyDeprecatedOptions() {
183195
if (threadsDeprecated != null) {
184196
maxThreads = threadsDeprecated;
185197
}
198+
if (logSuccessRecordsDeprecated) {
199+
enableLogSuccessRecords = true;
200+
}
186201
}
187202
}

0 commit comments

Comments
 (0)