|
22 | 22 | import com.alibaba.fluss.client.metadata.KvSnapshots; |
23 | 23 | import com.alibaba.fluss.client.metadata.LakeSnapshot; |
24 | 24 | import com.alibaba.fluss.cluster.ServerNode; |
| 25 | +import com.alibaba.fluss.cluster.maintencance.GoalType; |
| 26 | +import com.alibaba.fluss.cluster.maintencance.RebalancePlanForBucket; |
| 27 | +import com.alibaba.fluss.cluster.maintencance.ServerTag; |
25 | 28 | import com.alibaba.fluss.config.ConfigOptions; |
| 29 | +import com.alibaba.fluss.exception.AuthorizationException; |
26 | 30 | import com.alibaba.fluss.exception.DatabaseAlreadyExistException; |
27 | 31 | import com.alibaba.fluss.exception.DatabaseNotEmptyException; |
28 | 32 | import com.alibaba.fluss.exception.DatabaseNotExistException; |
|
31 | 35 | import com.alibaba.fluss.exception.InvalidReplicationFactorException; |
32 | 36 | import com.alibaba.fluss.exception.InvalidTableException; |
33 | 37 | import com.alibaba.fluss.exception.KvSnapshotNotExistException; |
| 38 | +import com.alibaba.fluss.exception.NoRebalanceInProgressException; |
34 | 39 | import com.alibaba.fluss.exception.NonPrimaryKeyTableException; |
35 | 40 | import com.alibaba.fluss.exception.PartitionAlreadyExistsException; |
36 | 41 | import com.alibaba.fluss.exception.PartitionNotExistException; |
| 42 | +import com.alibaba.fluss.exception.RebalanceFailureException; |
37 | 43 | import com.alibaba.fluss.exception.SchemaNotExistException; |
| 44 | +import com.alibaba.fluss.exception.ServerNotExistException; |
| 45 | +import com.alibaba.fluss.exception.ServerTagAlreadyExistException; |
| 46 | +import com.alibaba.fluss.exception.ServerTagNotExistException; |
38 | 47 | import com.alibaba.fluss.exception.TableAlreadyExistException; |
39 | 48 | import com.alibaba.fluss.exception.TableNotExistException; |
40 | 49 | import com.alibaba.fluss.exception.TableNotPartitionedException; |
|
52 | 61 | import com.alibaba.fluss.metadata.TablePath; |
53 | 62 | import com.alibaba.fluss.security.acl.AclBinding; |
54 | 63 | import com.alibaba.fluss.security.acl.AclBindingFilter; |
| 64 | +import com.alibaba.fluss.shaded.netty4.io.netty.util.concurrent.CompleteFuture; |
55 | 65 |
|
56 | 66 | import java.util.Collection; |
57 | 67 | import java.util.List; |
| 68 | +import java.util.Map; |
58 | 69 | import java.util.concurrent.CompletableFuture; |
59 | 70 |
|
60 | 71 | /** |
@@ -450,4 +461,90 @@ ListOffsetsResult listOffsets( |
450 | 461 | * @return A CompletableFuture indicating completion of the operation. |
451 | 462 | */ |
452 | 463 | DropAclsResult dropAcls(Collection<AclBindingFilter> filters); |
| 464 | + |
| 465 | + /** |
| 466 | + * Add server tag to the specified tabletServers, one tabletServer can only have one serverTag. |
| 467 | + * |
| 468 | + * <p>If one tabletServer failed adding tag, none of the tags will take effect. |
| 469 | + * |
| 470 | + * <ul> |
| 471 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have reset config |
| 472 | + * access to the cluster. |
| 473 | + * <li>{@link ServerNotExistException} If the tabletServer in {@code tabletServers} does not |
| 474 | + * exist. |
| 475 | + * <li>{@link ServerTagAlreadyExistException} If the server tag already exists when {@code |
| 476 | + * overWriteIfExists} is false. |
| 477 | + * </ul> |
| 478 | + * |
| 479 | + * @param tabletServers the tabletServers we want to add server tags. |
| 480 | + * @param serverTag the server tag to be added. |
| 481 | + */ |
| 482 | + CompletableFuture<Void> addServerTag(List<Integer> tabletServers, ServerTag serverTag); |
| 483 | + |
| 484 | + /** |
| 485 | + * Remove server tag from the specified tabletServers. |
| 486 | + * |
| 487 | + * <p>If one tabletServer failed removing tag, none of the tags will be removed. |
| 488 | + * |
| 489 | + * <ul> |
| 490 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have reset config |
| 491 | + * access to the cluster. |
| 492 | + * <li>{@link ServerNotExistException} If the tabletServer in {@code tabletServers} does not |
| 493 | + * exist. |
| 494 | + * <li>{@link ServerTagNotExistException} If the server tag does not exist when {@code |
| 495 | + * overWriteIfExists} is false. |
| 496 | + * </ul> |
| 497 | + * |
| 498 | + * @param tabletServers the tabletServers we want to remove server tags. |
| 499 | + */ |
| 500 | + CompletableFuture<Void> removeServerTag(List<Integer> tabletServers, ServerTag serverTag); |
| 501 | + |
| 502 | + /** |
| 503 | + * Based on the provided {@code priorityGoals}, Fluss performs load balancing on the cluster's |
| 504 | + * bucket load. |
| 505 | + * |
| 506 | + * <p>More details, Fluss collects the cluster's load information and optimizes to perform load |
| 507 | + * balancing according to the user-defined {@code priorityGoals}. |
| 508 | + * |
| 509 | + * <p>Currently, Fluss only supports one active rebalance task in the cluster. If an uncompleted |
| 510 | + * rebalance task exists, an {@link RebalanceFailureException} will be thrown. |
| 511 | + * |
| 512 | + * <ul> |
| 513 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have reset config |
| 514 | + * access to the cluster. |
| 515 | + * <li>{@link RebalanceFailureException} If the rebalance failed. Such as there is an ongoing |
| 516 | + * execution. |
| 517 | + * </ul> |
| 518 | + * |
| 519 | + * @param priorityGoals the goals to be optimized. |
| 520 | + * @param dryRun Calculate and return the rebalance optimization proposal, but do not execute |
| 521 | + * it. |
| 522 | + * @return the generated rebalance plan for all the tableBuckets which need to do rebalance. |
| 523 | + */ |
| 524 | + CompleteFuture<Map<TableBucket, RebalancePlanForBucket>> rebalance( |
| 525 | + List<GoalType> priorityGoals, boolean dryRun); |
| 526 | + |
| 527 | + /** |
| 528 | + * List the rebalance process. |
| 529 | + * |
| 530 | + * <ul> |
| 531 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have reset config |
| 532 | + * access to the cluster. |
| 533 | + * <li>{@link NoRebalanceInProgressException} If there are no rebalance tasks in progress. |
| 534 | + * </ul> |
| 535 | + * |
| 536 | + * @return the rebalance process for all the tableBuckets doing rebalance. |
| 537 | + */ |
| 538 | + CompleteFuture<Map<TableBucket, RebalanceResultForBucket>> listRebalanceProcess(); |
| 539 | + |
| 540 | + /** |
| 541 | + * Cannel the rebalance task. |
| 542 | + * |
| 543 | + * <ul> |
| 544 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have reset config |
| 545 | + * access to the cluster. |
| 546 | + * <li>{@link NoRebalanceInProgressException} If there are no rebalance tasks in progress. |
| 547 | + * </ul> |
| 548 | + */ |
| 549 | + CompletableFuture<Void> cancelRebalance(); |
453 | 550 | } |
0 commit comments