redis3m icon indicating copy to clipboard operation
redis3m copied to clipboard

Redis cluster Pool is not work correctly

Open linuxpham opened this issue 10 years ago • 2 comments

Hi Mr, After compiled the tests/cluster_pool.cpp, It can not run successfully.

There is an error as this output :

Running 2 test cases... unknown location(0): fatal error in "set_key": std::runtime_error: regex_error /data/svn/sources/redis3m/tests/cluster_pool.cpp(26): last checkpoint

*** 1 failure detected in test suite "redis3m"

Redis cluster : Starting 30001 - localhost - master Starting 30002 - localhost - master Starting 30003 - localhost - master Starting 30004 - localhost - slave Starting 30005 - localhost - slave Starting 30006 - localhost - slave

Modified code tests/cluster_pool.cpp:

include "common.h"

include <boost/assign/list_of.hpp>

using namespace redis3m;

cluster_pool::ptr_t get_pool() { std::vector<std::pair<std::string, unsigned int>> arrPairCluster; arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30001)); arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30002)); arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30003)); arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30004)); arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30005)); arrPairCluster.push_back(std::pair<std::string, unsigned int>("localhost", 30006)); return redis3m::cluster_pool::create(arrPairCluster); }

BOOST_AUTO_TEST_CASE( create) { BOOST_CHECK_NO_THROW(get_pool()); }

BOOST_AUTO_TEST_CASE( set_key) { redis3m::cluster_pool::ptr_t pool = get_pool(); BOOST_CHECK_EQUAL("OK", pool->run(command("SET")("foo")("bar"))); BOOST_CHECK_EQUAL("bar", pool->run(command("GET")("foo"))); //BOOST_CHECK_EQUAL(reply::type_t::NIL, pool->run(command("GET")("test")).type());

}

What is wrong in this case ?

Thanks

linuxpham avatar Apr 14 '15 16:04 linuxpham

Are you using GCC may be? Some versions of GCC does not implement std::regex related stuff of C++11. Anyway I have to say to you that redis cluster support is just a proof of concept right now.

luca3m avatar Apr 14 '15 18:04 luca3m

Yes, i agree. After update the GCC (4.9), it works successfully. Thanks

linuxpham avatar Apr 14 '15 23:04 linuxpham