-
Notifications
You must be signed in to change notification settings - Fork 66
fix(3088): disable pgsql endpoint by default #3094
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
base: main
Are you sure you want to change the base?
Conversation
bb2a631
to
88f355f
Compare
What I suggest is to add an option to disable this port and we set it as disabled by default. I'm not sure if we'll go all in on removing/deprecating it before we are sure that it's not valuable to the community. |
Is there any functionality that PostgreSQL queries can achieve but DataFusion queries cannot? |
Not really. It's mainly a convenience to use any postgres client to query instead restate CLI or the admin http endpoint. |
Ok, @tillrohrmann says there is an discussion about how to implement this, please let me known if the solution is finalized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for getting back to you so late @lsytj0413. The 1.3.0 release took more of my capacity than I hoped. I've given your PR a review and I think it does not fully allow to disable the psql endpoint yet. I think we need to make
restate/crates/worker/src/lib.rs
Line 223 in 84e6e0f
TaskCenter::spawn_child( |
What's a pity is that I didn't manage to give you feedback quickly enough to include it in the 1.3.0 release. Changing the default behavior in a bug fix release is not great. Maybe we could argue that this was an oversight and it should have been shipped with 1.3.0?
@@ -8,6 +8,7 @@ | |||
// the Business Source License, use of this software will be governed | |||
// by the Apache License, Version 2.0. | |||
|
|||
#[cfg(feature = "clients")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might no longer be necessary.
@@ -42,7 +42,8 @@ pub struct PostgresQueryService { | |||
impl PostgresQueryService { | |||
pub fn from_options(options: &QueryEngineOptions, query_context: QueryContext) -> Self { | |||
Self { | |||
bind_address: options.pgsql_bind_address, | |||
#[allow(deprecated)] | |||
bind_address: options.pgsql_bind_address.expect("is set"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean there is no way to disable the pgsql endpoint?
@@ -152,6 +153,8 @@ pub fn spawn_connection( | |||
incoming_socket: TcpStream, | |||
addr: SocketAddr, | |||
) { | |||
warn!("New connection from {addr} to Postgres query server, this is deprecated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are already printing a deprecation warning in line 118. So this one can be removed.
crates/types/src/config/admin.rs
Outdated
query_engine: QueryEngineOptions { | ||
memory_size: value.query_engine.memory_size, | ||
tmp_dir: value.query_engine.tmp_dir, | ||
query_parallelism: value.query_engine.query_parallelism, | ||
pgsql_bind_address: Some( | ||
value | ||
.query_engine | ||
.pgsql_bind_address | ||
.unwrap_or("0.0.0.0:9071".parse().unwrap()), | ||
), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will always set the pgsql_bind_address
to Some
and thereby start the postgres endpoint.
crates/types/src/config/admin.rs
Outdated
#[allow(deprecated)] | ||
if value.query_engine.pgsql_bind_address.is_some() { | ||
print_warning_deprecated_config_option("admin.query-enging.pgsql-bind-address", None); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you introduce a QueryEngineOptionsShadow
, then it could go there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to point users towards "You can make SQL queries using the CLI or with the :9070/query API."
In this implementation, I only print a warning log when the user explicitly sets this parameter, and use the default configuration when the user doesn't set it. This indeed doesn't disable the function. I think we have the following ways to disable this function:
This implementation adopts the first solution (because it will keep the behavior consistent when the user upgrades the system). May I ask which solution do you think is more appropriate? Or are there any other better solutions? |
I think you are right that we shouldn't change the system's behavior in a bug fix release. Technically we are printing a deprecation warning if the user opens a connection with the pgsql client so to some extent we have this covered. Then I would lean towards disabling the pgsql endpoint by default with the next minor release (1.4.0). This would then also mean that we need to wait with merging this PR until we no longer want to release bug fix releases for 1.3. |
I'd like to confirm what to do next (Please forgive me if this is too verbose. My English is not yet very proficient.)
Is my understanding correct? |
bef7eef
to
2108c74
Compare
Yes, that sounds like a good plan. |
@tillrohrmann I have change the implementation, it will print an warning when server is starting, ptal |
Thanks for updating the PR @lsytj0413. Since we are already printing a deprecation warning when connecting to the pqsql endpoint, I think we are actually covered and don't need to add more. I think that my previous statements were a bit confusing in this regard. Sorry for that. The next thing we should do is to disable the pgsql endpoint for the 1.4.0 release. |
aae306f
to
754ec5f
Compare
I have change this implementation to step 2 - disable pgsql endpoint by defaults, ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for disabling the Pgsql endpoint by default @lsytj0413. The changes look good to me. Merging this PR once we know that we no longer need to create 1.3.x bug fix releases.
Fix: #3088
when configuration it in
config.toml
, a log was printed: