Skip to content

Commit 9c09901

Browse files
committed
Merge branch 'master' of https://github.com/scalar-labs/scalardb into fix/data-loader/handle-unkown-exception-when-importing
2 parents 57ce0ea + ccbd39f commit 9c09901

File tree

163 files changed

+11078
-2180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+11078
-2180
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
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Test Object Storage Adapter
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
INT_TEST_JAVA_RUNTIME_VERSION:
7+
description: JDK version used to run the integration test
8+
type: choice
9+
required: false
10+
default: '8'
11+
options:
12+
- '8'
13+
- '11'
14+
- '17'
15+
- '21'
16+
INT_TEST_JAVA_RUNTIME_VENDOR:
17+
description: Vendor of the JDK used to run the integration test
18+
type: choice
19+
required: false
20+
default: 'temurin'
21+
options:
22+
- 'corretto'
23+
- 'microsoft'
24+
- 'oracle'
25+
- 'temurin'
26+
27+
env:
28+
TERM: dumb
29+
JAVA_VERSION: '8'
30+
JAVA_VENDOR: 'temurin'
31+
INT_TEST_JAVA_RUNTIME_VERSION: "${{ github.event_name != 'workflow_dispatch' && '8' || inputs.INT_TEST_JAVA_RUNTIME_VERSION }}"
32+
INT_TEST_JAVA_RUNTIME_VENDOR: "${{ github.event_name != 'workflow_dispatch' && 'temurin' || inputs.INT_TEST_JAVA_RUNTIME_VENDOR }}"
33+
# Gradle will parse 'ORG_GRADLE_PROJECT_<project_property_name>' environment variables as project properties.
34+
# The following variables configure the 'com.scalar.db.jdk-configuration' Gradle plugin.
35+
ORG_GRADLE_PROJECT_javaVersion: '8'
36+
ORG_GRADLE_PROJECT_javaVendor: 'temurin'
37+
ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVersion: "${{ github.event_name != 'workflow_dispatch' && '8' || inputs.INT_TEST_JAVA_RUNTIME_VERSION }}"
38+
ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVendor: "${{ github.event_name != 'workflow_dispatch' && 'temurin' || inputs.INT_TEST_JAVA_RUNTIME_VENDOR }}"
39+
# This variable evaluates to: if {!(Temurin JDK 8) && !(Oracle JDK)} then {true} else {false}
40+
# Oracle JDK that are linux compatible and publicly available through direct download exist for all LTS versions
41+
SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK: "${{ (github.event_name == 'workflow_dispatch' && !(inputs.INT_TEST_JAVA_RUNTIME_VERSION == '8' && inputs.INT_TEST_JAVA_RUNTIME_VENDOR == 'temurin') && !(inputs.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle')) && 'true' || 'false' }}"
42+
INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT: '"-Dscalardb.consensus_commit.coordinator.group_commit.enabled=true" "-Dscalardb.consensus_commit.coordinator.group_commit.old_group_abort_timeout_millis=15000" --tests "**.ConsensusCommit**"'
43+
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
44+
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
45+
S3_REGION: ap-northeast-1
46+
S3_BUCKET_NAME: scalardb-test-bucket
47+
48+
jobs:
49+
integration-test-s3:
50+
name: S3 integration test (${{ matrix.mode.label }})
51+
runs-on: ubuntu-latest
52+
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
mode:
57+
- label: default
58+
group_commit_enabled: false
59+
- label: with_group_commit
60+
group_commit_enabled: true
61+
62+
steps:
63+
- uses: actions/checkout@v5
64+
65+
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }})
66+
uses: actions/setup-java@v5
67+
with:
68+
java-version: ${{ env.JAVA_VERSION }}
69+
distribution: ${{ env.JAVA_VENDOR }}
70+
71+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test
72+
uses: actions/setup-java@v5
73+
if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}}
74+
with:
75+
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}
76+
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}
77+
78+
- name: Login to Oracle container registry
79+
uses: docker/login-action@v3
80+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
81+
with:
82+
registry: container-registry.oracle.com
83+
username: ${{ secrets.OCR_USERNAME }}
84+
password: ${{ secrets.OCR_TOKEN }}
85+
86+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test
87+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
88+
run: |
89+
container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}")
90+
docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id"
91+
- name: Setup Gradle
92+
uses: gradle/actions/setup-gradle@v5
93+
94+
- name: Execute Gradle 'integrationTestObjectStorage' task
95+
run: ./gradlew integrationTestObjectStorage -Dscalardb.object_storage.storage=s3 -Dscalardb.object_storage.endpoint=${{ env.S3_REGION }}/${{ env.S3_BUCKET_NAME }} ${{ matrix.mode.group_commit_enabled && env.INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT || '' }}
96+
97+
- name: Upload Gradle test reports
98+
if: always()
99+
uses: actions/upload-artifact@v5
100+
with:
101+
name: cassandra_3.0_integration_test_reports_${{ matrix.mode.label }}
102+
path: core/build/reports/tests/integrationTestObjectStorage

