-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[Fix-18274] Fix client heartbeat not updated after database out of service for longer than session timeout time #18275
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
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -340,7 +340,7 @@ private void refreshClientsHeartbeat() { | |
| } | ||
| JdbcRegistryClientHeartbeatDTO clone = jdbcRegistryClientHeartbeatDTO.clone(); | ||
| clone.setLastHeartbeatTime(now); | ||
| jdbcRegistryClientRepository.updateById(jdbcRegistryClientHeartbeatDTO); | ||
| jdbcRegistryClientRepository.upsert(jdbcRegistryClientHeartbeatDTO); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better don't use upsert here, if the client heartbeat has been removed, then we should shutdown, since the server might have been failovered by other server.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the client is not down. The connection to the database is unreachable within more than a session timeout time. When the database is available, the client will send the heartbeat with the same client ID.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the session times out and the heartbeat is removed, the server/client should stop rather than reinsert a heartbeat, because at this point other servers may have already detected that the heartbeat is down and initiated fault-tolerance procedures.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A more recommended approach would be to throw an exception when fails, and make refreshClientsHeartbeat return directly when jdbcRegistryServerState == JdbcRegistryServerState.DISCONNECTED.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this client should be restarted manually to register it again?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The client shouldn't restarted, it should shutdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm confused. How to register this client again?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a session times out, indicating that the client has disconnected, a disconnection event must be triggered, and the service will automatically terminate without requiring re-registration.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We’d better avoid using upsert, as it may lead to split-brain issues. When the session times out, the service should terminate itself. If we want to improve failure tolerance, we should increase the session timeout instead. |
||
| jdbcRegistryClientHeartbeatDTO.setLastHeartbeatTime(clone.getLastHeartbeatTime()); | ||
| } | ||
| if (jdbcRegistryServerState == JdbcRegistryServerState.SUSPENDED) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.