Add retry time when lazy load BF (#25096)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
This commit is contained in:
Xiaofan 2023-06-25 11:32:43 +08:00 committed by GitHub
parent 4ac391db40
commit e8911ebda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -342,9 +342,10 @@ func (c *ChannelMeta) submitLoadStatsTask(s *Segment, statsBinlogs []*datapb.Fie
stats, err := c.loadStats(context.Background(), s.segmentID, s.collectionID, statsBinlogs, ts)
if err != nil {
// TODO if not retryable, add rebuild statslog logic
log.Warn("failed to lazy load statslog for segment", zap.Error(err))
log.Warn("failed to lazy load statslog for segment", zap.Int64("segment", s.segmentID), zap.Error(err))
if c.retryableLoadError(err) {
log.Info("retry load statslog")
time.Sleep(100 * time.Millisecond)
log.Warn("failed to lazy load statslog for segment, retrying...", zap.Int64("segment", s.segmentID), zap.Error(err))
c.submitLoadStatsTask(s, statsBinlogs, ts)
}
return struct{}{}, err

View File

@ -282,7 +282,7 @@ func (sr *StatsReader) GetPrimaryKeyStatsList() ([]*PrimaryKeyStats, error) {
func DeserializeStats(blobs []*Blob) ([]*PrimaryKeyStats, error) {
results := make([]*PrimaryKeyStats, 0, len(blobs))
for _, blob := range blobs {
if blob.Value == nil {
if len(blob.Value) == 0 {
continue
}
sr := &StatsReader{}
@ -297,7 +297,7 @@ func DeserializeStats(blobs []*Blob) ([]*PrimaryKeyStats, error) {
}
func DeserializeStatsList(blob *Blob) ([]*PrimaryKeyStats, error) {
if blob.Value == nil {
if len(blob.Value) == 0 {
return []*PrimaryKeyStats{}, nil
}
sr := &StatsReader{}

View File

@ -165,3 +165,12 @@ func TestDeserializeStatsFailed(t *testing.T) {
_, err := DeserializeStatsList(blob)
assert.ErrorIs(t, err, merr.ErrParameterInvalid)
}
func TestDeserializeEmptyStats(t *testing.T) {
blob := &Blob{
Value: []byte{},
}
_, err := DeserializeStats([]*Blob{blob})
assert.NoError(t, err)
}