build.gradle

Lines changed: 4 additions & 4 deletions
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'
@@ -38,13 +38,13 @@ subprojects {
3838
sqlserverDriverVersion = '12.8.2.jre8'
3939
sqliteDriverVersion = '3.51.0.0'
4040
yugabyteDriverVersion = '42.7.3-yb-4'
41-
db2DriverVersion = '12.1.2.0'
41+
db2DriverVersion = '12.1.3.0'
4242
mariadDbDriverVersion = '3.5.6'
43-
alloyDbJdbcConnectorVersion = '1.2.7'
43+
alloyDbJdbcConnectorVersion = '1.2.8'
4444
picocliVersion = '4.7.7'
4545
commonsTextVersion = '1.14.0'
4646
junitVersion = '5.14.1'
47-
commonsLangVersion = '3.19.0'
47+
commonsLangVersion = '3.20.0'
4848
assertjVersion = '3.27.6'
4949
mockitoVersion = '4.11.0'
5050
spotbugsVersion = '4.8.6'

core/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,15 @@ 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}"
174174
implementation platform("software.amazon.awssdk:bom:${awssdkVersion}")
175175
implementation 'software.amazon.awssdk:applicationautoscaling'
176176
implementation 'software.amazon.awssdk:dynamodb'
177+
implementation 'software.amazon.awssdk:s3'
178+
implementation 'software.amazon.awssdk:aws-crt-client'
177179
testImplementation 'software.amazon.awssdk:iam'
178180
testImplementation 'software.amazon.awssdk:iam-policy-builder'
179181
implementation "org.apache.commons:commons-dbcp2:${commonsDbcp2Version}"

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private void execute(String sql) throws SQLException {
9090
@Override
9191
public boolean tableExists(String namespace, String table) throws Exception {
9292
String fullTableName = rdbEngine.encloseFullTableName(namespace, table);
93-
String sql = rdbEngine.tableExistsInternalTableCheckSql(fullTableName);
93+
String sql = rdbEngine.internalTableExistsCheckSql(fullTableName);
9494
try (Connection connection = dataSource.getConnection();
9595
Statement statement = connection.createStatement()) {
9696
statement.execute(sql);

core/src/integration-test/java/com/scalar/db/storage/multistorage/MultiStorageAdminTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private boolean tableExistsOnCassandra(String namespace, String table) {
227227

228228
private boolean tableExistsOnJdbc(String namespace, String table) throws Exception {
229229
String fullTableName = rdbEngine.encloseFullTableName(namespace, table);
230-
String sql = rdbEngine.tableExistsInternalTableCheckSql(fullTableName);
230+
String sql = rdbEngine.internalTableExistsCheckSql(fullTableName);
231231
try (Connection connection = dataSource.getConnection();
232232
Statement statement = connection.createStatement()) {
233233
statement.execute(sql);

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ConsensusCommitAdminIntegrationTestWithObjectStorage.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2727
return new ObjectStorageAdminTestUtils(getProperties(testName));
2828
}
2929

30-
@Override
31-
@Disabled("Temporarily disabled because it includes DML operations")
32-
public void truncateTable_ShouldTruncateProperly() {}
33-
3430
@Override
3531
@Disabled("Object Storage does not support index-related operations")
3632
public void createIndex_ForAllDataTypesWithExistingData_ShouldCreateIndexesCorrectly() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig;
4+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitCrossPartitionScanIntegrationTestBase;
5+
import java.util.Properties;
6+
import org.junit.jupiter.api.Disabled;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class ConsensusCommitCrossPartitionScanIntegrationTestWithObjectStorage
10+
extends ConsensusCommitCrossPartitionScanIntegrationTestBase {
11+
12+
@Override
13+
protected Properties getProps(String testName) {
14+
Properties properties = ConsensusCommitObjectStorageEnv.getProperties(testName);
15+
properties.setProperty(ConsensusCommitConfig.ISOLATION_LEVEL, "SERIALIZABLE");
16+
return properties;
17+
}
18+
19+
@Test
20+
@Override
21+
@Disabled("Cross-partition scan with ordering is not supported in Object Storage")
22+
public void scan_CrossPartitionScanWithOrderingGivenForCommittedRecord_ShouldReturnRecords() {}
23+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.api.TableMetadata;
4+
import com.scalar.db.io.DataType;
5+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitIntegrationTestBase;
6+
import java.util.Properties;
7+
import org.junit.jupiter.api.Disabled;
8+
9+
public class ConsensusCommitIntegrationTestWithObjectStorage
10+
extends ConsensusCommitIntegrationTestBase {
11+
12+
@Override
13+
protected TableMetadata getTableMetadata() {
14+
return TableMetadata.newBuilder()
15+
.addColumn(ACCOUNT_ID, DataType.INT)
16+
.addColumn(ACCOUNT_TYPE, DataType.INT)
17+
.addColumn(BALANCE, DataType.INT)
18+
.addColumn(SOME_COLUMN, DataType.INT)
19+
.addColumn(BOOLEAN_COL, DataType.BOOLEAN)
20+
.addColumn(BIGINT_COL, DataType.BIGINT)
21+
.addColumn(FLOAT_COL, DataType.FLOAT)
22+
.addColumn(DOUBLE_COL, DataType.DOUBLE)
23+
.addColumn(TEXT_COL, DataType.TEXT)
24+
.addColumn(BLOB_COL, DataType.BLOB)
25+
.addColumn(DATE_COL, DataType.DATE)
26+
.addColumn(TIME_COL, DataType.TIME)
27+
.addColumn(TIMESTAMPTZ_COL, DataType.TIMESTAMPTZ)
28+
.addColumn(TIMESTAMP_COL, DataType.TIMESTAMP)
29+
.addPartitionKey(ACCOUNT_ID)
30+
.addClusteringKey(ACCOUNT_TYPE)
31+
.build();
32+
}
33+
34+
@Override
35+
protected Properties getProps(String testName) {
36+
return ConsensusCommitObjectStorageEnv.getProperties(testName);
37+
}
38+
39+
@Override
40+
@Disabled("Object Storage does not support index-related operations")
41+
public void get_GetGivenForIndexColumn_ShouldReturnRecords() {}
42+
43+
@Override
44+
@Disabled("Object Storage does not support index-related operations")
45+
public void scanOrGetScanner_ScanGivenForIndexColumn_ShouldReturnRecords(ScanType scanType) {}
46+
47+
@Override
48+
@Disabled("Object Storage does not support index-related operations")
49+
public void scanOrGetScanner_ScanGivenForIndexColumnWithConjunctions_ShouldReturnRecords(
50+
ScanType scanType) {}
51+
}

0 commit comments

Comments
 (0)