Commit Graph

403 Commits

Author SHA1 Message Date
Andrey b49213e066 Connect to server only when client have pending data
Currently we attach to server right after connection. This creates some
troubles especially in session pooling. With this commit we only attach
to server connection when at least one byte of client data arrived.
2020-01-14 11:50:51 +05:00
Andrey Borodin 465577dca0 Restrict number of startup sttempts 2019-12-27 17:22:32 +05:00
Andrey Borodin 887e4aa2d8 Decline GSS API request 2019-12-27 17:05:19 +05:00
Andrey Borodin c5b1a12f7d Fix clients computation during enforcing route max_clients
All router->clients interactions must be atomic.
Furthermore all decrements must go throug od_frontend_close
2019-12-25 11:35:19 +05:00
Dmitry Dolgov 4a09b5b7e9 Modifications to build on PG12 (#86)
Build seems to fail with PostgreSQL 12 version, due to incompatibility
after [1], and required presence of libpgport (to expose pg_sprintf for
scram implementation).

To improve the situation, introduce couple of changes:

* Rely on pg_config to get lib/include directories
* Add libpgport.a into linking
* Provide different versions of pg_b64_decode/encode depending on
PG_VERSION_NUM

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=cfc40d384ae51ea2886d599d2008ae57b529e6ea
2019-12-18 14:39:24 +05:00
Andrey Borodin 59857936cd Fix ignoring of SIGPIPE 2019-12-18 14:32:36 +05:00
Andrey Borodin b98d34d489 Increase default client_max_routing 2019-12-04 15:21:50 +05:00
Andrey Borodin eb7299748d Implement login timeout 2019-12-02 18:28:39 +05:00
Andrey Borodin 2262362349 Fix PostgreSQL linkage 2019-11-21 16:54:59 +05:00
Andrey Borodin 816d45958e Revert "Add pause/resume admin console commands (#66)"
This reverts commit b426f4f301.
2019-11-19 16:57:16 +05:00
Andrey Borodin 42695c614f One more compiler warning 2019-11-19 15:33:51 +05:00
Andrey Borodin 960cba4bc9 Silent more compiler warnings 2019-11-19 15:14:51 +05:00
Andrey Borodin 793f9551b0 Fix compiler warning 2019-11-19 14:59:14 +05:00
Andrey Borodin 31a61fd368 Fix db state initialization
fix some problems in #76
2019-11-19 14:55:08 +05:00
Andrey Borodin aaa613ee41 Make some error logging better 2019-11-19 13:22:59 +05:00
Andrey Borodin ef19e5bd74 Remove db_state from route 2019-11-18 13:32:03 +05:00
Dima Starkov a8ca664a63 Implements SCRAM Authentication (#73) 2019-11-11 12:28:50 +03:00
lowgear b426f4f301 Add pause/resume admin console commands[fork of tomlikestorock's PR] (#66) 2019-11-11 11:37:09 +03:00
Andrey Borodin e053d76b16 Use only one TLS context per machine
Previously we recreated TLS context. This could cause extre files being
read during TLS handshake.
2019-11-11 10:31:52 +03:00
reshke 885a70ced3 Add client host to default log (#74) 2019-11-06 13:45:22 +03:00
Andrey Borodin 298cdca895
Implement client_max_routing (#72) 2019-10-15 17:15:37 +03:00
Andrey Borodin d5ba841106 Limit global max_clients before doing tls handshake 2019-10-11 13:33:28 +05:00
Dmitry Simonenko 1645a55d09 odyssey: set pam response ptr to NULL on error 2019-09-28 17:27:34 +03:00
Dmitry Simonenko c6542d7003 odyssey: post merge fixes 2019-09-27 16:47:45 +03:00
reshke debfd09d8e Add PAM auth support 2019-09-26 13:54:53 +05:00
Dmitry Simonenko 6f018e48e5 odyssey: rework connection retry logic for too many connections case 2019-08-10 21:03:41 +03:00
Dmitry Simonenko feb97828c6 odyssey: post merge fixes and refactoring 2019-08-10 19:30:45 +03:00
Dmitry Simonenko 332dbe7e16
Merge pull request #60 from gms80/master
* Corrected SEGFAULT in case of non-existent user in auth_query
2019-08-10 19:02:46 +03:00
Dmitry Simonenko 1dc7f58c73 odyssey: fix warning and misc fixes 2019-08-08 17:39:13 +03:00
Andrey Borodin ee02f48c65 Use 53300 for too many connections 2019-07-31 17:47:54 +05:00
Andrey Borodin 3ef85db4f4 Use proper const for 'too many connections' 2019-07-26 11:11:07 +03:00
Andrey Borodin ac146d81de Unlock route in when read stop error happens 2019-07-24 15:42:29 +03:00
Michael Goryainov 7713e08f41 Moved od_getpeername() call to auth.c 2019-07-17 13:07:34 +03:00
Andrey Borodin b293d820e5 Check od_io_read_stop() return code during size-limited pool wait 2019-07-11 17:49:19 +03:00
Dmitry Simonenko 19dbc5e76f odyssey: minor fixes 2019-07-06 17:40:48 +03:00
Andrey Borodin c7c075fb53 Fix to error detection code in check for too many connections 2019-06-28 12:01:21 +05:00
Andrey Borodin 6a3c1f78f7 Implement router retry timeout 2019-06-27 17:24:44 +05:00
Andrey Borodin d9b829c901 Add route lock during server connection retry 2019-06-27 17:01:05 +05:00
Andrey Borodin 8dff1aabef Wait for server connection on "too many connections" if pool_timeout!=0
This reflects PgBouncer behavior on query_wait_timeout and should help
replace cascades of PgBouncers. Currently if wave of incoming
connections is coordinated casecade of PgBouncers will try smooth peak
with at least 2 seconds wait, while Odyssey just resest every
connection with is over role connection limit.
2019-06-27 16:43:26 +05:00
Andrey Borodin 99b1979ea5 Reformat code 2019-06-26 10:49:51 +05:00
Michael Goryainov 7b6fb2ded7 * Corrected SEGFAULT in case of non-existent user in auth_query
+ Added ability for host-based authentification a-la pg_hba:
  e.g.
  auth_query "SELECT usename, passwd FROM pg_shadow,pg_hba_net WHERE usename='%u' AND ((pg_shadow.usename=pg_hba_net.username and network >> '%h') OR (SELECT COUNT(*) FROM pg_hba_net WHERE username='%u'))
2019-06-25 17:09:31 +03:00
Andrey Borodin f8f8db1ac5 Add logging for start, stop and client error 2019-06-17 11:35:21 +05:00
Dmitry Simonenko d784c2ad19 odyssey: make restart read logic explicit in router attach 2019-06-13 11:55:01 +03:00
Dmitry Simonenko a3f55f4f21 odyssey: rework packet header validation 2019-06-03 13:12:50 +03:00
Dmitry Simonenko 5716feb831 odyssey: unsubscribe from read events during pool attach wait 2019-05-25 17:26:29 +03:00
Andrey Borodin 80484c3337 Fix route connection limit handling 2019-05-21 17:43:46 +05:00
Andrey Borodin a02f9a0b87 Move message synchronization checks 2019-05-21 17:43:25 +05:00
Andrey Borodin f803b88ae5 Avoid flushing amid packet on sudden connection termination 2019-05-14 16:45:53 +05:00
Andrey Borodin 538042916f Allow long FE messages in msg validation 2019-05-13 15:29:46 +03:00
Andrey Borodin edd5477302 Improve protocol message validation 2019-04-30 14:47:43 +05:00