Distribute lagging replicas across replica groups to reduce head-of-l… #6752
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
| # Starter workflow to use github-actions ci. This checks out repository, builds and runs unit tests. | |
| # Reference: https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle | |
| name: Github Actions CI | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ '**' ] | |
| # Cancel a PR's in-progress run when a new commit is pushed to the same PR. | |
| # Master pushes never cancel each other so every master SHA gets a green build. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # ============================================================ | |
| # Per-group unit-test jobs. | |
| # | |
| # Each group is a top-level job — fully independent of every other (no `needs:`, | |
| # not a matrix). One group failing does NOT cancel any others. Each job calls | |
| # the composite action at .github/actions/run-unit-test which encapsulates | |
| # the per-group setup and gradle invocation. | |
| # | |
| # Groups were chosen to balance per-job wall-clock and shared setup needs: | |
| # - clustermap and network (the slowest modules) get their own runner | |
| # - frontend gets its own runner (Netty/REST stack) | |
| # - MySQL-using modules grouped to share a single MySQL setup; this includes | |
| # ambry-router because NonBlockingRouterTest needs the AmbryRepairRequests DB | |
| # - Azurite-using modules grouped to share a single Azurite install | |
| # - Utility modules (utils, commons, prioritization, quota, tools, filesystem) | |
| # bundled in one runner to amortize VM provisioning across small modules | |
| # ============================================================ | |
| unit-test-clustermap: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-clustermap | |
| job-id-suffix: clustermap | |
| unit-test-network: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-network | |
| job-id-suffix: network | |
| unit-test-frontend: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-frontend | |
| job-id-suffix: frontend | |
| unit-test-mysql-stack: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| # ambry-router is here because NonBlockingRouterTest exercises | |
| # MysqlRepairRequestsDbFactory and needs the AmbryRepairRequests DB. | |
| modules: ambry-mysql ambry-named-mysql ambry-account ambry-router | |
| job-id-suffix: mysql-stack | |
| needs-mysql: 'true' | |
| unit-test-azure-stack: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-cloud ambry-vcr | |
| job-id-suffix: azure-stack | |
| needs-azurite: 'true' | |
| unit-test-protocols: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-replication ambry-protocol ambry-messageformat ambry-rest | |
| job-id-suffix: protocols | |
| unit-test-utility-modules: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 100, fetch-tags: true } | |
| - uses: ./.github/actions/run-unit-test | |
| with: | |
| modules: ambry-utils ambry-commons ambry-prioritization ambry-quota ambry-tools ambry-filesystem | |
| job-id-suffix: utility-modules | |
| # NOTE: ambry-file-transfer is intentionally omitted — its tests are @Ignored | |
| # today (file-copy replication path is staged-not-active in production). Add | |
| # a per-module unit-test-file-transfer job here once the path is operational. | |
| store-test: | |
| runs-on: ubuntu-latest | |
| # Hard cap matches unit-test's: prevents runaway hangs from consuming | |
| # full GitHub-default 6h timeout if a test wedges. | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout Ambry | |
| uses: actions/checkout@v4 | |
| # Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'adopt' | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Run unit tests for ambry-store | |
| with: | |
| job-id: jdk11 | |
| arguments: --scan --warning-mode=summary :ambry-store:test codeCoverageReport | |
| gradle-version: wrapper | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| timeout-minutes: 2 | |
| int-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout Ambry | |
| uses: actions/checkout@v4 | |
| # Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'adopt' | |
| - name: Set up MySQL | |
| run: | | |
| sudo systemctl start mysql.service | |
| mysql -e 'CREATE DATABASE AccountMetadata;' -uroot -proot | |
| mysql -e 'USE AccountMetadata; SOURCE ./ambry-account/src/main/resources/AccountSchema.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot -proot | |
| mysql -e 'USE ambry_container_storage_stats; SOURCE ./ambry-mysql/src/main/resources/AmbryContainerStorageStats.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot -proot | |
| mysql -e 'USE AmbryNamedBlobs; SOURCE ./ambry-named-mysql/src/main/resources/NamedBlobsSchema.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot | |
| mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot | |
| - name: Add custom MySQL user | |
| # Temporary settings to use same username and password as travis ci | |
| run: | | |
| mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot | |
| mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot | |
| mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Run integration tests excluding server integration test | |
| with: | |
| job-id: jdk11 | |
| arguments: --scan --warning-mode=summary intTest -x :ambry-server:intTest codeCoverageReport | |
| gradle-version: wrapper | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| timeout-minutes: 2 | |
| server-int-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout Ambry | |
| uses: actions/checkout@v4 | |
| # Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'adopt' | |
| - name: Set up MySQL | |
| run: | | |
| sudo systemctl start mysql.service | |
| mysql -e 'CREATE DATABASE AccountMetadata;' -uroot -proot | |
| mysql -e 'USE AccountMetadata; SOURCE ./ambry-account/src/main/resources/AccountSchema.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot -proot | |
| mysql -e 'USE ambry_container_storage_stats; SOURCE ./ambry-mysql/src/main/resources/AmbryContainerStorageStats.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot -proot | |
| mysql -e 'USE AmbryNamedBlobs; SOURCE ./ambry-named-mysql/src/main/resources/NamedBlobsSchema.ddl;' -uroot -proot | |
| mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot | |
| mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot | |
| - name: Add custom MySQL user | |
| # Temporary settings to use same username and password as travis ci | |
| run: | | |
| mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot | |
| mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot | |
| mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Run integration tests | |
| with: | |
| job-id: jdk11 | |
| arguments: --scan --warning-mode=summary :ambry-server:intTest codeCoverageReport | |
| gradle-version: wrapper | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| timeout-minutes: 2 | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - unit-test-clustermap | |
| - unit-test-network | |
| - unit-test-frontend | |
| - unit-test-mysql-stack | |
| - unit-test-azure-stack | |
| - unit-test-protocols | |
| - unit-test-utility-modules | |
| - store-test | |
| - int-test | |
| - server-int-test | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| env: | |
| ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} | |
| ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
| steps: | |
| - name: Checkout Ambry | |
| uses: actions/checkout@v4 | |
| # Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'adopt' | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Build artifacts and create pom files | |
| with: | |
| job-id: jdk11 | |
| arguments: --scan assemble publishToMavenLocal | |
| gradle-version: wrapper | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Test publication by uploading in dry run mode | |
| with: | |
| job-id: jdk11 | |
| arguments: -i --scan artifactoryPublishAll -Partifactory.dryRun | |
| gradle-version: wrapper | |
| - uses: burrunan/gradle-cache-action@v1 | |
| name: Tag and upload to JFrog Artifactory | |
| with: | |
| job-id: jdk11 | |
| arguments: -i --scan ciPerformRelease | |
| gradle-version: wrapper |