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

restore: Adapt the protocol of caching storage #39541

Merged
merged 11 commits into from
Dec 1, 2022
7 changes: 7 additions & 0 deletions br/pkg/restore/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"bytes"
"context"
"crypto/tls"
"fmt"
"math/rand"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -247,6 +249,8 @@ type FileImporter struct {
rawStartKey []byte
rawEndKey []byte
supportMultiIngest bool

cacheKey string
}

// NewFileImporter returns a new file importClient.
Expand All @@ -261,6 +265,7 @@ func NewFileImporter(
backend: backend,
importClient: importClient,
isRawKvMode: isRawKvMode,
cacheKey: fmt.Sprintf("BR-%s-%d", time.Now().Format("20060102150405"), rand.Int63()),
}
}

Expand Down Expand Up @@ -636,6 +641,7 @@ func (importer *FileImporter) downloadSST(
Name: file.GetName(),
RewriteRule: rule,
CipherInfo: cipher,
StorageCacheId: importer.cacheKey,
}
log.Debug("download SST",
logutil.SSTMeta(&sstMeta),
Expand Down Expand Up @@ -715,6 +721,7 @@ func (importer *FileImporter) downloadRawKVSST(
RewriteRule: rule,
IsRawKv: true,
CipherInfo: cipher,
StorageCacheId: importer.cacheKey,
}
log.Debug("download SST", logutil.SSTMeta(&sstMeta), logutil.Region(regionInfo.Region))

Expand Down