Skip to content

Commit 2e186ca

Browse files
authored
Merge branch 'master' into feat/data-loader/changes-export
2 parents b973df8 + acfb238 commit 2e186ca

File tree

14 files changed

+494
-24
lines changed

14 files changed

+494
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,136 @@ jobs:
254254
name: cassandra_3.11_integration_test_reports_${{ matrix.mode.label }}
255255
path: core/build/reports/tests/integrationTestCassandra
256256

257+
integration-test-for-cassandra-4-1:
258+
name: Cassandra 4.1 integration test (${{ matrix.mode.label }})
259+
runs-on: ubuntu-latest
260+
261+
services:
262+
cassandra:
263+
image: cassandra:4.1
264+
env:
265+
MAX_HEAP_SIZE: 2048m
266+
HEAP_NEWSIZE: 512m
267+
ports:
268+
- 9042:9042
269+
270+
strategy:
271+
fail-fast: false
272+
matrix:
273+
mode:
274+
- label: default
275+
group_commit_enabled: false
276+
- label: with_group_commit
277+
group_commit_enabled: true
278+
279+
steps:
280+
- uses: actions/checkout@v5
281+
282+
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }})
283+
uses: actions/setup-java@v5
284+
with:
285+
java-version: ${{ env.JAVA_VERSION }}
286+
distribution: ${{ env.JAVA_VENDOR }}
287+
288+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test
289+
uses: actions/setup-java@v5
290+
if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}}
291+
with:
292+
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}
293+
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}
294+
295+
- name: Login to Oracle container registry
296+
uses: docker/login-action@v3
297+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
298+
with:
299+
registry: container-registry.oracle.com
300+
username: ${{ secrets.OCR_USERNAME }}
301+
password: ${{ secrets.OCR_TOKEN }}
302+
303+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test
304+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
305+
run: |
306+
container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}")
307+
docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id"
308+
309+
- name: Setup Gradle
310+
uses: gradle/actions/setup-gradle@v5
311+
312+
- name: Execute Gradle 'integrationTestCassandra' task
313+
run: ./gradlew integrationTestCassandra ${{ matrix.mode.group_commit_enabled && env.INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT || '' }}
314+
315+
- name: Upload Gradle test reports
316+
if: always()
317+
uses: actions/upload-artifact@v5
318+
with:
319+
name: cassandra_4.1_integration_test_reports_${{ matrix.mode.label }}
320+
path: core/build/reports/tests/integrationTestCassandra
321+
322+
integration-test-for-cassandra-5-0:
323+
name: Cassandra 5.0 integration test (${{ matrix.mode.label }})
324+
runs-on: ubuntu-latest
325+
326+
services:
327+
cassandra:
328+
image: cassandra:5.0
329+
env:
330+
MAX_HEAP_SIZE: 2048m
331+
HEAP_NEWSIZE: 512m
332+
ports:
333+
- 9042:9042
334+
335+
strategy:
336+
fail-fast: false
337+
matrix:
338+
mode:
339+
- label: default
340+
group_commit_enabled: false
341+
- label: with_group_commit
342+
group_commit_enabled: true
343+
344+
steps:
345+
- uses: actions/checkout@v5
346+
347+
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }})
348+
uses: actions/setup-java@v5
349+
with:
350+
java-version: ${{ env.JAVA_VERSION }}
351+
distribution: ${{ env.JAVA_VENDOR }}
352+
353+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test
354+
uses: actions/setup-java@v5
355+
if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}}
356+
with:
357+
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}
358+
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}
359+
360+
- name: Login to Oracle container registry
361+
uses: docker/login-action@v3
362+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
363+
with:
364+
registry: container-registry.oracle.com
365+
username: ${{ secrets.OCR_USERNAME }}
366+
password: ${{ secrets.OCR_TOKEN }}
367+
368+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test
369+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
370+
run: |
371+
container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}")
372+
docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id"
373+
374+
- name: Setup Gradle
375+
uses: gradle/actions/setup-gradle@v5
376+
377+
- name: Execute Gradle 'integrationTestCassandra' task
378+
run: ./gradlew integrationTestCassandra ${{ matrix.mode.group_commit_enabled && env.INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT || '' }}
379+
380+
- name: Upload Gradle test reports
381+
if: always()
382+
uses: actions/upload-artifact@v5
383+
with:
384+
name: cassandra_5.0_integration_test_reports_${{ matrix.mode.label }}
385+
path: core/build/reports/tests/integrationTestCassandra
386+
257387
integration-test-for-cosmos:
258388
name: Cosmos DB integration test (${{ matrix.mode.label }})
259389
runs-on: windows-latest

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ subprojects {
2626
guiceVersion = '5.1.0'
2727
guavaVersion = '32.1.3-jre'
2828
slf4jVersion = '1.7.36'
29-
cassandraDriverVersion = '3.11.5'
29+
cassandraDriverVersion = '3.12.1'
3030
azureCosmosVersion = '4.75.0'
3131
azureBlobStorageVersion = '12.32.0'
3232
jooqVersion = '3.14.16'

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ dependencies {
167167
implementation "com.google.guava:guava:${guavaVersion}"
168168
implementation "com.google.inject:guice:${guiceVersion}"
169169
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
170-
implementation "com.datastax.cassandra:cassandra-driver-core:${cassandraDriverVersion}"
170+
implementation "org.apache.cassandra:cassandra-driver-core:${cassandraDriverVersion}"
171171
implementation "com.azure:azure-cosmos:${azureCosmosVersion}"
172172
implementation "com.azure:azure-storage-blob:${azureBlobStorageVersion}"
173173
implementation "org.jooq:jooq:${jooqVersion}"

data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataexport/ExportCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ public Integer call() throws Exception {
6262
FileUtils.validateFilePath(scalarDbPropertiesFilePath);
6363
validatePositiveValue(
6464
spec.commandLine(), dataChunkSize, DataLoaderError.INVALID_DATA_CHUNK_SIZE);
65-
validatePositiveValue(spec.commandLine(), maxThreads, DataLoaderError.INVALID_MAX_THREADS);
65+
// Only validate the argument when provided by the user, if not set a default
66+
if (maxThreads != null) {
67+
validatePositiveValue(spec.commandLine(), maxThreads, DataLoaderError.INVALID_MAX_THREADS);
68+
} else {
69+
maxThreads = Runtime.getRuntime().availableProcessors();
70+
}
6671

6772
StorageFactory storageFactory = StorageFactory.create(scalarDbPropertiesFilePath);
6873
TransactionFactory transactionFactory = TransactionFactory.create(scalarDbPropertiesFilePath);
@@ -129,6 +134,11 @@ private void validateDeprecatedOptions() {
129134
DEPRECATED_END_EXCLUSIVE_OPTION,
130135
END_INCLUSIVE_OPTION,
131136
END_INCLUSIVE_OPTION_SHORT);
137+
validateDeprecatedOptionPair(
138+
spec.commandLine(),
139+
DEPRECATED_THREADS_OPTION,
140+
MAX_THREADS_OPTION,
141+
MAX_THREADS_OPTION_SHORT);
132142
}
133143

134144
private String getScalarDbPropertiesFilePath() {

data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataexport/ExportCommandOptions.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class ExportCommandOptions {
1616
public static final String END_INCLUSIVE_OPTION = "--end-inclusive";
1717
public static final String END_INCLUSIVE_OPTION_SHORT = "-ei";
1818
public static final String DEPRECATED_END_EXCLUSIVE_OPTION = "--end-exclusive";
19+
public static final String MAX_THREADS_OPTION = "--max-threads";
20+
public static final String MAX_THREADS_OPTION_SHORT = "-mt";
21+
public static final String DEPRECATED_THREADS_OPTION = "--threads";
1922

2023
@CommandLine.Option(
2124
names = {"--config", "-c"},
@@ -77,7 +80,18 @@ public class ExportCommandOptions {
7780
paramLabel = "<MAX_THREADS>",
7881
description =
7982
"Maximum number of threads to use for parallel processing (default: number of available processors)")
80-
protected int maxThreads;
83+
protected Integer maxThreads;
84+
85+
/**
86+
* @deprecated As of release 3.6.2. Will be removed in release 4.0.0. Use --max-threads instead
87+
*/
88+
@Deprecated
89+
@CommandLine.Option(
90+
names = {DEPRECATED_THREADS_OPTION},
91+
paramLabel = "<THREADS>",
92+
description = "Deprecated: Use --max-threads instead",
93+
hidden = true)
94+
protected Integer threadsDeprecated;
8195

8296
@CommandLine.Option(
8397
names = {"--start-key", "-sk"},
@@ -184,5 +198,10 @@ public void applyDeprecatedOptions() {
184198
if (endExclusiveDeprecated != null) {
185199
scanEndInclusive = !endExclusiveDeprecated;
186200
}
201+
202+
// If the deprecated option is set, use its value
203+
if (threadsDeprecated != null) {
204+
maxThreads = threadsDeprecated;
205+
}
187206
}
188207
}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ public Integer call() throws Exception {
6161
spec.commandLine(), dataChunkSize, DataLoaderError.INVALID_DATA_CHUNK_SIZE);
6262
validatePositiveValue(
6363
spec.commandLine(), transactionSize, DataLoaderError.INVALID_TRANSACTION_SIZE);
64-
validatePositiveValue(spec.commandLine(), maxThreads, DataLoaderError.INVALID_MAX_THREADS);
64+
// Only validate the argument when provided by the user, if not set a default
65+
if (maxThreads != null) {
66+
validatePositiveValue(spec.commandLine(), maxThreads, DataLoaderError.INVALID_MAX_THREADS);
67+
} else {
68+
maxThreads = Runtime.getRuntime().availableProcessors();
69+
}
6570
validatePositiveValue(
6671
spec.commandLine(), dataChunkQueueSize, DataLoaderError.INVALID_DATA_CHUNK_QUEUE_SIZE);
6772
ControlFile controlFile = parseControlFileFromPath(controlFilePath).orElse(null);
@@ -286,6 +291,11 @@ private void validateDeprecatedOptions() {
286291
DEPRECATED_THREADS_OPTION,
287292
MAX_THREADS_OPTION,
288293
MAX_THREADS_OPTION_SHORT);
294+
validateDeprecatedOptionPair(
295+
spec.commandLine(),
296+
DEPRECATED_LOG_SUCCESS_RECORDS_OPTION,
297+
ENABLE_LOG_SUCCESS_RECORDS_OPTION,
298+
ENABLE_LOG_SUCCESS_RECORDS_OPTION_SHORT);
289299
}
290300

291301
/**
@@ -303,7 +313,7 @@ private ImportOptions createImportOptions(ControlFile controlFile) {
303313
.controlFile(controlFile)
304314
.controlFileValidationLevel(controlFileValidation)
305315
.logRawRecord(logRawRecord)
306-
.logSuccessRecords(logSuccessRecords)
316+
.logSuccessRecords(enableLogSuccessRecords)
307317
.ignoreNullValues(ignoreNullValues)
308318
.namespace(namespace)
309319
.dataChunkSize(dataChunkSize)

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

Lines changed: 32 additions & 11 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)",
@@ -38,17 +42,18 @@ public class ImportCommandOptions {
3842
names = {"--max-threads", "-mt"},
3943
paramLabel = "<MAX_THREADS>",
4044
description =
41-
"Maximum number of threads to use for parallel processing (default: number of available processors)",
42-
defaultValue = "16")
43-
protected int maxThreads;
45+
"Maximum number of threads to use for parallel processing (default: number of available processors)")
46+
protected Integer maxThreads;
4447

45-
// Deprecated option - kept for backward compatibility
48+
/**
49+
* @deprecated As of release 3.6.2. Will be removed in release 4.0.0. Use --max-threads instead
50+
*/
51+
@Deprecated
4652
@CommandLine.Option(
4753
names = {DEPRECATED_THREADS_OPTION},
4854
paramLabel = "<THREADS>",
4955
description = "Deprecated: Use --max-threads instead",
5056
hidden = true)
51-
@Deprecated
5257
protected Integer threadsDeprecated;
5358

5459
@CommandLine.Option(
@@ -69,11 +74,22 @@ public class ImportCommandOptions {
6974
description = "Path to the JSON control file for data mapping")
7075
protected String controlFilePath;
7176

77+
/**
78+
* @deprecated As of release 3.6.2. Will be removed in release 4.0.0. Use --enable-log-success
79+
* instead
80+
*/
81+
@Deprecated
82+
@CommandLine.Option(
83+
names = {"--log-success"},
84+
description = "Deprecated: Use --enable-log-success",
85+
hidden = true)
86+
protected boolean logSuccessRecordsDeprecated;
87+
7288
@CommandLine.Option(
73-
names = {"--log-success", "-ls"},
89+
names = {"--enable-log-success", "-ls"},
7490
description = "Enable logging of successfully processed records (default: false)",
7591
defaultValue = "false")
76-
protected boolean logSuccessRecords;
92+
protected boolean enableLogSuccessRecords;
7793

7894
@CommandLine.Option(
7995
names = {"--log-dir", "-ld"},
@@ -145,29 +161,31 @@ public class ImportCommandOptions {
145161
@CommandLine.Option(
146162
names = {"--data-chunk-size", "-dcs"},
147163
paramLabel = "<DATA_CHUNK_SIZE>",
148-
description = "Maximum number of records to be included in a single data chunk",
164+
description =
165+
"Maximum number of records to be included in a single data chunk (default: 500)",
149166
defaultValue = "500")
150167
protected int dataChunkSize;
151168

152169
@CommandLine.Option(
153170
names = {"--transaction-size", "-ts"},
154171
paramLabel = "<TRANSACTION_SIZE>",
155172
description =
156-
"Maximum number of put operations that are grouped together into one ScalarDB distributed transaction, only supported in ScalarDB transaction mode",
173+
"Maximum number of put operations that are grouped together into one ScalarDB distributed transaction, only supported in ScalarDB transaction mode (default: 100)",
157174
defaultValue = "100")
158175
protected int transactionSize;
159176

160177
@CommandLine.Option(
161178
names = {"--split-log-mode", "-slm"},
162179
paramLabel = "<SPLIT_LOG_MODE>",
163-
description = "Split log file into multiple files based on data chunks",
180+
description = "Split log file into multiple files based on data chunks (default: false)",
164181
defaultValue = "false")
165182
protected boolean splitLogMode;
166183

167184
@CommandLine.Option(
168185
names = {"--data-chunk-queue-size", "-qs"},
169186
paramLabel = "<DATA_CHUNK_QUEUE_SIZE>",
170-
description = "Maximum number of data chunks that can be kept at a time for processing",
187+
description =
188+
"Maximum number of data chunks that can be kept at a time for processing (default: 256)",
171189
defaultValue = "256")
172190
protected int dataChunkQueueSize;
173191

@@ -183,5 +201,8 @@ public void applyDeprecatedOptions() {
183201
if (threadsDeprecated != null) {
184202
maxThreads = threadsDeprecated;
185203
}
204+
if (logSuccessRecordsDeprecated) {
205+
enableLogSuccessRecords = true;
206+
}
186207
}
187208
}

0 commit comments

Comments
 (0)