THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
public class ReassignPartitionsOptions extends AbstractOptions<ReassignPartitionsOptions> {
// Note timeoutMs() inherited from AbstractOptions
public boolean validateOnly()
/**
* Validate the request only: Do not actually trigger replica reassignment.
*/
public ReassignPartitionsOptions validateOnly(boolean validateOnly)
public long throttle() {
return throttle;
}
/**
* <p>Set the throttle rate and throttled replicas for the reassignments.
* The given throttle is in bytes/second and should be at least 1 KB/s.
* Interbroker replication traffic will be throttled to approximately the given value.
* Use Long.MAX_VALUE if the reassignment should not be throttled.</p>
*
* <p>A positive throttle is equivalent to setting:</p>
* <ul>
* <li>The leader and follower throttled rates to the given value given by throttle.</li>
* <li>The leader throttled replicas of each topic in the request to include the existing brokers having
* replicas of the partitions in the request.</li>
* <li>The follower throttled replicas of each topic in the request to include the new brokers
* for each partition in that topic.</li>
* </ul>
*
* <p>The value of {@link #autoRemoveThrottle()} will determine whether these
* throttles will be removed automatically when the reassignment completes.</p>
*
* @see AdminClient#alterInterbrokerThrottledRate(int, long, long)
* @see AdminClient#alterInterbrokerThrottledReplicas(Map)
*/
public ReassignPartitionsOptions throttle(long throttle) { ... }
public boolean autoRemoveThrottle() { ... }
/**
* True to automatically remove the throttle at the end of the current reassignment.
*/
public ReassignPartitionsOptions autoRemoveThrottle(boolean autoRemoveThrottle) { ... }
}
}
public class ReassignPartitionsResult {
public Map<TopicPartition, KafkaFuture<Void>> values();
public KafkaFuture<Void> all();
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
/** * Change the rate at which interbroker replication is throttled, replacing existing throttled rates. * For each broker *in Thethe given {@code rates}, the {@code leaderRate} of the corresponding * {@code ThrottledRate} is the throttled rate when the broker is acting as leader. and * Thethe given {@code followerRate} is the throttled rate when the broker is acting as follower. * For the throttled rates to take effect, the given broker must also be present in the * list of throttled replicas, which can be set by {@link #alterInterbrokerThrottledReplicas()}. * The throttledthrottle rates will be automatically removed at the end of the current reassignment., * unless overridden in */ the given AlterInterbrokerThrottledRateResult alterInterbrokerThrottledRate(Map<Integer, ThrottledRate>,options. * * The current rates can be obtained from {@link #describeConfigs(Collection)}. * * @param rates Map from broker id to the throttled rates for that broker. * @param options The options. */ public abstract AlterInterbrokerThrottledRateResult alterInterbrokerThrottledRate( Map<Integer, ThrottledRate> rates, AlterInterbrokerThrottledRateOptions options); |
Where:
Code Block |
---|
/** * The throttled rate for interbroker replication on a particular broker. */ public class ThrottledRate { public ThrottledRate(long leaderRate, long followerRate) { ... } /** HOW do I get the* currentThe throttled rate? when the broker is classacting AlterInterbrokerThrottledRateOptionsas {leader. */ boolean long autoRemoveThrottleleaderRate() { ... } ReassignPartitionsOptions autoRemoveThrottle(boolean)/** } |
Where:
Code Block |
---|
public class ThrottledRate { public ThrottledRate(long leaderRate, long followerRate) { ... } long leaderRate() { ... } long * The throttled rate when the broker is acting as follower. */ long followerRate() { ... } } public class AlterInterbrokerThrottledRateOptions extends AbstractOptions<AlterInterbrokerThrottledRateOptions> { public boolean autoRemoveThrottle() { ... } /** * True to automatically remove the throttle at the end of the current reassignment. */ public AlterInterbrokerThrottledRateOptions autoRemoveThrottle(boolean autoRemoveThrottle) { ... } } public class AlterInterbrokerThrottledRateResult { // package-access ctor public Map<Integer, KafkaFuture<Void>> values() { ... } public KafkaFuture<Void> all() { ... } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
/** * Set the partitions and brokers subject to the * {@linkplain #alterInterbrokerThrottledRate(Map) * interbroker throttled rate}. * The brokers specified as the {@link ThrottledReplicas#leaders()} corresponding to a * topic partition given in {@code replicas} will be subject to the leader throttled rate * when acting as the leader for that partition. * The brokers specified as the {@link ThrottledReplicas#followers()} corresponding to a * topic partition given in {@code repicas} will be subject to the follower throttled rate * when acting as the follower for that partition. * If the given {@code replicas} is null then the throttle will apply to all topic partitions on all brokers. * TODO No! It should depend on the current reassignment * * * The throttle will be automatically removed at the end of the current reassignment, * unless overridden in the given options. * * The current throttled replicas can be obtained via {@link #describeConfigs(Collection)} with a * ConfigResource with type {@link ConfigResource.Type#TOPIC TOPIC} and name "leader.replication.throttled.replicas" * or "follower.replication.throttled.replicas". */ public abstract AlterInterbrokerThrottledReplicasResult alterInterbrokerThrottledReplicas( Map<TopicPartition, ThrottledReplicas> replicas, AlterInterbrokerThrottledReplicasOptions options); |
...
Code Block |
---|
public class ThrottledReplicas { public public ThrottledReplicas(Collection<Integer> leaders, Collection<Integer> followers) { ... } /** * The brokers which should be throttled when acting as leader. A null value indicates all brokers in the cluster. */ public Collection<Integer> leaders() { .. } /** * The brokers which should be throttled when acting as follower. A null value indicates all brokers in the cluster. */ public Collection<Integer> followers() { ... } } public class AlterInterbrokerThrottledReplicasOptions extends AbstractOptions<AlterInterbrokerThrottledReplicasOptions> { public boolean autoRemoveThrottle() { ... } /** * True to automatically remove the throttle at the end of the current reassignment. */ public AlterInterbrokerThrottledReplicasOptions autoRemoveThrottle(boolean autoRemoveThrottle) { ... } } public class AlterInterbrokerThrottledReplicasResult { // package-access ctor public Map<TopicPartition, KafkaFuture<Void>> values() { ... } public KafkaFuture<Void> all() { ... } } |
...