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

feat: handle postgresql reconnections #745

Open
richard-ramos opened this issue Sep 15, 2023 · 1 comment
Open

feat: handle postgresql reconnections #745

richard-ramos opened this issue Sep 15, 2023 · 1 comment

Comments

@richard-ramos
Copy link
Member

Problem

When using postgresql as a database, it's possible that sometimes the DB is not available. We need to investigate whether the DB being unavailable will cause any kind of panic in the execution of waku, and add a reconnection mechanism that perhaps is already provided by the postgresql dependency we are using

This task probably makes sense to do along with #607

@harsh-98
Copy link
Contributor

harsh-98 commented Oct 19, 2023

@richard-ramos
sql.DB internally has reconnection strategy to connect again, in case all prev db connections are not alive.

There are 3 services that use db -- peerStore, store and rendevzous protocol.

  • In rendevzous protocol, we have DB wrapper over sql.DB connector. This wrapper safely uses sql.DB and in case of any db related failure it returns error. This wrapper is passed to go-libp2p-rendezvous which logs the error, and doesn't fail on db related errors.
  • In DBStore uses sql.DB for Query/GetAll,Put and MostRecentTimestamp function calls. It is used in waku_store protocol, and all errors are returned to caller. No panic causing conditions found.
  • PeerStore passes the db to go-libp2p's AddrBook, KeyBook and PeerMetaData, for storing peer details. All db related errors are handled by libp2p/peerstoreds.

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

No branches or pull requests

2 participants