|
22 | 22 | import org.apache.fluss.client.metadata.KvSnapshots; |
23 | 23 | import org.apache.fluss.client.metadata.LakeSnapshot; |
24 | 24 | import org.apache.fluss.cluster.ServerNode; |
| 25 | +import org.apache.fluss.cluster.rebalance.GoalType; |
| 26 | +import org.apache.fluss.cluster.rebalance.RebalancePlanForBucket; |
| 27 | +import org.apache.fluss.cluster.rebalance.RebalanceResultForBucket; |
| 28 | +import org.apache.fluss.cluster.rebalance.ServerTag; |
25 | 29 | import org.apache.fluss.config.ConfigOptions; |
26 | 30 | import org.apache.fluss.config.cluster.AlterConfig; |
27 | 31 | import org.apache.fluss.config.cluster.ConfigEntry; |
| 32 | +import org.apache.fluss.exception.AuthorizationException; |
28 | 33 | import org.apache.fluss.exception.DatabaseAlreadyExistException; |
29 | 34 | import org.apache.fluss.exception.DatabaseNotEmptyException; |
30 | 35 | import org.apache.fluss.exception.DatabaseNotExistException; |
|
35 | 40 | import org.apache.fluss.exception.InvalidTableException; |
36 | 41 | import org.apache.fluss.exception.KvSnapshotNotExistException; |
37 | 42 | import org.apache.fluss.exception.LakeTableSnapshotNotExistException; |
| 43 | +import org.apache.fluss.exception.NoRebalanceInProgressException; |
38 | 44 | import org.apache.fluss.exception.NonPrimaryKeyTableException; |
39 | 45 | import org.apache.fluss.exception.PartitionAlreadyExistsException; |
40 | 46 | import org.apache.fluss.exception.PartitionNotExistException; |
| 47 | +import org.apache.fluss.exception.RebalanceFailureException; |
41 | 48 | import org.apache.fluss.exception.SchemaNotExistException; |
| 49 | +import org.apache.fluss.exception.ServerNotExistException; |
| 50 | +import org.apache.fluss.exception.ServerTagAlreadyExistException; |
| 51 | +import org.apache.fluss.exception.ServerTagNotExistException; |
42 | 52 | import org.apache.fluss.exception.TableAlreadyExistException; |
43 | 53 | import org.apache.fluss.exception.TableNotExistException; |
44 | 54 | import org.apache.fluss.exception.TableNotPartitionedException; |
|
60 | 70 |
|
61 | 71 | import java.util.Collection; |
62 | 72 | import java.util.List; |
| 73 | +import java.util.Map; |
63 | 74 | import java.util.concurrent.CompletableFuture; |
64 | 75 |
|
65 | 76 | /** |
@@ -492,4 +503,90 @@ ListOffsetsResult listOffsets( |
492 | 503 | * @return A CompletableFuture indicating completion of the operation. |
493 | 504 | */ |
494 | 505 | CompletableFuture<Void> alterClusterConfigs(Collection<AlterConfig> configs); |
| 506 | + |
| 507 | + /** |
| 508 | + * Add server tag to the specified tabletServers, one tabletServer can only have one serverTag. |
| 509 | + * |
| 510 | + * <p>If one tabletServer failed adding tag, none of the tags will take effect. |
| 511 | + * |
| 512 | + * <ul> |
| 513 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have cluster |
| 514 | + * permissions. |
| 515 | + * <li>{@link ServerNotExistException} If the tabletServer in {@code tabletServers} does not |
| 516 | + * exist. |
| 517 | + * <li>{@link ServerTagAlreadyExistException} If the server tag already exists for any one of |
| 518 | + * the tabletServers. |
| 519 | + * </ul> |
| 520 | + * |
| 521 | + * @param tabletServers the tabletServers we want to add server tags. |
| 522 | + * @param serverTag the server tag to be added. |
| 523 | + */ |
| 524 | + CompletableFuture<Void> addServerTag(List<Integer> tabletServers, ServerTag serverTag); |
| 525 | + |
| 526 | + /** |
| 527 | + * Remove server tag from the specified tabletServers. |
| 528 | + * |
| 529 | + * <p>If one tabletServer failed removing tag, none of the tags will be removed. |
| 530 | + * |
| 531 | + * <ul> |
| 532 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have cluster |
| 533 | + * permissions. |
| 534 | + * <li>{@link ServerNotExistException} If the tabletServer in {@code tabletServers} does not |
| 535 | + * exist. |
| 536 | + * <li>{@link ServerTagNotExistException} If the server tag does not exist for any one of the |
| 537 | + * tabletServers. |
| 538 | + * </ul> |
| 539 | + * |
| 540 | + * @param tabletServers the tabletServers we want to remove server tags. |
| 541 | + */ |
| 542 | + CompletableFuture<Void> removeServerTag(List<Integer> tabletServers, ServerTag serverTag); |
| 543 | + |
| 544 | + /** |
| 545 | + * Based on the provided {@code priorityGoals}, Fluss performs load balancing on the cluster's |
| 546 | + * bucket load. |
| 547 | + * |
| 548 | + * <p>More details, Fluss collects the cluster's load information and optimizes to perform load |
| 549 | + * balancing according to the user-defined {@code priorityGoals}. |
| 550 | + * |
| 551 | + * <p>Currently, Fluss only supports one active rebalance task in the cluster. If an uncompleted |
| 552 | + * rebalance task exists, an {@link RebalanceFailureException} will be thrown. |
| 553 | + * |
| 554 | + * <ul> |
| 555 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have cluster |
| 556 | + * permissions. |
| 557 | + * <li>{@link RebalanceFailureException} If the rebalance failed. Such as there is an ongoing |
| 558 | + * execution. |
| 559 | + * </ul> |
| 560 | + * |
| 561 | + * @param priorityGoals the goals to be optimized. |
| 562 | + * @param dryRun Calculate and return the rebalance optimization proposal, but do not execute |
| 563 | + * it. |
| 564 | + * @return the generated rebalance plan for all the tableBuckets which need to do rebalance. |
| 565 | + */ |
| 566 | + CompletableFuture<Map<TableBucket, RebalancePlanForBucket>> rebalance( |
| 567 | + List<GoalType> priorityGoals, boolean dryRun); |
| 568 | + |
| 569 | + /** |
| 570 | + * List the rebalance process. |
| 571 | + * |
| 572 | + * <ul> |
| 573 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have cluster |
| 574 | + * permissions. |
| 575 | + * <li>{@link NoRebalanceInProgressException} If there are no rebalance tasks in progress. |
| 576 | + * </ul> |
| 577 | + * |
| 578 | + * @return the rebalance process for all the tableBuckets doing rebalance. |
| 579 | + */ |
| 580 | + CompletableFuture<Map<TableBucket, RebalanceResultForBucket>> listRebalanceProcess(); |
| 581 | + |
| 582 | + /** |
| 583 | + * Cannel the rebalance task. |
| 584 | + * |
| 585 | + * <ul> |
| 586 | + * <li>{@link AuthorizationException} If the authenticated user doesn't have cluster |
| 587 | + * permissions. |
| 588 | + * <li>{@link NoRebalanceInProgressException} If there are no rebalance tasks in progress. |
| 589 | + * </ul> |
| 590 | + */ |
| 591 | + CompletableFuture<Void> cancelRebalance(); |
495 | 592 | } |
0 commit comments