intenthq/icicle

Exception: The logical shard ID set in Redis is less than 1 or is greater than the supported maximum of 1023

vijayrawatsan opened this issue · 2 comments

Step1) Start redis-server on local machine
Step2) SET icicle-generator-logical-shard-id 123 (using redis-cli)
Step3) Run below code

JedisIcicle redisServerOne = new JedisIcicle("127.0.0.1:6379");
List<Redis> redises = Lists.newArrayList(redisServerOne);
RoundRobinRedisPool roundRobinRedisPool = new RoundRobinRedisPool(redises);
IcicleIdGenerator icicleIdGenerator = new IcicleIdGenerator(roundRobinRedisPool);
Optional<Id> idOptional = icicleIdGenerator.generateId();
System.out.println(idOptional.get().toString());
<dependency>
    <groupId>com.intenthq.icicle</groupId>
    <artifactId>icicle-jedis</artifactId>
    <exclusions>
        <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Note:
I already have latest version of excluded dependencies.

Exception:
The logical shard ID set in Redis is less than 1 or is greater than the supported maximum of 1023

Did I miss anything?

@vijayrawatsan You need to set the shard ID to a value as described in the README (which you've done). We can't automate this safely without risking collisions, so instead we take the approach that shard IDs must be set manually.

Can you double check that SET call you did definitely worked and that doing a GET icicle-generator-logical-shard-id gives you back the 123 value you set?

@nathankleyn Thanks for the quick reply. Yep its working shard-id was removed due to some tests running in background.
Plus my original issue was due to java object serialization of value. My value was being saved as xac\xed\x00\x05t\x00\x03123
May be you could put it in FAQs 😄