Skip to content

Commit 4352fb3

Browse files
committed
chore: fix typos and check slice len
1 parent da4e2f2 commit 4352fb3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

server/libs/grpc/grpc_platformdata.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const (
5252
LruCap = 1 << 17
5353
GROUPID_MAX = 1 << 16
5454

55-
MASTER_TABLE_MOUDLE_NANE = "ingester"
55+
MASTER_TABLE_MODULE_NAME = "ingester"
5656
MAX_ORG_COUNT = ckdb.MAX_ORG_ID + 1
5757
)
5858

@@ -444,37 +444,37 @@ func NewPlatformDataManager(ips []net.IP, port, maxSlaveTableSize, rpcMaxMsgSize
444444
return platformDataManager
445445
}
446446

447-
func (m *PlatformDataManager) NewPlatformInfoTable(moudleName string) (*PlatformInfoTable, error) {
447+
func (m *PlatformDataManager) NewPlatformInfoTable(moduleName string) (*PlatformInfoTable, error) {
448448
m.tableLock.Lock()
449449
if m.masterTable == nil {
450-
// the master table moudleName must be 'ingester', the Controller adds datanode information according to the name of the request is 'ingester'.
451-
m.masterTable = NewPlatformInfoTable(m.ips, m.port, 0, m.rpcMaxMsgSize, MASTER_TABLE_MOUDLE_NANE, m.nodeIP, m.receiver, true, m)
450+
// the master table moduleName must be 'ingester', the Controller adds datanode information according to the name of the request is 'ingester'.
451+
m.masterTable = NewPlatformInfoTable(m.ips, m.port, 0, m.rpcMaxMsgSize, MASTER_TABLE_MODULE_NAME, m.nodeIP, m.receiver, true, m)
452452
m.masterTable.Start()
453-
if moudleName == MASTER_TABLE_MOUDLE_NANE {
453+
if moduleName == MASTER_TABLE_MODULE_NAME {
454454
m.tableLock.Unlock()
455455
return m.masterTable, nil
456456
}
457457
}
458458
m.tableLock.Unlock()
459-
if moudleName == MASTER_TABLE_MOUDLE_NANE {
459+
if moduleName == MASTER_TABLE_MODULE_NAME {
460460
return m.masterTable, nil
461461
}
462462

463463
index := int(atomic.AddUint32(&m.slaveCount, 1)) - 1
464464
if index >= m.maxSlaveTableSize {
465-
err := fmt.Errorf("new platformData table %s failed, slave talbes has reached the maximum capacity(%d) and cannot be added", moudleName, m.maxSlaveTableSize)
465+
err := fmt.Errorf("new platformData table %s failed, slave tables has reached the maximum capacity(%d) and cannot be added", moduleName, m.maxSlaveTableSize)
466466
log.Error(err)
467467
return nil, err
468468
}
469-
m.slaveTables[index] = NewPlatformInfoTable(m.ips, m.port, index, m.rpcMaxMsgSize, moudleName, m.nodeIP, m.receiver, false, m)
469+
m.slaveTables[index] = NewPlatformInfoTable(m.ips, m.port, index, m.rpcMaxMsgSize, moduleName, m.nodeIP, m.receiver, false, m)
470470
return m.slaveTables[index], nil
471471
}
472472

473473
func (m *PlatformDataManager) GetMasterPlatformInfoTable() *PlatformInfoTable {
474474
if m.masterTable != nil {
475475
return m.masterTable
476476
}
477-
m.NewPlatformInfoTable(MASTER_TABLE_MOUDLE_NANE)
477+
m.NewPlatformInfoTable(MASTER_TABLE_MODULE_NAME)
478478
return m.masterTable
479479
}
480480

server/libs/grpc/utils_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ func Lookup(host net.IP) (net.IP, error) {
2828
if err != nil {
2929
return nil, fmt.Errorf("RouteGet %v %s", host, err)
3030
}
31+
if len(routes) == 0 {
32+
return nil, fmt.Errorf("RouteGet %v returned no routes", host)
33+
}
3134
route := routes[0]
3235
src := route.Src
3336
if route.Src.To4() != nil {

0 commit comments

Comments
 (0)