Skip to content

Commit

Permalink
Resource Control: fix segmentation violation when keyspace not set (p…
Browse files Browse the repository at this point in the history
…ingcap#251)

* fix segmentation violation when setting up ru

Signed-off-by: David <[email protected]>

* only setup resource control when cluster id not empty

Signed-off-by: David <[email protected]>

---------

Signed-off-by: David <[email protected]>
  • Loading branch information
AmoebaProtozoa authored Feb 18, 2023
1 parent bde962a commit 1a696db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,14 @@ func main() {
keyspaceMeta, err := getServerlessInfo()
mainErrHandler(err)

// RU limit.
config.DefaultResourceGroup = keyspaceMeta.Config["serverless_cluster_id"]
tikv.EnableResourceControl()
// Setup RU Limit when keyspaceMeta is non-empty.
if keyspaceMeta != nil && keyspaceMeta.Config != nil {
if clusterID, ok := keyspaceMeta.Config["serverless_cluster_id"]; ok {
log.Info("setting up serverless resource control", zap.String("clusterID", clusterID))
config.DefaultResourceGroup = clusterID
tikv.EnableResourceControl()
}
}

registerMetrics()
if variable.EnableTmpStorageOnOOM.Load() {
Expand Down

0 comments on commit 1a696db

Please sign in to comment.