From befbf78048120e4f995fc1cf00927b4ea665abfc Mon Sep 17 00:00:00 2001 From: Yuhong Guo Date: Sun, 28 Oct 2018 02:58:39 +0800 Subject: [PATCH] Delete empty pubsub keys (#3146) We found that there are large amount of pub-sub keys with no content in it (This case is worse when wait-id is used in the key name.). This logic of deleting empty pub-sub keys from GCS was in legacy ray but not in raylet. --- src/ray/gcs/redis_module/ray_redis_module.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ray/gcs/redis_module/ray_redis_module.cc b/src/ray/gcs/redis_module/ray_redis_module.cc index 27758a955..56ad71582 100644 --- a/src/ray/gcs/redis_module/ray_redis_module.cc +++ b/src/ray/gcs/redis_module/ray_redis_module.cc @@ -544,6 +544,10 @@ int TableCancelNotifications_RedisCommand(RedisModuleCtx *ctx, RedisModuleString if (RedisModule_KeyType(notification_key) != REDISMODULE_KEYTYPE_EMPTY) { RAY_CHECK(RedisModule_ZsetRem(notification_key, client_channel, NULL) == REDISMODULE_OK); + size_t size = RedisModule_ValueLength(notification_key); + if (size == 0) { + CHECK_ERROR(RedisModule_DeleteKey(notification_key), "Unable to delete zset key."); + } } RedisModule_ReplyWithSimpleString(ctx, "OK");