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
...@@ -1200,15 +1200,20 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne ...@@ -1200,15 +1200,20 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
if (!connection.TransactionActive) if (!connection.TransactionActive)
{ {
var readmode = connection.GetReadModeCommand(isMasterOnly); // If we are executing AUTH, it means we are still unauthenticated
if (readmode != null) // Setting READONLY before AUTH always fails but we think it succeeded since
// we run it as Fire and Forget.
if (cmd != RedisCommand.AUTH)
{ {
connection.EnqueueInsideWriteLock(readmode); var readmode = connection.GetReadModeCommand(isMasterOnly);
readmode.WriteTo(connection); if (readmode != null)
readmode.SetRequestSent(); {
IncrementOpCount(); connection.EnqueueInsideWriteLock(readmode);
readmode.WriteTo(connection);
readmode.SetRequestSent();
IncrementOpCount();
}
} }
if (message.IsAsking) if (message.IsAsking)
{ {
var asking = ReusableAskingCommand; 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