loupipalien commented on code in PR #9961:
URL: https://github.com/apache/seatunnel/pull/9961#discussion_r2442768297
##########
seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/sink/MilvusSinkWriter.java:
##########
@@ -41,13 +47,29 @@ public class MilvusSinkWriter
private final MilvusBufferBatchWriter batchWriter;
private ReadonlyConfig config;
+ private final ScheduledExecutorService scheduler;
+
+ private final ReentrantLock lock = new ReentrantLock();
+
+ private final AtomicReference<Exception> exception = new
AtomicReference<>();
+
public MilvusSinkWriter(
Context context,
CatalogTable catalogTable,
ReadonlyConfig config,
List<MilvusSinkState> milvusSinkStates) {
this.batchWriter = new MilvusBufferBatchWriter(catalogTable, config);
this.config = config;
+ int batchInterval = config.get(MilvusSinkOptions.BATCH_INTERVAL);
+ this.scheduler = batchInterval > 0 ?
Executors.newSingleThreadScheduledExecutor() : null;
+ if (scheduler != null) {
+ log.info("create Milvus sink writer with batch interval: {}",
batchInterval);
+ scheduler.scheduleAtFixedRate(
+ new BatchWriterFlushRunnable(batchWriter),
+ 0,
+ batchInterval,
+ TimeUnit.MILLISECONDS);
+ }
Review Comment:
@zhangshenghang Got it. There is a question, if i want to reduce data
visibility needs to be ensured, the `checkpoint.interval` needs to be set
relatively small, but frequent checkpoints are likely to affect performance.
Adding a new `batch_interval` parameter can avoid frequent checkpoints to
ensure data visibility, but the visibility delay of the last few data entries
will still be `checkpoint.inteval` rather than `batch_interval`, it can not
ensure a unified visibility delay.
Need your suggestion, adding a new parameter `batch_interval` or using
`checkpoint.inteval` to control interval flush?
--
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]