Add deleterange_concurrency to filer configuration file

This commit is contained in:
yulai.li 2021-08-26 18:25:08 +08:00
parent 318757ef8c
commit c1dc5ab4ac
2 changed files with 11 additions and 1 deletions

View file

@ -236,3 +236,5 @@ enabled = false
# If you have many pd address, use ',' split then: # If you have many pd address, use ',' split then:
# pdaddrs = "pdhost1:2379, pdhost2:2379, pdhost3:2379" # pdaddrs = "pdhost1:2379, pdhost2:2379, pdhost3:2379"
pdaddrs = "localhost:2379" pdaddrs = "localhost:2379"
# Concurrency for TiKV delete range
deleterange_concurrency = 1

View file

@ -16,6 +16,10 @@ import (
"github.com/tikv/client-go/v2/txnkv" "github.com/tikv/client-go/v2/txnkv"
) )
var (
_ filer.FilerStore = ((*TikvStore)(nil))
)
func init() { func init() {
filer.Stores = append(filer.Stores, &TikvStore{}) filer.Stores = append(filer.Stores, &TikvStore{})
} }
@ -36,7 +40,11 @@ func (store *TikvStore) Initialize(config util.Configuration, prefix string) err
for _, item := range strings.Split(pdAddrsStr, ",") { for _, item := range strings.Split(pdAddrsStr, ",") {
pdAddrs = append(pdAddrs, strings.TrimSpace(item)) pdAddrs = append(pdAddrs, strings.TrimSpace(item))
} }
store.deleteRangeConcurrency = 1 drc := config.GetInt(prefix + "deleterange_concurrency")
if drc <= 0 {
drc = 1
}
store.deleteRangeConcurrency = drc
return store.initialize(pdAddrs) return store.initialize(pdAddrs)
} }