Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorter: correct wrong metric about next duration #11577

Merged
merged 1 commit into from
Sep 9, 2024
Merged
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
10 changes: 4 additions & 6 deletions cdc/processor/sourcemanager/sorter/pebble/event_sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,22 +311,20 @@ func (s *EventSorter) SlotsAndHasher() (slotCount int, hasher func(tablepb.Span,
// fetched or not.
func (s *EventIter) Next() (event *model.PolymorphicEvent, txnFinished sorter.Position, err error) {
valid := s.iter != nil && s.iter.Valid()
var value []byte
var nextEvent *model.PolymorphicEvent

// We need to decide whether the current event is the last event in this transactions
// If the current event is the last one, we need to set txnFinished
// Thus, we need to fetch the next event and compare the commitTs and startTs with it
for valid {
nextStart := time.Now()
value = s.iter.Value()
s.nextDuration.Observe(time.Since(nextStart).Seconds())

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

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

if s.currentEvent != nil {
break
Expand Down
Loading