garnet
garnet copied to clipboard
Switching to Garnet Causes "ERR unknown command" Redis Error in Node.js Application
There is a nodejs application that uses redis without problems, but if I switch to garnet this error will appear:
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[ErrorReply: ERR unknown command]
Node.js v18.19.1
This is the client configuration
const client = redis.createClient({
url: 'redis://127.0.0.1:3278'
});
This is garnet's log
08::57::25 dbug: GarnetServer[0] [****:3278] Accepted TCP connection from 127.0.0.1:48968
08::57::25 dbug: Session[0] [****:3278] [127.0.0.1:48968] [0014B75E] Starting RespServerSession
08::57::25 dbug: Session[0] [****:3278] [127.0.0.1:48968] [0014B75E] Disposing RespServerSession
which command did you run? see the list of commands currently supported here: https://microsoft.github.io/garnet/docs/commands/api-compatibility
which command did you run? see the list of commands currently supported here: https://microsoft.github.io/garnet/docs/commands/api-compatibility
It looks like I executed the unsupported command "FLUSHALL"
How is it completed? Seems like a good issue to leave open to the community to fix to me. I assume FlushAll is non-controversial to support, as an easy enhancement to compatibility with existing redis apps.
Strawman unit test that still fails for me...
"StackExchange.Redis.RedisCommandException : This operation has been disabled in the command-map and cannot be used: FLUSHALL"
[Test]
public void SeFlushAllDatabasesTest()
{
using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig(allowAdmin: true));
IServer server = redis.GetServer($"{TestUtils.Address}:{TestUtils.Port}");
for (int dbNum = 0; dbNum <= 1; dbNum++)
{
var db = redis.GetDatabase(dbNum);
string origValue = "abcdefghij";
db.StringSet("mykey", origValue);
string retValue = db.StringGet("mykey");
Assert.AreEqual(origValue, retValue);
}
server.FlushAllDatabases();
for (int dbNum = 0; dbNum <= 1; dbNum++)
{
var db = redis.GetDatabase(dbNum);
string retValue = db.StringGet("mykey");
Assert.AreEqual(null, retValue);
}
}
The workaround is to use FLUSHDB which is supported and identical.