Skip to content

Commit

Permalink
Lightning: change severity of clusterResourceCheckItem,emptyRegionChe…
Browse files Browse the repository at this point in the history
…ckItem from Critical to Warn (#37657)

close #37654
  • Loading branch information
niubell authored Sep 21, 2022
1 parent b0e0734 commit 7cbbaac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions br/pkg/lightning/restore/precheck_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (ci *clusterResourceCheckItem) getReplicaCount(ctx context.Context) (uint64
func (ci *clusterResourceCheckItem) Check(ctx context.Context) (*CheckResult, error) {
theResult := &CheckResult{
Item: ci.GetCheckItemID(),
Severity: Critical,
Severity: Warn,
Passed: true,
Message: "Cluster resources are rich for this import task",
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func (ci *emptyRegionCheckItem) GetCheckItemID() CheckItemID {
func (ci *emptyRegionCheckItem) Check(ctx context.Context) (*CheckResult, error) {
theResult := &CheckResult{
Item: ci.GetCheckItemID(),
Severity: Critical,
Severity: Warn,
Passed: true,
Message: "Cluster doesn't have too many empty regions",
}
Expand Down
23 changes: 23 additions & 0 deletions br/pkg/lightning/restore/precheck_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (s *precheckImplSuite) TestClusterResourceCheckBasic() {
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.T().Logf("check result message: %s", result.Message)
s.Require().Equal(Warn, result.Severity)
s.Require().True(result.Passed)

testMockSrcData := s.generateMockData(1, 1, 1,
Expand All @@ -142,6 +143,7 @@ func (s *precheckImplSuite) TestClusterResourceCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)

Expand All @@ -154,6 +156,7 @@ func (s *precheckImplSuite) TestClusterResourceCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckTargetClusterSize, result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)
}
Expand All @@ -173,6 +176,7 @@ func (s *precheckImplSuite) TestClusterVersionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)
}
Expand All @@ -192,6 +196,7 @@ func (s *precheckImplSuite) TestEmptyRegionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -214,6 +219,7 @@ func (s *precheckImplSuite) TestEmptyRegionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckTargetClusterEmptyRegion, result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -233,6 +239,7 @@ func (s *precheckImplSuite) TestRegionDistributionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -254,6 +261,7 @@ func (s *precheckImplSuite) TestRegionDistributionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckTargetClusterRegionDist, result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -274,6 +282,7 @@ func (s *precheckImplSuite) TestStoragePermissionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -282,6 +291,7 @@ func (s *precheckImplSuite) TestStoragePermissionCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckSourcePermission, result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -301,6 +311,7 @@ func (s *precheckImplSuite) TestLargeFileCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -319,6 +330,7 @@ func (s *precheckImplSuite) TestLargeFileCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -340,6 +352,7 @@ func (s *precheckImplSuite) TestLocalDiskPlacementCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -349,6 +362,7 @@ func (s *precheckImplSuite) TestLocalDiskPlacementCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckLocalDiskPlacement, result.Item)
s.Require().Equal(Warn, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -369,6 +383,7 @@ func (s *precheckImplSuite) TestLocalTempKVDirCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -387,6 +402,7 @@ func (s *precheckImplSuite) TestLocalTempKVDirCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand All @@ -408,6 +424,7 @@ func (s *precheckImplSuite) TestCheckpointCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)
}
Expand Down Expand Up @@ -445,6 +462,7 @@ func (s *precheckImplSuite) TestSchemaCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -463,6 +481,7 @@ func (s *precheckImplSuite) TestSchemaCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand Down Expand Up @@ -499,6 +518,7 @@ func (s *precheckImplSuite) TestCSVHeaderCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -517,6 +537,7 @@ func (s *precheckImplSuite) TestCSVHeaderCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
Expand Down Expand Up @@ -545,6 +566,7 @@ func (s *precheckImplSuite) TestTableEmptyCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(ci.GetCheckItemID(), result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().True(result.Passed)

Expand All @@ -555,6 +577,7 @@ func (s *precheckImplSuite) TestTableEmptyCheckBasic() {
s.Require().NoError(err)
s.Require().NotNil(result)
s.Require().Equal(CheckTargetTableEmpty, result.Item)
s.Require().Equal(Critical, result.Severity)
s.T().Logf("check result message: %s", result.Message)
s.Require().False(result.Passed)
}
8 changes: 4 additions & 4 deletions br/pkg/lightning/restore/table_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@ func (s *tableRestoreSuite) TestCheckClusterResource() {
"max-replicas": 1
}`),
"(.*)Cluster doesn't have enough space(.*)",
false,
1,
true,
0,
},
}

Expand Down Expand Up @@ -1214,8 +1214,8 @@ func (s *tableRestoreSuite) TestCheckClusterRegion() {
".*TiKV stores \\(1\\) contains more than 500 empty regions respectively.*",
".*Region distribution is unbalanced.*but we expect it should not be less than 0.75.*",
},
expectResult: false,
expectErrorCnt: 1,
expectResult: true,
expectErrorCnt: 0,
},
{
stores: pdtypes.StoresInfo{Stores: []*pdtypes.StoreInfo{
Expand Down

0 comments on commit 7cbbaac

Please sign in to comment.