public class ApiStatePersistenceStore extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
ApiStatePersistenceStore.SbkApiStatusKeySerde |
static class |
ApiStatePersistenceStore.SbkApiStatusMessageSerde |
Modifier and Type | Field and Description |
---|---|
static String |
API_STATE_TOPIC_CLEANUP_POLICY |
Constructor and Description |
---|
ApiStatePersistenceStore(kafka.server.KafkaConfig config,
org.apache.kafka.common.utils.Time time,
Map<String,Object> clientProperties) |
Modifier and Type | Method and Description |
---|---|
Map<Integer,BrokerAdditionStateRecord> |
brokerAdditionStateRecords() |
static void |
checkStartupCondition(KafkaCruiseControlConfig config,
Semaphore abortStartupCheck)
Make sure any condition needed to start this
CruiseControlComponent is satisfied. |
void |
close() |
Map<ImmutableSet<Integer>,BrokerRemovalStateRecord> |
getAllBrokerRemovalStateRecords() |
BrokerRemovalStateRecord |
getBrokerRemovalStateRecord(ImmutableSet<Integer> brokerIds) |
EvenClusterLoadStateRecord |
getEvenClusterLoadStateRecord() |
Map<Integer,Long> |
getFailedBrokers() |
void |
init(kafka.server.KafkaConfig config,
org.apache.kafka.common.utils.Time time,
Map<String,Object> clientProperties,
org.apache.kafka.connect.util.TopicAdmin topicAdmin) |
void |
save(BrokerAdditionStateRecord additionStateRecord)
Persists the given
BrokerAdditionStateRecord into the persistence store topic. |
void |
save(BrokerRemovalStateRecord removalStateRecord,
boolean isNew)
Save api status passed in as argument
removalStatus to persistence store. |
void |
save(EvenClusterLoadStateRecord stateRecord)
Method to save EvenClusterLoad status
|
void |
save(Map<Integer,Long> failedBrokers)
Save list of failed brokers to the persistence store.
|
public static final String API_STATE_TOPIC_CLEANUP_POLICY
public void init(kafka.server.KafkaConfig config, org.apache.kafka.common.utils.Time time, Map<String,Object> clientProperties, org.apache.kafka.connect.util.TopicAdmin topicAdmin)
public void close()
close
in interface AutoCloseable
public void save(BrokerAdditionStateRecord additionStateRecord) throws InterruptedException
BrokerAdditionStateRecord
into the persistence store topic.
This method blocks until it flushes the producer in order to ensure that when the method returns, the record is persisted in the topic.
It can block up to READ_TO_END_TIMEOUT_MS
.additionStateRecord
- the v2 addition state record to persist.InterruptedException
public void save(BrokerRemovalStateRecord removalStateRecord, boolean isNew) throws InterruptedException
removalStatus
to persistence store. If isNew
is set to true, the "startTime" field will be set to current time. This is the case when we acknowledge
the api request to process. Any update to api status will then onward will have this field set and the
isNew
flag should be false.
After adding the removalStatus
to topic, the method flushes the producer and then reads it back,
which may block upto READ_TO_END_TIMEOUT_MS
.InterruptedException
public BrokerRemovalStateRecord getBrokerRemovalStateRecord(ImmutableSet<Integer> brokerIds)
public Map<ImmutableSet<Integer>,BrokerRemovalStateRecord> getAllBrokerRemovalStateRecords()
public Map<Integer,BrokerAdditionStateRecord> brokerAdditionStateRecords()
public EvenClusterLoadStateRecord getEvenClusterLoadStateRecord()
public void save(Map<Integer,Long> failedBrokers) throws InterruptedException
failedBrokers
- A map of "broker id" to "broker failure time". This gets
serialized as a list and get saved as one record in the persistence topic.InterruptedException
public void save(EvenClusterLoadStateRecord stateRecord) throws InterruptedException
InterruptedException
public static void checkStartupCondition(KafkaCruiseControlConfig config, Semaphore abortStartupCheck)
CruiseControlComponent
is satisfied.