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

refactor(frontend): Move some pg wire value into common and make them const #14519

Merged
merged 7 commits into from
Jan 12, 2024

Conversation

yufansong
Copy link
Member

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

In #11265

  1. we need to refactor the current_cluster_version function which used in function / streaming job / ddl controller which should get from the ConfigMap.
  2. When setting the pgwire for ParameterStatus, we hard code the server version / client encoding / StandardConformingString / ApplicationName.

This PR try to refactor the above two parts.

  1. Firstly move some default value of the ConfigMap into common and make they as pub const. Use this const when initialize the ConfigMap.
  2. Secondly, in theory, we should read ParameterStatus from the session_config. But we use const value to init session_config, so we directly use the const for ParameterStatus. The same logic for current_cluster_version
  3. For application name, it is not const value, so I keep the orginal code path without change.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Comment on lines 99 to 100
/// Shows the server-side character set encoding. At present, this parameter can be shown but not set, because the encoding is determined at database creation time.
pub const CLIENT_ENCODING: &str = "UTF8";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment does not match the name. Let's rename it to SERVER_ENCODING and add "it is also the default for CLIENT_ENCODING"

https://www.postgresql.org/docs/16/runtime-config-preset.html#GUC-SERVER-ENCODING
https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-CLIENT-ENCODING

@@ -107,5 +117,8 @@ macro_rules! git_sha {
pub const GIT_SHA: &str = git_sha!("GIT_SHA");

pub fn current_cluster_version() -> String {
format!("PostgreSQL 9.5-RisingWave-{} ({})", RW_VERSION, GIT_SHA)
format!(
"PostgreSQL {}-RisingWave-{} ({})",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzxa21 FYI there would be an extra .0 starting next release

-       PostgreSQL 9.5-RisingWave-1.6.0 (abc)
+       PostgreSQL 9.5.0-RisingWave-1.7.0 (def)

@xiangjinwu xiangjinwu linked an issue Jan 12, 2024 that may be closed by this pull request
@yufansong yufansong enabled auto-merge January 12, 2024 06:50
@yufansong yufansong added this pull request to the merge queue Jan 12, 2024
@yufansong yufansong changed the title refactor(frontend): Move some pg wire value into common and make they const refactor(frontend): Move some pg wire value into common and make them const Jan 12, 2024
Merged via the queue into main with commit b63d480 Jan 12, 2024
27 of 29 checks passed
@yufansong yufansong deleted the yufan/set-const-version branch January 12, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: consolidate PostgreSQL version constant
2 participants