Skip to content

Commit

Permalink
sorter: fix the bug that value can be corrupted when accessing sorter (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 5, 2024
1 parent 785d41f commit 591c1e9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cdc/processor/sourcemanager/engine/pebble/event_sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,16 @@ func (s *EventIter) Next() (event *model.PolymorphicEvent, pos engine.Position,
valid := s.iter != nil && s.iter.Valid()
var value []byte
for valid {
nextStart := time.Now()
value, valid = s.iter.Value(), s.iter.Next()
s.nextDuration.Observe(time.Since(nextStart).Seconds())

value = s.iter.Value()
event = &model.PolymorphicEvent{}
if _, err = s.serde.Unmarshal(event, value); err != nil {
return
}

nextStart := time.Now()
valid = s.iter.Next()
s.nextDuration.Observe(time.Since(nextStart).Seconds())

if s.headItem != nil {
break
}
Expand Down

0 comments on commit 591c1e9

Please sign in to comment.