-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ClientConnectionsEntry reconnect error #3455
Conversation
Signed-off-by: mika <mikawudi@qq.com>
private AtomicBoolean initConnError = new AtomicBoolean(false); | ||
@Override | ||
public void accept(Void r, Throwable ex) { | ||
synchronized (this) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to use synchronized
here since we use thread-safe initConnError
if (!initConnError.compareAndSet(false, true)) { | ||
return; | ||
} | ||
for (RedisConnection connection : entry.getAllConnections()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we do this already at
redisson/redisson/src/main/java/org/redisson/connection/pool/ConnectionPool.java
Line 135 in 8c93a3c
for (RedisConnection connection : entry.getAllConnections()) { |
if (!initConnError.compareAndSet(false, true)) { | ||
return; | ||
} | ||
entry.closeAllConnections(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's already closed at https://github.com/redisson/redisson/pull/3455/files#diff-637ba54fb9190054f7e2ae91ce22f27a77371807e352055a3131017713a84f23R135
why do we need to close it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u are right, it's my wrong, i will roll back it
Please check this comment #3455 (comment) |
Signed-off-by: xujie <mikawudi@qq.com>
@@ -131,21 +131,21 @@ public void run() { | |||
if (initPromise.isDone()) { | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid empty lines
if (ex == null) { | ||
listener.decCounter(); | ||
} else { | ||
if (!initConnError.compareAndSet(false, true)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we need this check, beacuse initCallBack will called by slaveConnectionPool and pubSubConnectionPool completed, but only can reset initialized status once
Signed-off-by: xujie <mikawudi@qq.com>
@@ -131,21 +131,18 @@ public void run() { | |||
if (initPromise.isDone()) { | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this file from changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i roll back this file to you last commit
Signed-off-by: xujie <mikawudi@qq.com>
Thanks for contribution! |
slaveConnectionPool can't reconnect in sentinel model
ref: #3442
Signed-off-by: mika mikawudi@qq.com