Skip to content

Commit 58b40db

Browse files
xjxiaiSecloud
authored andcommitted
feat(backend): dbha-instance api optimization close #9837
1 parent 7e013a4 commit 58b40db

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

dbm-services/common/dbha/ha-module/agent/monitor_agent.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ func (a *MonitorAgent) FetchDBInstance() error {
238238
HashCnt: mod,
239239
HashValue: modValue,
240240
ClusterTypes: []string{a.DetectType},
241+
MachineOnly: true,
241242
}
242243

243244
rawInfo, err := a.CmDBClient.GetDBInstanceInfoByCityID(req)

dbm-services/common/dbha/ha-module/client/cmdb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ type DBInstanceByCityRequest struct {
4242
HashCnt int `json:"hash_cnt"`
4343
HashValue int `json:"hash_value"`
4444
ClusterTypes []string `json:"cluster_types"`
45+
//if true, only return the smallest port instance of same ip
46+
MachineOnly bool `json:"machine_only"`
4547
}
4648

4749
// DBInstanceInfo instance info
@@ -176,6 +178,7 @@ func (c *CmDBClient) GetDBInstanceInfoByCityID(requestInfo DBInstanceByCityReque
176178
HashCnt: requestInfo.HashCnt,
177179
HashValue: requestInfo.HashValue,
178180
ClusterTypes: requestInfo.ClusterTypes,
181+
MachineOnly: requestInfo.MachineOnly,
179182
}
180183

181184
log.Logger.Debugf("GetDBInstanceInfoByCityID param:%#v", req)

0 commit comments

Comments
 (0)