kaushik-develop commented on a change in pull request #12178:
URL: https://github.com/apache/pulsar/pull/12178#discussion_r718020310
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Worker.java
##########
@@ -127,6 +129,65 @@ public void rebalance() {
workers().rebalance(uri.getRequestUri(), clientAppId());
}
+ @PUT
+ @ApiOperation(
+ value = "Drains the specified worker, i.e., moves its
work-assignments to other workers"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request"),
+ @ApiResponse(code = 403, message = "The requester doesn't have
admin permissions"),
+ @ApiResponse(code = 408, message = "Request timeout"),
+ @ApiResponse(code = 409, message = "Drain already in progress"),
+ @ApiResponse(code = 503, message = "Worker service is not ready")
+ })
+ @Path("/leader/{drain}")
Review comment:
Addressed in the next iteration.
##########
File path:
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/v2/WorkerApiV2Resource.java
##########
@@ -156,6 +160,65 @@ public void rebalance() {
workers().rebalance(uri.getRequestUri(), clientAppId());
}
+ @PUT
+ @ApiOperation(
+ value = "Drains the specified worker, i.e., moves its
work-assignments to other workers"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request"),
+ @ApiResponse(code = 403, message = "The requester doesn't have
admin permissions"),
+ @ApiResponse(code = 408, message = "Request timeout"),
+ @ApiResponse(code = 409, message = "Drain already in progress"),
+ @ApiResponse(code = 503, message = "Worker service is not ready")
+ })
+ @Path("/leader/{drain}")
+ public void drainAtLeader(@PathParam("drain") String workerId) {
Review comment:
Addressed in the next iteration.
##########
File path:
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/v2/WorkerApiV2Resource.java
##########
@@ -156,6 +160,65 @@ public void rebalance() {
workers().rebalance(uri.getRequestUri(), clientAppId());
}
+ @PUT
+ @ApiOperation(
+ value = "Drains the specified worker, i.e., moves its
work-assignments to other workers"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request"),
+ @ApiResponse(code = 403, message = "The requester doesn't have
admin permissions"),
+ @ApiResponse(code = 408, message = "Request timeout"),
+ @ApiResponse(code = 409, message = "Drain already in progress"),
+ @ApiResponse(code = 503, message = "Worker service is not ready")
+ })
+ @Path("/leader/{drain}")
+ public void drainAtLeader(@PathParam("drain") String workerId) {
+ workers().drain(uri.getRequestUri(), clientAppId(), true);
+ }
+
+ @PUT
+ @ApiOperation(
+ value = "Drains this worker, i.e., moves its work-assignments to
other workers"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Invalid request"),
+ @ApiResponse(code = 403, message = "The requester doesn't have
admin permissions"),
+ @ApiResponse(code = 408, message = "Request timeout"),
+ @ApiResponse(code = 409, message = "Drain already in progress"),
+ @ApiResponse(code = 503, message = "Worker service is not ready")
+ })
+ @Path("/drain")
+ public void drain() {
+ workers().drain(uri.getRequestUri(), clientAppId(), false);
+ }
+
+ @GET
+ @ApiOperation(
+ value = "Get the status of any ongoing drain operation at the
specified worker",
+ response = LongRunningProcessStatus.class
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 403, message = "The requester doesn't have
admin permissions"),
+ @ApiResponse(code = 503, message = "Worker service is not ready")
+ })
+ @Path("/leader/{drain}")
+ public LongRunningProcessStatus getDrainStatus(@PathParam("drain") String
workerId) {
+ return workers().getDrainStatus(uri.getRequestUri(), clientAppId(),
true);
Review comment:
Addressed in the next iteration.
--
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]