github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/pkg/utils/permission.go (about)

     1  package utils
     2  
     3  import "strings"
     4  
     5  var (
     6  	ioNotFoundMsg       = "notfound"
     7  	permissionDeniedMsg = "permissiondenied"
     8  )
     9  
    10  // MessageIsNotFoundStorageError checks whether the message returning from TiKV is "NotFound" storage I/O error
    11  func MessageIsNotFoundStorageError(msg string) bool {
    12  	msgLower := strings.ToLower(msg)
    13  	return strings.Contains(msgLower, "io") && strings.Contains(msgLower, ioNotFoundMsg)
    14  }
    15  
    16  // MessageIsPermissionDeniedStorageError checks whether the message returning from TiKV is "PermissionDenied" storage I/O error
    17  func MessageIsPermissionDeniedStorageError(msg string) bool {
    18  	msgLower := strings.ToLower(msg)
    19  	return strings.Contains(msgLower, permissionDeniedMsg)
    20  }