app/vmselect/netstorage: initializes tsw.rowsProcessed before calling tsw.f, since tsw.f can modify r.Timestamps and r.Values lengths

This commit is contained in:
Aliaksandr Valialkin 2022-07-30 00:38:54 +03:00
parent 5ddae2e293
commit c81d2b4c18
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -127,13 +127,13 @@ func (tsw *timeseriesWork) do(r *Result, workerID uint) error {
atomic.StoreUint32(tsw.mustStop, 1) atomic.StoreUint32(tsw.mustStop, 1)
return fmt.Errorf("error during time series unpacking: %w", err) return fmt.Errorf("error during time series unpacking: %w", err)
} }
tsw.rowsProcessed = len(r.Timestamps)
if len(r.Timestamps) > 0 { if len(r.Timestamps) > 0 {
if err := tsw.f(r, workerID); err != nil { if err := tsw.f(r, workerID); err != nil {
atomic.StoreUint32(tsw.mustStop, 1) atomic.StoreUint32(tsw.mustStop, 1)
return err return err
} }
} }
tsw.rowsProcessed = len(r.Values)
return nil return nil
} }