Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

lightning: avoid directly return error if send check multi ingest request failed #1334

Merged
merged 3 commits into from
Sep 13, 2021
Merged
Changes from 1 commit
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
35 changes: 29 additions & 6 deletions pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,20 +990,43 @@ func (local *local) checkMultiIngestSupport(ctx context.Context, pdClient pd.Cli
return errors.Trace(err)
}
for _, s := range stores {
client, err := local.getImportClient(ctx, s.Id)
if err != nil {
return errors.Trace(err)
// only check up stores
if s.State != metapb.StoreState_Up {
continue
}
_, err = client.MultiIngest(ctx, &sst.MultiIngestRequest{})
if err != nil {
var err error
for i := 0; i < maxRetryTimes; i++ {
if i > 0 {
select {
case <-time.After(100 * time.Millisecond):
case <-ctx.Done():
return ctx.Err()
}
}
client, err1 := local.getImportClient(ctx, s.Id)
if err1 != nil {
err = err1
log.L().Warn("get import client failed", zap.Error(err), zap.String("store", s.Address))
continue
}
_, err = client.MultiIngest(ctx, &sst.MultiIngestRequest{})
if err == nil {
break
}
if st, ok := status.FromError(err); ok {
if st.Code() == codes.Unimplemented {
log.L().Info("multi ingest not support", zap.Any("unsupported store", s))
local.supportMultiIngest = false
return nil
}
}
return errors.Trace(err)
log.L().Warn("check multi ingest support failed", zap.Error(err), zap.String("store", s.Address),
zap.Int("retry", i))
}
if err != nil {
log.L().Warn("check multi failed all retry, fallback to false")
kennytm marked this conversation as resolved.
Show resolved Hide resolved
local.supportMultiIngest = false
return nil
}
}

Expand Down