File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
pkg/mcs/resourcemanager/server Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,11 @@ func (s *Service) setKeyspaceServiceLimit(c *gin.Context) {
376376 }
377377 keyspaceID := rmserver .ExtractKeyspaceID (keyspaceIDValue )
378378 if err := s .manager .SetKeyspaceServiceLimit (keyspaceID , req .ServiceLimit ); err != nil {
379- c .String (http .StatusBadRequest , err .Error ())
379+ if rmserver .IsMetadataWriteDisabledError (err ) {
380+ c .String (http .StatusForbidden , err .Error ())
381+ return
382+ }
383+ c .String (http .StatusInternalServerError , err .Error ())
380384 return
381385 }
382386 c .String (http .StatusOK , "Success!" )
Original file line number Diff line number Diff line change 1- // Copyright 2025 TiKV Project Authors.
1+ // Copyright 2026 TiKV Project Authors.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -39,3 +39,8 @@ func (r ResourceGroupWriteRole) AllowsStateWrite() bool {
3939}
4040
4141var errMetadataWriteDisabled = errors .New ("metadata write is disabled" )
42+
43+ // IsMetadataWriteDisabledError reports whether err is a metadata-write-disabled error.
44+ func IsMetadataWriteDisabledError (err error ) bool {
45+ return errors .ErrorEqual (err , errMetadataWriteDisabled )
46+ }
You can’t perform that action at this time.
0 commit comments