satellite/orders: Resolve storage node addresses to IP addresses.
This change resolves all the storage node addresses to their IP addresses before giving them to the uplink so that the uplink doesn't have to resolve a hundred hosts and can immediately connect to improve uplink performance. Change-Id: Idb834351e0fece409d74c8a1c29b0b8c9b09c9ff
This commit is contained in:
parent
429f08b4f0
commit
961944f24d
@ -16,6 +16,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc"
|
||||
"storj.io/common/signing"
|
||||
"storj.io/common/storj"
|
||||
"storj.io/storj/satellite/overlay"
|
||||
@ -189,7 +190,7 @@ func (service *Service) CreateGetOrderLimitsOld(ctx context.Context, bucketID []
|
||||
|
||||
limits = append(limits, &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
})
|
||||
}
|
||||
|
||||
@ -282,7 +283,7 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, bucketID []byt
|
||||
|
||||
limits = append(limits, &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
})
|
||||
}
|
||||
|
||||
@ -390,7 +391,7 @@ func (service *Service) CreatePutOrderLimits(ctx context.Context, bucketID []byt
|
||||
|
||||
limits[pieceNum] = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
pieceNum++
|
||||
}
|
||||
@ -474,7 +475,7 @@ func (service *Service) CreateDeleteOrderLimits(ctx context.Context, bucketID []
|
||||
|
||||
limits = append(limits, &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
})
|
||||
}
|
||||
|
||||
@ -562,7 +563,7 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, bucketID []b
|
||||
|
||||
limits[piece.GetPieceNum()] = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
limitsCount++
|
||||
}
|
||||
@ -636,7 +637,7 @@ func (service *Service) CreateAuditOrderLimit(ctx context.Context, bucketID []by
|
||||
|
||||
limit = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
|
||||
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
|
||||
@ -731,7 +732,7 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, bucketID
|
||||
|
||||
limits[piece.GetPieceNum()] = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
limitsCount++
|
||||
}
|
||||
@ -832,7 +833,7 @@ func (service *Service) CreatePutRepairOrderLimits(ctx context.Context, bucketID
|
||||
|
||||
limits[pieceNum] = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
pieceNum++
|
||||
totalPiecesToRepair--
|
||||
@ -915,7 +916,7 @@ func (service *Service) CreateGracefulExitPutOrderLimit(ctx context.Context, buc
|
||||
|
||||
limit = &pb.AddressedOrderLimit{
|
||||
Limit: orderLimit,
|
||||
StorageNodeAddress: node.Address,
|
||||
StorageNodeAddress: lookupNodeAddress(ctx, node.Address),
|
||||
}
|
||||
|
||||
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
|
||||
@ -964,3 +965,10 @@ func SplitBucketID(bucketID []byte) (projectID *uuid.UUID, bucketName []byte, er
|
||||
}
|
||||
return projectID, bucketName, nil
|
||||
}
|
||||
|
||||
// lookupNodeAddress tries to resolve node address to an IP to avoid DNS lookups on the uplink side.
|
||||
func lookupNodeAddress(ctx context.Context, address *pb.NodeAddress) *pb.NodeAddress {
|
||||
new := *address
|
||||
new.Address = rpc.LookupNodeAddress(ctx, address.Address)
|
||||
return &new
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user