Skip to content

Commit 9738245

Browse files
authored
pd client: add valid function for pd client config (#1699)
Signed-off-by: lhy1024 <[email protected]>
1 parent 84e019e commit 9738245

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

config/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ func DefaultPDClient() PDClient {
124124
}
125125
}
126126

127+
// Valid returns true if the configuration is valid.
128+
func (p *PDClient) Valid() error {
129+
if p.PDServerTimeout == 0 {
130+
return fmt.Errorf("pd-server-timeout can not be 0")
131+
}
132+
return nil
133+
}
134+
127135
// TxnLocalLatches is the TxnLocalLatches section of the config.
128136
type TxnLocalLatches struct {
129137
Enabled bool `toml:"-" json:"-"`

0 commit comments

Comments
 (0)