Closed q131172019 closed 1 year ago
Looks like this only support redis-server local, we may need add remote support.
run the code from remote client and received node number doesn't match:
store := redis.NewRedisClient(redisIp, false)
requiredNum := testCfg.batchNodeNum + testCfg.singleNodeNum
logicalNodes := store.BatchLogicalNodesInquiry(requiredNum)
klog.V(6).Infof("Total %v nodes required from redis server: %v, Total nodes got from redis: %v, detailes: %v\n", requiredNum, redisIp, len(logicalNodes), logicalNodes)
3 different Results with 3 runs:
I0902 16:33:09.593263 157647 singleNodeQuery.go:91] Total nodes required from redis: 11, Total nodes got from redis: 15, detailes: &[0xc000224000 0xc0002240c0 0xc000224180 0xc000224240 0xc000224300 0xc0002243c0 0xc000224480 0xc000224540 0xc000224600 0xc0002246c0 0xc000224780 0xc000224840 0xc000224900 0xc0002249c0 0xc000224a80]
I0902 16:34:35.663615 157960 singleNodeQuery.go:91] Total 11 nodes required from redis server: 104.198.205.207, Total nodes got from redis: 7, detailes: [0xc000136000 0xc0001360c0 0xc000136180 0xc000136240 0xc000136300 0xc0001363c0 0xc000136480]
I0902 16:38:16.487011 158116 singleNodeQuery.go:91] Total 11 nodes required from redis server: 104.198.205.207, Total nodes got from redis: 10, detailes: [0xc000130000 0xc0001300c0 0xc000130180 0xc000130240 0xc000130300 0xc0001303c0 0xc000130480 0xc000130540 0xc000130600 0xc0001306c0]
This PR is to 1) add function BatchLogicalNodsInquiry for Redis store, which is used by batch logicalNode status inquiry. 2) add UT test for function BatchLogicalNodesInquiry
Please Note: this PR only support Redis-server local only, another new PR will be for Redis-server remote support.
The codes have been tested successfully in local MAC development and my AWS integration test environment (500K nodes/2 regions/20 schedulers).
UT in local MAC development:
--- PASS: TestBatchLogicalNodeInquiry (1.45s) PASS ok global-resource-service/resource-management/pkg/store/redis 1.639s
carl@Carls-MacBook-Pro redis % go test
PASS ok global-resource-service/resource-management/pkg/store/redis 1.781s
ubuntu@ip-172-31-8-82:~/go/src/GRS/resource-management/pkg/store/redis$ go test -v === RUN TestNewRedisClient --- PASS: TestNewRedisClient (0.00s) === RUN TestBatchLogicalNodeInquiry redis_test.go:316: Scan (10) logical nodes and actually get (10) logical nodes redis_test.go:317: Second test is OK
--- PASS: TestBatchLogicalNodeInquiry (3.09s) PASS ok global-resource-service/resource-management/pkg/store/redis 3.095s
ubuntu@ip-172-31-8-82:~/go/src/GRS/resource-management/pkg/store/redis$ go test -v === RUN TestNewRedisClient --- PASS: TestNewRedisClient (0.00s) === RUN TestBatchLogicalNodeInquiry redis_test.go:316: Scan (10) logical nodes and actually get (11) logical nodes redis_test.go:317: Second test is OK
--- PASS: TestBatchLogicalNodeInquiry (0.87s) PASS ok global-resource-service/resource-management/pkg/store/redis 0.877s
ubuntu@ip-172-31-17-152:~/go/src/GRS/resource-management/pkg/store/redis$ go test -v === RUN TestNewRedisClient --- PASS: TestNewRedisClient (0.00s) === RUN TestBatchLogicalNodeInquiry redis_test.go:316: Scan (10) logical nodes and actually get (11) logical nodes redis_test.go:317: Second test is OK
--- PASS: TestBatchLogicalNodeInquiry (124.49s) PASS ok global-resource-service/resource-management/pkg/store/redis 124.491s
ubuntu@ip-172-31-17-152:~/go/src/GRS/resource-management/pkg/store/redis$ go test -v === RUN TestNewRedisClient --- PASS: TestNewRedisClient (0.00s) === RUN TestBatchLogicalNodeInquiry redis_test.go:316: Scan (10) logical nodes and actually get (11) logical nodes redis_test.go:317: Second test is OK
--- PASS: TestBatchLogicalNodeInquiry (125.11s) PASS ok global-resource-service/resource-management/pkg/store/redis 125.115s