Unverified Commit 2a2ab6eb authored by Aravind Yeduvaka's avatar Aravind Yeduvaka Committed by GitHub

Fixing a bug where READONLY is run before AUTH. Causes MOVED errors when...

Fixing a bug where READONLY is run before AUTH. Causes MOVED errors when reconnecting to Clustered Slaves. (#1367)
parent d647bfb9
......@@ -1199,6 +1199,11 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
SelectDatabaseInsideWriteLock(connection, message);
if (!connection.TransactionActive)
{
// If we are executing AUTH, it means we are still unauthenticated
// Setting READONLY before AUTH always fails but we think it succeeded since
// we run it as Fire and Forget.
if (cmd != RedisCommand.AUTH)
{
var readmode = connection.GetReadModeCommand(isMasterOnly);
if (readmode != null)
......@@ -1208,7 +1213,7 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
readmode.SetRequestSent();
IncrementOpCount();
}
}
if (message.IsAsking)
{
var asking = ReusableAskingCommand;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment