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

[client-v2] Added options for additional headers and server settings #1841

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

chernser
Copy link
Contributor

@chernser chernser commented Sep 27, 2024

Summary

Adds two new configuration options for client and operations:

  • httpHeader - to set additional http headers or override already set one's
  • serverSetting - to pass settings to a server (thru query parameters in case of HTTP)

Closes #1782
Closes #1750
Closes #1665

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@chernser chernser added this to the 0.7.0 milestone Sep 27, 2024
Copy link

sonarcloud bot commented Sep 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
77.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@DataProvider(name = "testPropertyWithValueList_endpoints")
public static Object[][] endpoints() {
return new Object[][] {
{ "http://server1:9090/my_db?custom_settings=param1=value1,param2=value2", 1, new String[]{"http://server1:9090/"} },
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a valid URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is not exactly URL - it is client endpoints spec. It may have multiple hosts for example.
Current example has custom setting with multiple key-value pairs (what would be URL encoded to make it Web URL, but we do not need to do this until we send request - so it is all fine)

@@ -95,14 +96,19 @@ static ClickHouseNodes create(String endpoints, Map<?, ?> defaultOptions) {
}

int endIndex = i;
// parsing host name
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not fully understand if we are planning to remove this module.
why we are changing ClickHouseNodes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is base module for whole client. I'm changing it to fix a bug in it.
We will use this module for a while because it contains some base classes like ClickhouseClientOptions

@chernser chernser merged commit 27e2613 into main Oct 1, 2024
59 of 60 checks passed
@chernser chernser deleted the clientv2_custom_headers branch October 1, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants