@@ -46,10 +46,11 @@ type PDInstance struct {
46
46
joinEndpoints []* PDInstance
47
47
pds []* PDInstance
48
48
Process
49
+ isCSEMode bool
49
50
}
50
51
51
52
// NewPDInstance return a PDInstance
52
- func NewPDInstance (role PDRole , binPath , dir , host , configPath string , id int , pds []* PDInstance , port int ) * PDInstance {
53
+ func NewPDInstance (role PDRole , binPath , dir , host , configPath string , id int , pds []* PDInstance , port int , isCSEMode bool ) * PDInstance {
53
54
if port <= 0 {
54
55
port = 2379
55
56
}
@@ -63,8 +64,9 @@ func NewPDInstance(role PDRole, binPath, dir, host, configPath string, id int, p
63
64
StatusPort : utils .MustGetFreePort (host , port ),
64
65
ConfigPath : configPath ,
65
66
},
66
- Role : role ,
67
- pds : pds ,
67
+ Role : role ,
68
+ pds : pds ,
69
+ isCSEMode : isCSEMode ,
68
70
}
69
71
}
70
72
@@ -112,8 +114,8 @@ func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error
112
114
fmt .Sprintf ("--client-urls=http://%s" , utils .JoinHostPort (inst .Host , inst .StatusPort )),
113
115
fmt .Sprintf ("--advertise-client-urls=http://%s" , utils .JoinHostPort (AdvertiseHost (inst .Host ), inst .StatusPort )),
114
116
fmt .Sprintf ("--log-file=%s" , inst .LogFile ()),
117
+ fmt .Sprintf ("--config=%s" , configPath ),
115
118
}... )
116
-
117
119
switch {
118
120
case len (inst .initEndpoints ) > 0 :
119
121
endpoints := make ([]string , 0 )
@@ -140,9 +142,7 @@ func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error
140
142
fmt .Sprintf ("--advertise-listen-addr=http://%s" , utils .JoinHostPort (AdvertiseHost (inst .Host ), inst .StatusPort )),
141
143
fmt .Sprintf ("--backend-endpoints=%s" , strings .Join (endpoints , "," )),
142
144
fmt .Sprintf ("--log-file=%s" , inst .LogFile ()),
143
- }
144
- if inst .ConfigPath != "" {
145
- args = append (args , fmt .Sprintf ("--config=%s" , inst .ConfigPath ))
145
+ fmt .Sprintf ("--config=%s" , configPath ),
146
146
}
147
147
case PDRoleScheduling :
148
148
endpoints := pdEndpoints (inst .pds , true )
@@ -153,9 +153,7 @@ func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error
153
153
fmt .Sprintf ("--advertise-listen-addr=http://%s" , utils .JoinHostPort (AdvertiseHost (inst .Host ), inst .StatusPort )),
154
154
fmt .Sprintf ("--backend-endpoints=%s" , strings .Join (endpoints , "," )),
155
155
fmt .Sprintf ("--log-file=%s" , inst .LogFile ()),
156
- }
157
- if inst .ConfigPath != "" {
158
- args = append (args , fmt .Sprintf ("--config=%s" , inst .ConfigPath ))
156
+ fmt .Sprintf ("--config=%s" , configPath ),
159
157
}
160
158
}
161
159
0 commit comments