[ 
https://issues.apache.org/jira/browse/KAFKA-21562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lucy Liu reassigned KAFKA-21562:
--------------------------------

    Assignee: Lucy Liu  (was: Chia-Ping Tsai)

> Use kafka-delete-records.sh to rewrite move_start_offset
> --------------------------------------------------------
>
>                 Key: KAFKA-21562
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21562
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Assignee: Lucy Liu
>            Priority: Minor
>
>  
> {code:java}
>     def move_start_offset(self):
>         """We move the start offset of the topic by writing really old 
> messages
>         and waiting for them to be cleaned up.
>         """
>         producer = VerifiableProducer(self.test_context, 1, self.kafka, 
> self.topic,
>                                       throughput=-1, enable_idempotence=True,
>                                       create_time=1000)
>         producer.start()
>         wait_until(lambda: producer.num_acked > 0,
>                    timeout_sec=30,
>                    err_msg="Failed to get an acknowledgement for %ds" % 30)
>         # Wait 8 seconds to let the topic be seeded with messages that will
>         # be deleted. The 8 seconds is important, since we should get 2 
> deleted
>         # segments in this period based on the configured log roll time and 
> the
>         # retention check interval.
>         time.sleep(8)
>         producer.stop()
>         self.logger.info("Seeded topic with %d messages which will be 
> deleted" %\
>                          producer.num_acked)
>         # Since the configured check interval is 5 seconds, we wait another
>         # 12 seconds to ensure that at least one more cleaning so that the 
> last
>         # segment is deleted. An alternate to using timeouts is to poll each
>         # partition until the log start offset matches the end offset. The
>         # latter is more robust.
>         time.sleep(12)
> {code}
> It produces “old records” and then prays for retention. Maybe we could use 
> kafka-delete-records.sh to handle that. It means we can remove the waiting 
> from the test.
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to