Skip to content

Move Other HttpUtils to use HttpClient#8390

Merged
siddharthteotia merged 7 commits intoapache:masterfrom
walterddr:move_rest_of_http_utils
Mar 29, 2022
Merged

Move Other HttpUtils to use HttpClient#8390
siddharthteotia merged 7 commits intoapache:masterfrom
walterddr:move_rest_of_http_utils

Conversation

@walterddr
Copy link
Contributor

@walterddr walterddr commented Mar 23, 2022

follow up on #8329 .

Description

We still have several http utils in the codebase that we should migrate to use the new HttpClient. This PR moves:

  • ControllerTest
  • pinot-flink-connector HttpClient

TODO

After this PR there are still some utilities that directly uses java.net.* or apache.http.* without an HttpUtils class. which we can migrate later.

@walterddr walterddr force-pushed the move_rest_of_http_utils branch 2 times, most recently from f406acd to 5d2f2ef Compare March 23, 2022 15:46
@walterddr walterddr marked this pull request as ready for review March 23, 2022 15:49
@walterddr walterddr marked this pull request as draft March 23, 2022 15:49
@walterddr walterddr marked this pull request as ready for review March 23, 2022 17:32
@walterddr walterddr marked this pull request as draft March 23, 2022 17:32
@walterddr walterddr force-pushed the move_rest_of_http_utils branch from 5d2f2ef to c48b7b5 Compare March 23, 2022 17:33
@codecov-commenter
Copy link

codecov-commenter commented Mar 23, 2022

Codecov Report

Merging #8390 (46f2ec2) into master (6d2f749) will decrease coverage by 43.30%.
The diff coverage is 51.33%.

❗ Current head 46f2ec2 differs from pull request most recent head 52f1ae0. Consider uploading reports for the commit 52f1ae0 to get more accurate results

@@              Coverage Diff              @@
##             master    #8390       +/-   ##
=============================================
- Coverage     70.79%   27.49%   -43.31%     
=============================================
  Files          1654     1643       -11     
  Lines         86464    86387       -77     
  Branches      13037    13037               
=============================================
- Hits          61216    23749    -37467     
- Misses        21013    60404    +39391     
+ Partials       4235     2234     -2001     
Flag Coverage Δ
integration1 ?
integration2 27.49% <51.33%> (+0.28%) ⬆️
unittests1 ?
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...he/pinot/common/function/scalar/JsonFunctions.java 25.75% <0.00%> (-62.13%) ⬇️
...a/org/apache/pinot/common/metrics/ServerGauge.java 95.65% <ø> (-0.19%) ⬇️
...apache/pinot/controller/BaseControllerStarter.java 75.07% <ø> (-7.26%) ⬇️
...va/org/apache/pinot/controller/ControllerConf.java 50.20% <ø> (-8.51%) ⬇️
.../controller/helix/ControllerRequestURLBuilder.java 18.18% <0.00%> (-65.79%) ⬇️
.../transform/function/DateTimeTransformFunction.java 0.00% <0.00%> (ø)
...ansformer/datetime/DateTimeTransformerFactory.java 58.33% <0.00%> (-41.67%) ⬇️
...ache/pinot/core/query/reduce/GapfillProcessor.java 0.00% <0.00%> (-93.68%) ⬇️
...gment/local/function/InbuiltFunctionEvaluator.java 0.00% <0.00%> (-88.71%) ⬇️
...local/recordtransformer/ExpressionTransformer.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1222 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d2f749...52f1ae0. Read the comment docs.

@walterddr walterddr force-pushed the move_rest_of_http_utils branch from f9bd3fc to e4bdd9c Compare March 23, 2022 23:34
@walterddr walterddr force-pushed the move_rest_of_http_utils branch from e4bdd9c to db16a75 Compare March 24, 2022 16:59
@walterddr walterddr force-pushed the move_rest_of_http_utils branch from db16a75 to 68f7f22 Compare March 24, 2022 17:17
Rong Rong added 2 commits March 24, 2022 21:02
- sleep for 1s for controller to restart in restart controller tests
- change check FileNotFoundException to check status code 404
- fix reloadSegment/Table
@walterddr walterddr force-pushed the move_rest_of_http_utils branch from 905036f to 8813316 Compare March 25, 2022 17:01
@walterddr walterddr force-pushed the move_rest_of_http_utils branch from 3976a3b to fa65207 Compare March 26, 2022 16:16
@walterddr walterddr changed the title Migrate HttpUtils to use HttpClient Move Other HttpUtils to use HttpClient Mar 26, 2022
@walterddr walterddr marked this pull request as ready for review March 27, 2022 03:45
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

Nice! Much cleaner

stopController();
startController(properties);
// wait for controller to start correctly.
Thread.sleep(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you run into issues without this wait? We should avoid using this kind of wait to get instance ready as this can be flaky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah. for some unknown reason this test will fail if I dont wait. i can do a "TestUtils.waitUntilCondition" instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's check what is causing the flakiness, and use TestUtils.waitUntilCondition to guard that condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think we just need to make sure the HTTPServer is up . see my change

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the HTTP server still not ready when the start controller already returns? IMO it should be ready during the start

Copy link
Contributor Author

@walterddr walterddr Mar 29, 2022

Choose a reason for hiding this comment

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

this I have no idea. the error simply said

Mar 28, 2022 6:31:51 PM org.glassfish.grizzly.http.server.NetworkListener shutdownNow
INFO: Stopped listener bound to [0.0.0.0:18998]
Mar 28, 2022 6:31:52 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:18998]
Mar 28, 2022 6:31:52 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer-1] Started.

org.apache.http.NoHttpResponseException: localhost:18998 failed to respond

	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
...
	at org.apache.pinot.common.utils.http.HttpClient.sendJsonPutRequest(HttpClient.java:257)
	at org.apache.pinot.controller.helix.ControllerRequestClient.updateTableConfig(ControllerRequestClient.java:100)
	at org.apache.pinot.controller.helix.ControllerTest.updateTableConfig(ControllerTest.java:540)
	at org.apache.pinot.controller.helix.core.minion.PinotTaskManagerStatelessTest.testPinotTaskManagerSchedulerWithRestart(PinotTaskManagerStatelessTest.java:180)

we should separately investigate the issue IMO

Copy link
Contributor

Choose a reason for hiding this comment

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

@walterddr can you create an issue to track the above ? I think we can merge this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done see #8431

@siddharthteotia siddharthteotia merged commit 189fd7a into apache:master Mar 29, 2022
@walterddr walterddr deleted the move_rest_of_http_utils branch December 6, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants