Skip to content

Commit

Permalink
[#141] Require users for transaction pooling
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Mar 10, 2021
1 parent 5c49b26 commit 905b6ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 5 additions & 1 deletion doc/PIPELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ The transaction pipeline will release the connection back to the pool after each
transaction completes. This feature will support many more clients than there are
database connections.

The transaction pipeline requires that there are users defined such that connections
can be kept in the pool in all security scenarios.

However, there are some session based features of PostgreSQL that can't be supported in this
pipeline.

Expand Down Expand Up @@ -99,7 +102,8 @@ setting `idle_timeout` to 0.

It is highly recommended that you prefill all connections for each user.

The transaction pipeline doesn't support the `disconnect_client` setting.
The transaction pipeline doesn't support the `disconnect_client` or
`allow_unknown_users` settings.

Select the transaction pipeline by

Expand Down
17 changes: 12 additions & 5 deletions src/libpgagroal/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,24 @@ pgagroal_validate_configuration(void* shm, bool has_unix_socket, bool has_main_s
}
else if (config->pipeline == PIPELINE_TRANSACTION)
{
if (config->number_of_users == 0)
{
pgagroal_log_fatal("pgagroal: Users must be defined for the transaction pipeline");
return 1;
}

if (config->disconnect_client > 0)
{
pgagroal_log_fatal("pgagroal: Transaction pipeline does not support disconnect_client");
return 1;
}

if (config->allow_unknown_users)
{
pgagroal_log_fatal("pgagroal: Transaction pipeline does not support allow_unknown_users");
return 1;
}

if (config->blocking_timeout > 0)
{
pgagroal_log_warn("pgagroal: Using blocking_timeout for the transaction pipeline is not recommended");
Expand All @@ -984,11 +996,6 @@ pgagroal_validate_configuration(void* shm, bool has_unix_socket, bool has_main_s
pgagroal_log_warn("pgagroal: Using foreground validation for the transaction pipeline is not recommended");
}

if (config->number_of_users == 0)
{
pgagroal_log_info("pgagroal: Defining users for the transaction pipeline is recommended");
}

if (config->number_of_limits == 0)
{
pgagroal_log_info("pgagroal: Defining limits for the transaction pipeline is recommended");
Expand Down

0 comments on commit 905b6ec

Please sign in to comment.