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

GH-33953: [Java] Pass custom headers on every request #33967

Merged
merged 12 commits into from
Feb 27, 2023

Conversation

aiguofer
Copy link
Contributor

@aiguofer aiguofer commented Feb 1, 2023

Rationale for this change

Some flight requests don't send custom headers. This PR should fix that.

What changes are included in this PR?

Ensure custom headers are sent across on every request.

Are these changes tested?

No

Are there any user-facing changes?

Custom headers should now be attached to every call.

@aiguofer aiguofer requested a review from lidavidm as a code owner February 1, 2023 06:05
@github-actions
Copy link

github-actions bot commented Feb 1, 2023

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

⚠️ GitHub issue #33953 has been automatically assigned in GitHub to PR creator.

@aiguofer
Copy link
Contributor Author

aiguofer commented Feb 1, 2023

Unsure what that failure is... maybe the ManagedChannel shutdown is not being propagated to other channels? Or maybe it's not waiting long enough for the shutdown to complete (there's a hardcoded 5 sec wait there I believe)

@lidavidm
Copy link
Member

lidavidm commented Feb 2, 2023

It'll be a while before I can review here but that test is known to be flaky

@aiguofer
Copy link
Contributor Author

aiguofer commented Feb 3, 2023

Great, good to know! We're currently using a JDBC driver jar I built with these changes for development of our service so we're not currently blocked. Hoping these changes can make it into the next release so we can have users use a published jar once we get to beta. I really appreciate your help and time!

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

Can we add unit tests here?

@aiguofer
Copy link
Contributor Author

aiguofer commented Feb 3, 2023

Sure I'll take a stab at writing some unit tests. I was thinking maybe something like ConnectionTest with a middleware that checks for the specific header values.

@aiguofer aiguofer force-pushed the pass_custom_headers_on_do_get branch from 7db9f18 to 8de0537 Compare February 24, 2023 23:38
@aiguofer
Copy link
Contributor Author

@lidavidm Now that I'm a bit more familiar with the code base I was able to write some better unit tests. I moved the tests to flight-core, removed the use of rules, and I'm now testing each specific flight method instead of using the JDBC connection proxy.

@aiguofer
Copy link
Contributor Author

for the future... is there some command I can run to auto-format code to checkstyle? I haven't thought about checkstyles compliance in years, this should be automated.

@lidavidm
Copy link
Member

for the future... is there some command I can run to auto-format code to checkstyle? I haven't thought about checkstyles compliance in years, this should be automated.

Unfortunately no. I would much prefer if we could switch to a formatter like google-java-format rather than checkstyle but that would be a somewhat disruptive refactor.

That said - feel free to raise an issue and get opinions from other Java contributors.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

This is great, thank you!

@lidavidm
Copy link
Member

Actually, I filed apache/arrow-java#213 for checkstyle - feel free to chime in there

@lidavidm lidavidm merged commit 969dd29 into apache:main Feb 27, 2023
@ursabot
Copy link

ursabot commented Feb 28, 2023

Benchmark runs are scheduled for baseline = 06f28d2 and contender = 969dd29. 969dd29 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.79% ⬆️0.15%] test-mac-arm
[Finished ⬇️1.53% ⬆️2.04%] ursa-i9-9960x
[Failed ⬇️0.29% ⬆️0.03%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 969dd290 ec2-t3-xlarge-us-east-2
[Failed] 969dd290 test-mac-arm
[Finished] 969dd290 ursa-i9-9960x
[Failed] 969dd290 ursa-thinkcentre-m75q
[Finished] 06f28d20 ec2-t3-xlarge-us-east-2
[Finished] 06f28d20 test-mac-arm
[Finished] 06f28d20 ursa-i9-9960x
[Finished] 06f28d20 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants