Skip to content
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

Merged
merged 5 commits into from
Mar 9, 2021

Conversation

mikawudi
Copy link
Contributor

@mikawudi mikawudi commented Mar 8, 2021

slaveConnectionPool can't reconnect in sentinel model
ref: #3442

Signed-off-by: mika mikawudi@qq.com

Signed-off-by: mika <mikawudi@qq.com>
private AtomicBoolean initConnError = new AtomicBoolean(false);
@Override
public void accept(Void r, Throwable ex) {
synchronized (this) {
Copy link
Member

@mrniko mrniko Mar 8, 2021

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()) {
Copy link
Member

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

for (RedisConnection connection : entry.getAllConnections()) {
?

if (!initConnError.compareAndSet(false, true)) {
return;
}
entry.closeAllConnections();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

Signed-off-by: xujie <mikawudi@qq.com>
@mrniko
Copy link
Member

mrniko commented Mar 8, 2021

Please check this comment #3455 (comment)

Signed-off-by: xujie <mikawudi@qq.com>
@@ -131,21 +131,21 @@ public void run() {
if (initPromise.isDone()) {
return;
}

Copy link
Member

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)) {
Copy link
Member

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?

Copy link
Contributor Author

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>
@mikawudi mikawudi requested a review from mrniko March 9, 2021 01:14
@@ -131,21 +131,18 @@ public void run() {
if (initPromise.isDone()) {
return;
}

Copy link
Member

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

Copy link
Contributor Author

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>
@mikawudi mikawudi requested a review from mrniko March 9, 2021 07:03
@mrniko mrniko added the bug label Mar 9, 2021
@mrniko mrniko added this to the 3.15.2 milestone Mar 9, 2021
@mrniko mrniko merged commit d0ee3ac into redisson:master Mar 9, 2021
@mrniko
Copy link
Member

mrniko commented Mar 9, 2021

Thanks for contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants