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

Allow to restore nodes after failed connections #2315

Closed
juliomarmin opened this issue Dec 9, 2023 · 3 comments
Closed

Allow to restore nodes after failed connections #2315

juliomarmin opened this issue Dec 9, 2023 · 3 comments
Labels
feature request mysqljs-mysql-incompatibilities Previously: feligxe-mysql-incompatibilities

Comments

@juliomarmin
Copy link

In the mysql library which is used as inspiration for this library and has quite similar API, PoolCluster has the attribute restoreNodeTimeout: a node which failed the number of times removeNodeErrorCount can be recovered to the cluster after the time specified in restoreNodeTimeout.

mysql2 has a more radical behavior by which a node is removed from the cluster forever after the removeNodeErrorCount

In our use case, we have several remote nodes; anytime one of the nodes could become unavailable, and be later recovered. With the current mysql2 behavior it will not be included again in the cluster; eventually, all nodes could become unavailable at some points, meaning the cluster will be empty, even when some nodes are available.

Rather than trying to solve it on the application, by detecting that a node has been removed from the cluster and adding it again, it would be nice if mysql2 could recover those nodes after an specified time, in a similar way as mysql implements.

@sidorares
Copy link
Owner

PoolCluster is almost entirely reused/copied from mysqljs/mysql, if there are newer changes there I'm happy to see them backported. PRs welcome @juliomarmin :)

@wellwelwel wellwelwel added the mysqljs-mysql-incompatibilities Previously: feligxe-mysql-incompatibilities label Jan 11, 2024
@wellwelwel
Copy link
Collaborator

For context

From mysqljs/mysql Documentation:

PoolCluster options

* `restoreNodeTimeout`: If connection fails, specifies the number of milliseconds

Server disconnects

With PoolCluster, disconnected connections will count as errors against the
related node, incrementing the error code for that node. Once there are more than
`removeNodeErrorCount` errors on a given node, it is removed from the cluster.
When this occurs, the PoolCluster may emit a `POOL_NONEONLINE` error if there are
no longer any matching nodes for the pattern. The `restoreNodeTimeout` config can
be set to restore offline nodes after a given timeout.

@wellwelwel
Copy link
Collaborator

Closed in #3218.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request mysqljs-mysql-incompatibilities Previously: feligxe-mysql-incompatibilities
Projects
None yet
Development

No branches or pull requests

3 participants