-
Notifications
You must be signed in to change notification settings - Fork 40
Add support for S3 #3141
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
Open
KodaiD
wants to merge
9
commits into
master
Choose a base branch
from
add-s3-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add support for S3 #3141
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
001d495
Add support for S3
KodaiD aec6f6d
Apply suggestions
KodaiD d21120d
Fix based on review
KodaiD 32136f6
Add a newline at the EOF
KodaiD d64cf16
Apply suggestions
KodaiD aa226c4
Merge remote-tracking branch 'origin/master' into add-s3-support
KodaiD 4f6801f
Handle ConflictOccurredException exception
KodaiD ca9fe4b
Fix unit tests
KodaiD b7825fb
Fix based on review
KodaiD 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
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,102 @@ | ||
| name: Test Object Storage Adapter | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| INT_TEST_JAVA_RUNTIME_VERSION: | ||
| description: JDK version used to run the integration test | ||
| type: choice | ||
| required: false | ||
| default: '8' | ||
| options: | ||
| - '8' | ||
| - '11' | ||
| - '17' | ||
| - '21' | ||
| INT_TEST_JAVA_RUNTIME_VENDOR: | ||
| description: Vendor of the JDK used to run the integration test | ||
| type: choice | ||
| required: false | ||
| default: 'temurin' | ||
| options: | ||
| - 'corretto' | ||
| - 'microsoft' | ||
| - 'oracle' | ||
| - 'temurin' | ||
|
|
||
| env: | ||
| TERM: dumb | ||
| JAVA_VERSION: '8' | ||
| JAVA_VENDOR: 'temurin' | ||
| INT_TEST_JAVA_RUNTIME_VERSION: "${{ github.event_name != 'workflow_dispatch' && '8' || inputs.INT_TEST_JAVA_RUNTIME_VERSION }}" | ||
| INT_TEST_JAVA_RUNTIME_VENDOR: "${{ github.event_name != 'workflow_dispatch' && 'temurin' || inputs.INT_TEST_JAVA_RUNTIME_VENDOR }}" | ||
| # Gradle will parse 'ORG_GRADLE_PROJECT_<project_property_name>' environment variables as project properties. | ||
| # The following variables configure the 'com.scalar.db.jdk-configuration' Gradle plugin. | ||
| ORG_GRADLE_PROJECT_javaVersion: '8' | ||
| ORG_GRADLE_PROJECT_javaVendor: 'temurin' | ||
| ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVersion: "${{ github.event_name != 'workflow_dispatch' && '8' || inputs.INT_TEST_JAVA_RUNTIME_VERSION }}" | ||
| ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVendor: "${{ github.event_name != 'workflow_dispatch' && 'temurin' || inputs.INT_TEST_JAVA_RUNTIME_VENDOR }}" | ||
| # This variable evaluates to: if {!(Temurin JDK 8) && !(Oracle JDK)} then {true} else {false} | ||
| # Oracle JDK that are linux compatible and publicly available through direct download exist for all LTS versions | ||
| 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' }}" | ||
| 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**"' | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} | ||
| S3_REGION: ap-northeast-1 | ||
| S3_BUCKET_NAME: scalardb-test-bucket | ||
brfrn169 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| jobs: | ||
| integration-test-s3: | ||
| name: S3 integration test (${{ matrix.mode.label }}) | ||
KodaiD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| mode: | ||
| - label: default | ||
| group_commit_enabled: false | ||
| - label: with_group_commit | ||
| group_commit_enabled: true | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| distribution: ${{ env.JAVA_VENDOR }} | ||
|
|
||
| - name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test | ||
| uses: actions/setup-java@v5 | ||
| if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}} | ||
| with: | ||
| java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} | ||
| distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }} | ||
|
|
||
| - name: Login to Oracle container registry | ||
| uses: docker/login-action@v3 | ||
| if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }} | ||
| with: | ||
| registry: container-registry.oracle.com | ||
| username: ${{ secrets.OCR_USERNAME }} | ||
| password: ${{ secrets.OCR_TOKEN }} | ||
|
|
||
| - name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test | ||
| if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }} | ||
| run: | | ||
| container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}") | ||
| docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id" | ||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v5 | ||
|
|
||
| - name: Execute Gradle 'integrationTestObjectStorage' task | ||
| 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 || '' }} | ||
KodaiD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Upload Gradle test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: cassandra_3.0_integration_test_reports_${{ matrix.mode.label }} | ||
| path: core/build/reports/tests/integrationTestObjectStorage | ||
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
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
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
8 changes: 8 additions & 0 deletions
8
core/src/main/java/com/scalar/db/storage/objectstorage/ConflictOccurredException.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,8 @@ | ||
| package com.scalar.db.storage.objectstorage; | ||
|
|
||
| public class ConflictOccurredException extends ObjectStorageWrapperException { | ||
|
|
||
| public ConflictOccurredException(String message, Throwable cause) { | ||
| super(message, cause); | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ public BlobStorageConfig(DatabaseConfig databaseConfig) { | |
| bucket = fullEndpoint.substring(lastSlashIndex + 1); | ||
| } else { | ||
| throw new IllegalArgumentException( | ||
| "Invalid contact points format. Expected: BLOB_URI/BUCKET_NAME"); | ||
| "Invalid contact points format. Expected: BLOB_URI/CONTAINER_NAME"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Blob Storage, a bucket is called a container. |
||
| } | ||
| username = databaseConfig.getUsername().orElse(null); | ||
| password = databaseConfig.getPassword().orElse(null); | ||
|
|
@@ -94,11 +94,6 @@ public String getStorageName() { | |
| return STORAGE_NAME; | ||
| } | ||
|
|
||
| @Override | ||
| public String getEndpoint() { | ||
| return endpoint; | ||
| } | ||
|
|
||
| @Override | ||
| public String getUsername() { | ||
| return username; | ||
|
|
@@ -119,6 +114,10 @@ public String getMetadataNamespace() { | |
| return metadataNamespace; | ||
| } | ||
|
|
||
| public String getEndpoint() { | ||
| return endpoint; | ||
| } | ||
|
|
||
| public long getParallelUploadBlockSizeInBytes() { | ||
| return parallelUploadBlockSizeInBytes; | ||
| } | ||
|
|
||
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
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.
Since AWS does not provide an S3 emulator, and other S3-compatible storage services do not support conditional deletes, we will need to run integration tests when releasing a new ScalarDB version.