[ https://issues.apache.org/jira/browse/GEODE-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15866251#comment-15866251 ]
Hitesh Khamesra commented on GEODE-2469: ---------------------------------------- Seems like we need to consider ":' here Redis keys Redis keys are binary safe, this means that you can use any binary sequence as a key, from a string like "foo" to the content of a JPEG file. The empty string is also a valid key. A few other rules about keys: Very long keys are not a good idea. For instance a key of 1024 bytes is a bad idea not only memory-wise, but also because the lookup of the key in the dataset may require several costly key-comparisons. Even when the task at hand is to match the existence of a large value, hashing it (for example with SHA1) is a better idea, especially from the perspective of memory and bandwidth. Very short keys are often not a good idea. There is little point in writing "u1000flw" as a key if you can instead write "user:1000:followers". The latter is more readable and the added space is minor compared to the space used by the key object itself and the value object. While short keys will obviously consume a bit less memory, your job is to find the right balance. Try to stick with a schema. For instance "object-type:id" is a good idea, as in "user:1000". Dots or dashes are often used for multi-word fields, as in "comment:1234:reply.to" or "comment:1234:reply-to". The maximum allowed key size is 512 MB. > Redis adapter Hash key support > ------------------------------ > > Key: GEODE-2469 > URL: https://issues.apache.org/jira/browse/GEODE-2469 > Project: Geode > Issue Type: Bug > Components: redis > Reporter: Gregory Green > > The Redis adapter does not appear to handle hash keys correctly. > The following Example: Redis CLI works. > localhost:11211> HSET companies name "John Smith" > Using a HSET <region>:id .. produces an error > Example: > localhost:11211> HSET companies:1000 name "John Smith" > [Server error] > [fine 2017/02/10 16:04:33.289 EST server1 <Function Execution Processor2> > tid=0x6a] Region names may only be alphanumeric and may contain hyphens or > underscores: companies: 1000 > java.lang.IllegalArgumentException: Region names may only be alphanumeric and > may contain hyphens or underscores: companies: 1000 > at > org.apache.geode.internal.cache.LocalRegion.validateRegionName(LocalRegion.java:7618) > at > org.apache.geode.internal.cache.GemFireCacheImpl.createVMRegion(GemFireCacheImpl.java:3201) > at > org.apache.geode.internal.cache.GemFireCacheImpl.basicCreateRegion(GemFireCacheImpl.java:3181) > at > org.apache.geode.internal.cache.GemFireCacheImpl.createRegion(GemFireCacheImpl.java:3169) > at org.apache.geode.cache.RegionFactory.create(RegionFactory.java:762) > at > org.apache.geode.management.internal.cli.functions.RegionCreateFunction.createRegion(RegionCreateFunction.java:355) > at > org.apache.geode.management.internal.cli.functions.RegionCreateFunction.execute(RegionCreateFunction.java:90) > at > org.apache.geode.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:333) > at > org.apache.geode.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:303) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at > org.apache.geode.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:621) > at > org.apache.geode.distributed.internal.DistributionManager$9$1.run(DistributionManager.java:1067) > at java.lang.Thread.run(Thread.java:745) > //Example Spring Data Redis Object sample > @Data > @EqualsAndHashCode() > @RedisHash(value="companies") > @NoArgsConstructor > public class Company > { > private @Id String id; > .... > //Repository > public interface CompanyRepository extends CrudRepository<Company, String> > { > .... > } > //When saving using a repository > repository.save(this.myCompany); > [Same Server error] > java.lang.IllegalArgumentException: Region names may only be alphanumeric and > may contain hyphens or underscores: > companies:f05405c2-86f2-4aaf-bd0c-6fecd483bf28 > at > org.apache.geode.internal.cache.LocalRegion.validateRegionName(LocalRegion.java:7618) > at > org.apache.geode.internal.cache.GemFireCacheImpl.createVMRegion(GemFireCacheImpl.java:3201) > at > org.apache.geode.internal.cache.GemFireCacheImpl.basicCreateRegion(GemFireCacheImpl.java:3181) > at > org.apache.geode.internal.cache.GemFireCacheImpl.createRegion(GemFireCacheImpl.java:3169) > at org.apache.geode.cache.RegionFactory.create(RegionFactory.java:762) > at > org.apache.geode.management.internal.cli.functions.RegionCreateFunction.createRegion(RegionCreateFunction.java:355) > at > org.apache.geode.management.internal.cli.functions.RegionCreateFunction.execute(RegionCreateFunction.java:90) > at > org.apache.geode.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:333) > at > org.apache.geode.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:303) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at > org.apache.geode.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:621) > at > org.apache.geode.distributed.internal.DistributionManager$9$1.run(DistributionManager.java:1067) > at java.lang.Thread.run(Thread.java:745) -- This message was sent by Atlassian JIRA (v6.3.15#6346)