fix access to redis dictionary after connection was dropped once

This commit is contained in:
Anton Popov 2020-07-29 19:20:17 +03:00
parent 89abf4a7b0
commit 2bdf276687

View File

@ -139,6 +139,9 @@ namespace DB
BlockInputStreamPtr RedisDictionarySource::loadAll()
{
if (!client->isConnected())
client->connect(host, port);
RedisCommand command_for_keys("KEYS");
command_for_keys << "*";
@ -189,6 +192,9 @@ namespace DB
BlockInputStreamPtr RedisDictionarySource::loadIds(const std::vector<UInt64> & ids)
{
if (!client->isConnected())
client->connect(host, port);
if (storage_type != RedisStorageType::SIMPLE)
throw Exception{"Cannot use loadIds with \'simple\' storage type", ErrorCodes::UNSUPPORTED_METHOD};