StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.9k stars 1.51k forks source link

Unable to INSERT into Bloom Filter with capacity declared #1553

Closed RazmikGevorgyan closed 4 years ago

RazmikGevorgyan commented 4 years ago

StackExchange.Redis Version 2.1.58 RedisBloom release version v2.2.4

I am trying to insert an item with the stated capacity, but I get an exception

exceptionMessage

StackExchange.Redis.RedisServerException: 'Bad capacity'exception

how to reproduce

   ```
 var configuration = ConfigurationOptions.Parse("localhost:6379", true);
 configuration.SyncTimeout = 90000;
 configuration.AbortOnConnectFail = false;
  ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(configuration);
  var database = redis.GetDatabase();
 var res =  await  database.ExecuteAsync("BF.INSERT", "filter", "CAPACITY 10", "ITEMS hello");
mgravell commented 4 years ago

That message is coming directly from the server, so it isn't a library exception as such; I expect what you need here is:

 var res =  await database.ExecuteAsync("BF.INSERT", "filter", "CAPACITY", 10, "ITEMS", "hello");

I also suspect that for "cluster", you should use:

 var res =  await database.ExecuteAsync("BF.INSERT", (RedisKey)"filter", "CAPACITY", 10, "ITEMS", "hello");

to ensure that the shard is picked correctly (routing is based on keys - you need to tell it which values are actually keys)

RazmikGevorgyan commented 4 years ago

Thanks a lot works as expected