stinger1206 commented on code in PR #115:
URL:
https://github.com/apache/doris-kafka-connector/pull/115#discussion_r4755756852
##########
src/main/java/org/apache/doris/kafka/connector/writer/DorisWriter.java:
##########
@@ -121,9 +121,13 @@ protected void initRecord(final SinkRecord record) {
}
protected void insertRecord(final SinkRecord record) {
- // discard the record if the record offset is smaller or equal to
server side offset
+ // discard the record if the record offset is smaller or equal to
server side offset.
+ // a record at or below the buffer's last offset is already buffered
(a failed flush
+ // keeps its records in the buffer; Kafka Connect redelivers the
failed put() batch),
+ // so it must not be buffered a second time.
if (record.kafkaOffset() > this.offsetPersistedInDoris.get()
- && record.kafkaOffset() > processedOffset.get()) {
+ && record.kafkaOffset() > processedOffset.get()
+ && (buffer.isEmpty() || record.kafkaOffset() >
buffer.getLastOffset())) {
Review Comment:
Not directly. This PR preserves buffers in the default sink service's
synchronous writers.
In combined-flush mode, `AsyncStreamLoadWriter` overrides the relevant
methods and passes buffers to `AsyncDorisStreamLoad`. The failed asynchronous
buffers are therefore not preserved by this change.
The same buffer-preservation principle can be applied to #113, but it
requires changes to the asynchronous writer and executor.
I'll address asynchronous retry and recovery separately in #113.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]