Skip to content

refactor(server): remove the inactive master redirect filter - #3246

Open
byteayan wants to merge 3 commits into
apache:masterfrom
byteayan:refactor/remove-redirect-filter
Open

byteayan wants to merge 3 commits into
apache:masterfrom
byteayan:refactor/remove-redirect-filter

Conversation

@byteayan

Copy link
Copy Markdown

Purpose of the PR

Stacked on #3244: the first two commits here belong to that PR, and only the last commit is new. I'll rebase onto master once #3244 merges.

RedirectFilter forwarded requests to the elected master only when GlobalMasterInfo.supportElection() was true. The only code that set the flag was GraphManager.initRoleStateMachine(), which nothing has called since #3082 and which #3244 deletes. The filter was still registered on 21 endpoint methods through @RedirectMasterRole and returned early on every request.

Main Changes

  • Delete RedirectFilter, RedirectFilterDynamicFeature, the @RedirectFilter.RedirectMasterRole annotations on the schema, job, task and raft APIs, and the registration in ApplicationConfig.
  • Reduce GlobalMasterInfo to the node id and node role. supportElection, the master NodeInfo, masterInfo(...), resetMasterInfo() and the stale master-worker TODO are gone. GlobalMasterInfo.master(...) stays, since tests, the example and the Gremlin scripts use it.
  • Delete both GraphTransaction.queryServerInfos(...) overloads. They read the ~server vertices that HugeServerInfo used to write and had no callers.
  • Drop AccessLogFilterTest.testRedirectRunsAfterBodyCapture, which only checked the removed filter's registration priority.

HugeType.SERVER and the legacy ~server / ~role_data label mapping in HugeVertex are unchanged.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Ran the full UnitTestSuite locally 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 GlobalMasterInfo and GraphTransaction methods listed above. The REST endpoints respond as before because the redirect never ran. The x-hg-redirect header 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:

Nothing has started the role election state machine since apache#3082.
Graphs started with a node id (tests, examples, and Gremlin scripts
calling serverStarted(GlobalMasterInfo.master(...))) still built one,
which wrote ~role_data schema and leaked an idle executor. TaskManager
also kept the task-scheduler pool alive only to close transactions on
it.

Remove the masterelection classes other than GlobalMasterInfo, the
HugeGraph.roleElectionStateMachine() accessor, the server.role_election
and server.role.* options, the deprecation warnings added in apache#3082,
and TaskManager's scheduler pool and role callbacks.

Old config files that still set the removed keys only get HugeConfig's
"redundant option" warning. HugeVertex keeps mapping the ~role_data
label to HugeType.SERVER so vertices left in existing graphs still
route to the same table.
ServerInfoManager.init() and heartbeat() have been no-ops since apache#3082,
and tx()/call() had no callers, so the server-info-db-worker pool that
backed them never ran anything. Remove those methods, the executor, the
constructor parameter threaded through the task schedulers, and the
HugeServerInfo vertex class.

ServerInfoManager itself stays: StandardHugeGraph still hands it the
node info, and TaskScheduler.serverManager() is part of the interface.
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.
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.

[TASK] Refactor: remove the inactive RedirectFilter master redirect

1 participant