refactor(server): remove the inactive master redirect filter - #3246
Conversation
|
Same check as on #3244, this time against master + this head (which includes #3244). This commit adds one new conflict: #3144 adds its |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3246 +/- ##
============================================
- Coverage 41.57% 41.55% -0.02%
+ Complexity 7325 7305 -20
============================================
Files 795 793 -2
Lines 69198 69106 -92
Branches 9269 9258 -11
============================================
- Hits 28770 28719 -51
+ Misses 37145 37108 -37
+ Partials 3283 3279 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Summary: The removal is safe. On master (82034fb, which already contains #3244) nothing calls GlobalMasterInfo.supportElection(true), so RedirectFilter.filter() always returned at the !globalNodeInfo.supportElection() check before any forwarding, and dropping the filter, its DynamicFeature, the 21 @RedirectMasterRole annotations and the master NodeInfo state does not change any REST response. GraphTransaction.queryServerInfos(...) has no callers left. Since #3244 was squash-merged and its tree matches master exactly, only 4792aca is new; a rebase will drop the first two commits from the diff. Evidence: static review of 4792aca against 5117958 (git diff 5117958 origin/master is empty). git grep at the head finds no remaining use of RedirectFilter, RedirectMasterRole, supportElection, masterInfo, resetMasterInfo, GlobalMasterInfo.NodeInfo, queryServerInfos or x-hg-redirect, and the local hugegraph-toolchain, hugegraph-computer and hugegraph-ai checkouts do not reference them either. GlobalMasterInfo.master(...), initNodeRole and changeNodeRole keep their behaviour. All 22 checks at this head are green, including build-server on memory, rocksdb and hbase, and the hstore, pd and store jobs.
RedirectFilter only forwarded requests when GlobalMasterInfo.supportElection() was true, and the only code that set it was the role election path removed in apache#3244, which nothing had called since apache#3082. The filter was still registered on 21 endpoint methods and returned early on every request. Remove RedirectFilter, RedirectFilterDynamicFeature and the @RedirectMasterRole annotations, the election and master URL state in GlobalMasterInfo, and GraphTransaction.queryServerInfos(), which read the ~server vertices HugeServerInfo used to write and had no callers.
4792aca to
456cb36
Compare
There was a problem hiding this comment.
✅ Score: 9.1/10
No blocking regression was found in the removal of the inactive redirect/election path. The retained node-role behavior and in-repository callers were checked.
Resolve or explicitly assess the coverage gate before merging. This cleanup has lower release priority than upgrade and query correctness fixes.
|
Thanks for the review. On |
Purpose of the PR
RedirectFilterforwarded requests to the elected master only whenGlobalMasterInfo.supportElection()was true. The only code that set the flag wasGraphManager.initRoleStateMachine(), which nothing called after #3082 and which #3244 removed. The filter was still registered on 21 endpoint methods through@RedirectMasterRoleand returned early on every request.Main Changes
RedirectFilter,RedirectFilterDynamicFeature, the@RedirectFilter.RedirectMasterRoleannotations on the schema, job, task and raft APIs, and the registration inApplicationConfig.GlobalMasterInfoto the node id and node role.supportElection, the masterNodeInfo,masterInfo(...),resetMasterInfo()and the stale master-worker TODO are gone.GlobalMasterInfo.master(...)stays, since tests, the example and the Gremlin scripts use it.GraphTransaction.queryServerInfos(...)overloads. They read the~serververtices thatHugeServerInfoused to write and had no callers.AccessLogFilterTest.testRedirectRunsAfterBodyCapture, which only checked the removed filter's registration priority.HugeType.SERVERand the legacy~server/~role_datalabel mapping inHugeVertexare unchanged.Verifying these changes
UnitTestSuite(includingServerInfoManagerTest,SecurityManagerTestandAccessLogFilterTest) and the API tests for the endpoints that carried the annotation (EdgeLabelApiTest,IndexLabelApiTest,PropertyKeyApiTest,VertexLabelApiTest,GremlinApiTest,TaskApiTest).Ran the full
UnitTestSuitelocally on JDK 11 (746 run, 0 failures). The API tests, which exercise the annotated endpoints, were left to CI.Does this PR potentially affect the following parts?
"The public API" here means the Java
GlobalMasterInfoandGraphTransactionmethods listed above. The REST endpoints respond as before because the redirect never ran. Thex-hg-redirectheader only told the filter to skip forwarding, so ignoring it changes nothing either.Documentation Status
Select one option and provide the documentation location when applicable.
Doc - TODO: required documentation is pending; complete it before merging.Doc - Done: documentation is included here or linked below.Doc - No Need: no user-visible documentation is affected.Documentation files in this PR or paired hugegraph-doc PR: