turboFei commented on code in PR #7037:
URL: https://github.com/apache/kyuubi/pull/7037#discussion_r2054539068


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala:
##########
@@ -561,6 +561,58 @@ private[v1] class BatchesResource extends 
ApiRequestContext with Logging {
     }
   }
 
+  @ApiResponse(
+    responseCode = "200",
+    content = Array(new Content(
+      mediaType = MediaType.APPLICATION_JSON,
+      schema = new Schema(implementation = classOf[ReassignBatchResponse]))),
+    description = "Reassign instance's all batch sessions to a new instance")
+  @GET
+  @Path("{kyuubiInstance}/{batchId}/reassign")
+  def reassignBatchSessions(
+      @PathParam("kyuubiInstance") kyuubiInstance: String,
+      @PathParam("batchId") batchId: String,
+      @QueryParam("force")
+      @DefaultValue("false") force: Boolean): ReassignBatchResponse = {
+    sessionManager.getBatchMetadata(batchId).map { metadata =>

Review Comment:
   some comments:
   
   1. for single batchId recovery, we can get the kyuubiInstance from metastore 
and respect the real kyuubi instance
   2. for kyuubi instance batches recovery, we should add a `size` to only 
assign the limited batches to the target kyuubi instance
   3. The response struct is better be `batchIds: List[String], 
originalKyuubiInsance: String, newKyuubiInstance: String`, we can throw 
exception if does not successful, so `success` flag seems not necessary.
   4. there is side impact if call `fe.recoverBatchSessions()`, it might 
recover all the `pending` and `running` batches  again



-- 
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: notifications-unsubscr...@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org
For additional commands, e-mail: notifications-h...@kyuubi.apache.org

Reply via email to