https://github.com/markmll/testdb
Illustrate problems when connections are lost while DB-aware controls are active, and provide advance warning.
https://github.com/markmll/testdb
database-component ide object-pascal postgresql
Last synced: 12 months ago
JSON representation
Illustrate problems when connections are lost while DB-aware controls are active, and provide advance warning.
- Host: GitHub
- URL: https://github.com/markmll/testdb
- Owner: MarkMLl
- License: unlicense
- Created: 2023-08-08T07:11:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-12T14:15:13.000Z (almost 3 years ago)
- Last Synced: 2025-04-07T20:54:21.201Z (about 1 year ago)
- Topics: database-component, ide, object-pascal, postgresql
- Language: Pascal
- Homepage:
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is experimental code oriented towards a PostgreSQL server, although much of it is applicable to other backends.
It illustrates that DB-aware components are prepared to accept work even if the underlying connection has failed, only throwing an error when a transaction commit is forced. Failure might be caused by, for example, the server daemon timing out due to a laptop running the client having been in a sleep state, or the client IP address being changed.
It includes investigation of the extent to which the user can at least be alerted of potential problems by recovering the client port number from the Postgres state, and using the ident protocol (port 113) to verify that there is a live connection.
This is in no way a complete implementation, for example it should indicate immediately if the client IP address has changed rather that relying on a server timeout.
Any attempt to reconnect is "left as an exercise". However comments from the HA community suggest that loss of a session might result in intractable problems if the state of an in-progress transaction is lost.