Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions downstreamadapter/sink/kafka/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func (s *sink) IsNormal() bool {
}

func (s *sink) AddDMLEvent(event *commonEvent.DMLEvent) {
if !s.isNormal.Load() {
return
}
s.eventChan.Push(event)
}

Expand Down Expand Up @@ -169,6 +172,7 @@ func (s *sink) WriteBlockEvent(event commonEvent.BlockEvent) error {
}

func (s *sink) close() {
s.isNormal.Store(false)
s.eventChan.Close()
s.rowChan.Close()
}
Expand Down Expand Up @@ -227,6 +231,11 @@ func (s *sink) calculateKeyPartitions(ctx context.Context) error {
if err != nil {
return errors.Trace(err)
}
select {
case <-ctx.Done():
return context.Cause(ctx)
default:
}
s.rowChan.Push(events...)
}
}
Expand Down Expand Up @@ -512,7 +521,12 @@ func (s *sink) getAllTableNames(ts uint64) []*commonEvent.SchemaTableName {
return s.tableSchemaStore.GetAllTableNames(ts, true)
}

<<<<<<< HEAD
func (s *sink) Close(_ bool) {
=======
func (s *sink) Close() {
s.close()
>>>>>>> 51db5185d (kafka: improve stability when creating many topics with Kafka v4 (#6081))
s.ddlProducer.Close()
s.dmlProducer.Close()
s.comp.close()
Expand Down
Loading
Loading