mirror of
https://github.com/wassname/ray.git
synced 2026-08-20 12:40:44 +08:00
Shard Redis. (#539)
* Implement sharding in the Ray core * Single node Python modifications to do sharding * Do the sharding in redis.cc * Pipe num_redis_shards through start_ray.py and worker.py. * Use multiple redis shards in multinode tests. * first steps for sharding ray.global_state * Fix problem in multinode docker test. * fix runtest.py * fix some tests * fix redis shard startup * fix redis sharding * fix * fix bug introduced by the map-iterator being consumed * fix sharding bug * shard event table * update number of Redis clients to be 64K * Fix object table tests by flushing shards in between unit tests * Fix local scheduler tests * Documentation * Register shard locations in the primary shard * Add plasma unit tests back to build * lint * lint and fix build * Fix * Address Robert's comments * Refactor start_ray_processes to start Redis shard * lint * Fix global scheduler python tests * Fix redis module test * Fix plasma test * Fix component failure test * Fix local scheduler test * Fix runtest.py * Fix global scheduler test for python3 * Fix task_table_test_and_update bug, from actor task table submission race * Fix jenkins tests. * Retry Redis shard connections * Fix test cases * Convert database clients to DBClient struct * Fix race condition when subscribing to db client table * Remove unused lines, add APITest for sharded Ray * Fix * Fix memory leak * Suppress ReconstructionTests output * Suppress output for APITestSharded * Reissue task table add/update commands if initial command does not publish to any subscribers. * fix * Fix linting. * fix tests * fix linting * fix python test * fix linting
This commit is contained in:
committed by
Philipp Moritz
parent
0a4304725f
commit
ee08c8274b
@@ -2,11 +2,13 @@
|
||||
#define TEST_COMMON_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#include "common.h"
|
||||
#include "io.h"
|
||||
#include "hiredis/hiredis.h"
|
||||
#include "utstring.h"
|
||||
#include "state/redis.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
/* This function is actually not declared in standard POSIX, so declare it. */
|
||||
@@ -48,10 +50,29 @@ static inline int bind_inet_sock_retry(int *fd) {
|
||||
}
|
||||
|
||||
/* Flush redis. */
|
||||
static inline void flushall_redis() {
|
||||
static inline void flushall_redis(void) {
|
||||
/* Flush the primary shard. */
|
||||
redisContext *context = redisConnect("127.0.0.1", 6379);
|
||||
std::vector<std::string> db_shards_addresses;
|
||||
std::vector<int> db_shards_ports;
|
||||
get_redis_shards(context, db_shards_addresses, db_shards_ports);
|
||||
freeReplyObject(redisCommand(context, "FLUSHALL"));
|
||||
/* Readd the shard locations. */
|
||||
freeReplyObject(redisCommand(context, "SET NumRedisShards %d",
|
||||
db_shards_addresses.size()));
|
||||
for (int i = 0; i < db_shards_addresses.size(); ++i) {
|
||||
freeReplyObject(redisCommand(context, "RPUSH RedisShards %s:%d",
|
||||
db_shards_addresses[i].c_str(),
|
||||
db_shards_ports[i]));
|
||||
}
|
||||
redisFree(context);
|
||||
|
||||
/* Flush the remaining shards. */
|
||||
for (int i = 0; i < db_shards_addresses.size(); ++i) {
|
||||
context = redisConnect(db_shards_addresses[i].c_str(), db_shards_ports[i]);
|
||||
freeReplyObject(redisCommand(context, "FLUSHALL"));
|
||||
redisFree(context);
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup method for running tests with the greatest library.
|
||||
|
||||
Reference in New Issue
Block a user