celeborn/openapi/openapi-client
gaoyajun02 1be3094fb2 [CELEBORN-2132] Enhance ratis peer add operation to support clientAddress & adminAddress
### What changes were proposed in this pull request?

This PR enhances the Ratis peer add operation to support clientAddress and adminAddress parameters with RESTful api, allowing these critical RPC endpoints to be properly configured when adding new peers to the Celeborn master cluster.

### Why are the changes needed?

Currently, when expanding the Celeborn master cluster using the ratis peer add operation, newly added peers lack clientAddress and adminAddress settings. If a newly added peer becomes the Leader, all Followers will return empty addresses to clients, causing them to attempt connections to an incorrect Leader address (127.0.0.1:0). This change ensures proper client request routing in expanded clusters.

### Does this PR introduce _any_ user-facing change?

Yes, this PR extends the API for adding Ratis peers by adding support for clientAddress and adminAddress parameters. Users will now be able to specify these addresses when adding new peers to the cluster.

### How was this patch tested?

Manual testing of cluster expansion scenarios to ensure clients can correctly connect to the Leader regardless of which peer holds leadership

```
➜ curl -sX  POST zw06-data-k8s-sparktest-node007.mt:9098/api/v1/ratis/peer/add \
  -H "Content-Type: application/json" \
  -d '{ "peers": [{"id": "2", "address": "zw06-data-k8s-sparktest-node009.mt:9872", "clientAddress": "zw06-data-k8s-sparktest-node009.mt:9097", "adminAddress":  "zw06-data-k8s-sparktest-node009.mt:9097" }] }' | jq

{
  "success": true,
  "message": "Successfully added peers ArrayBuffer(2|zw06-data-k8s-sparktest-node009.mt:9872) to group GroupInfoReply:client-3E7C9CE679B2->0group-47BEDE733167, cid=1031, SUCCESS, logIndex=0, commits[0:c224, 1:c224]."
}

➜ curl -s zw06-data-k8s-sparktest-node009.mt:9098/masterGroupInfo
====================== Master Group INFO ==============================
group id: c5196f6d-2c34-3ed3-8b8a-47bede733167
leader info: 0(zw06-data-k8s-sparktest-node007.mt:9872)

[server {
  id: "2"
  address: "zw06-data-k8s-sparktest-node009.mt:9872"
  clientAddress: "zw06-data-k8s-sparktest-node009.mt:9097"
  adminAddress: "zw06-data-k8s-sparktest-node009.mt:9097"
  startupRole: FOLLOWER
}
commitIndex: 228
, server {
  id: "0"
  address: "zw06-data-k8s-sparktest-node007.mt:9872"
  clientAddress: "zw06-data-k8s-sparktest-node007.mt:9097"
  adminAddress: "zw06-data-k8s-sparktest-node007.mt:9097"
  startupRole: FOLLOWER
}
commitIndex: 228
, server {
  id: "1"
  address: "zw06-data-k8s-sparktest-node008.mt:9872"
  clientAddress: "zw06-data-k8s-sparktest-node008.mt:9097"
  adminAddress: "zw06-data-k8s-sparktest-node008.mt:9097"
  startupRole: FOLLOWER
}
commitIndex: 228
]

```

Closes #3452 from gaoyajun02/ratis.

Authored-by: gaoyajun02 <gaoyajun02@meituan.com>
Signed-off-by: mingji <fengmingxiao.fmx@alibaba-inc.com>
2025-08-28 11:29:51 +08:00
..
src/main [CELEBORN-2132] Enhance ratis peer add operation to support clientAddress & adminAddress 2025-08-28 11:29:51 +08:00
pom.xml [CELEBORN-1477][FOLLOWUP] Remove scala binary version from openapi-client artifactId 2024-11-01 15:08:00 +08:00
README.md [CELEBORN-1601][FOLLOWUP] Refine the RESTful apis for revise lost shuffles 2024-11-12 10:11:25 +08:00

Celeborn OpenAPI Client

Note: It is recommended to use under_score style naming for new RESTful APIs to maintain consistency.

To update the OpenAPI specification

  • just update the specification under openapi/openapi-client/src/main/openapi3/ and keep the schema definitions consistent between master and worker.
  • Install JDK 11 or above by whatever mechanism is appropriate for your system, and set that version to be the default Java version (e.g., by setting env variable JAVA_HOME)
  • run the following:
    build/mvn -pl openapi/openapi-client clean package -Pgenerate
    
    or
    build/sbt "clean;celeborn-openapi-client/generate"
    
    This will regenerate the OpenAPI data models + APIs in the celeborn-openapi-client SDK.