yuqi1129 commented on code in PR #11213:
URL: https://github.com/apache/gravitino/pull/11213#discussion_r3339357568


##########
.github/workflows/multi-instance-consistency-test.yml:
##########
@@ -0,0 +1,231 @@
+name: Multi-Instance Consistency Test
+
+# Verifies that authorization state (owners, roles, role privileges, user-role
+# grants) propagates correctly between two Gravitino instances backed by the
+# same MySQL entity store. Both instances run with the entity cache disabled
+# and authorization enabled, so the only consistency contracts under test are
+# the JcasbinAuthorizer caches and the JcasbinChangePoller invalidation paths.
+#
+# The test plan and assertions live in 
dev/ci/test_multi_instance_consistency.sh.
+
+on:
+  push:
+    branches: [ "main", "branch-*" ]
+  pull_request:
+    branches: [ "main", "branch-*" ]
+  workflow_dispatch:
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  changes:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
+        id: filter
+        with:
+          filters: |
+            authz_changes:
+              - .github/workflows/multi-instance-consistency-test.yml
+              - api/**
+              - common/**
+              - core/**
+              - server/**
+              - server-common/**
+              - conf/**
+              - scripts/mysql/**
+              - dev/ci/test_multi_instance_consistency.sh
+              - build.gradle.kts
+              - gradle.properties
+              - gradle/**
+              - settings.gradle.kts
+    outputs:
+      authz_changes: ${{ steps.filter.outputs.authz_changes }}
+
+  multi-instance-consistency:
+    needs: changes
+    if: needs.changes.outputs.authz_changes == 'true'
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    services:
+      mysql:
+        image: mysql:8.0.33
+        env:
+          MYSQL_ROOT_PASSWORD: gravitino
+          MYSQL_DATABASE: gravitino
+          MYSQL_USER: gravitino
+          MYSQL_PASSWORD: gravitino
+        ports:
+          - 3306:3306
+        options: >-
+          --health-cmd="mysqladmin ping -uroot -pgravitino --silent"
+          --health-interval=5s
+          --health-timeout=3s
+          --health-retries=20
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: actions/setup-java@v4
+        with:
+          java-version: 17
+          distribution: 'temurin'
+          cache: 'gradle'
+
+      - name: Free disk space
+        run: dev/ci/util_free_space.sh
+
+      - name: Apply Gravitino MySQL schema
+        run: |
+          # Keep in sync with the latest schema file under scripts/mysql/ when 
the version bumps.
+          mysql -h 127.0.0.1 -P 3306 -ugravitino -pgravitino gravitino \
+            < scripts/mysql/schema-1.3.0-mysql.sql
+
+      - name: Build Gravitino distribution
+        run: ./gradlew compileDistribution -PskipWeb=true -x test
+
+      - name: Stage two instances (A=8090, B=8190)
+        run: |
+          set -euo pipefail
+          # MySQL JDBC driver: the entity store needs the connector in libs/, 
not
+          # only under catalogs/jdbc-mysql/libs/ (which is for the JDBC catalog
+          # backend, not the entity store).
+          # mysql-connector-java was renamed to mysql-connector-j starting 
with 8.0.31
+          # (new Maven group: com.mysql). Use the new coordinates to match the 
version
+          # declared in gradle/libs.versions.toml.
+          JDBC_JAR=distribution/package/libs/mysql-connector-j-8.0.33.jar
+          curl -fsSL \
+            
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar
 \
+            -o "$JDBC_JAR"
+          # Verify integrity against Maven Central's published SHA-1.
+          EXPECTED_SHA1="$(curl -fsSL \
+            
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar.sha1)"
+          echo "${EXPECTED_SHA1}  ${JDBC_JAR}" | sha1sum --check
+
+          # Second instance is a full copy with its own conf/, logs/, data/.
+          cp -a distribution/package distribution/package-b
+
+          configure_instance() {

Review Comment:
   Done. Extracted all the staging + startup logic (JDBC download, 
`configure_instance()`, `patch_pid_grep()`, server start + health-wait) into 
`dev/ci/setup_multi_instance.sh`, following the same pattern as 
`util_free_space.sh` and `test_multi_instance_consistency.sh`. The YAML step is 
now a single `bash dev/ci/setup_multi_instance.sh` call.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to