...
1) User application determines the maximum offset of data that can be purged per partition. This information is provided to purgeDataBefore()
as Map<TopicPartition, Long>. If users application only knows timestamp of data that can be purged per partition, they can use offsetsForTimes()
API to convert the cutoff timestamp into cutoff offset per offsetToPurge per partition before providing the map to purgeData
Before
() API.
2) Admin Client builds PurgeRequest
using the cutoff offset offsetToPurge from purgeDataBefore
() parameter and the requestTimeoutMs
is taken from the AdminClient
constructor. OnePurgeRequest
is sent to each broker that acts as leader of any partition in the request. The request should only include partitions which the broker leads.
3) After receiving the PurgeRequest
, the leader sets low_watermark
of leader replica to max
(low_watermark
, the cutoff offset offsetToPurge) for each partition in the PurgeRequest
. Those segments whose largest offset < low_watermark
will be deleted by the leader.
...