[Improvement]: Make Controller Depend on Stateless Services
Search before asking
- [X] I have searched in the issues and found no similar issues.
What would you like to be improved?
To support multi-node deployment of AMS REST services(as mentioned in issue #2810 ), we must refactor the Controller implementation and its dependent service layer to be stateless.
How should we improve?
Based on the previous discussion at #2997, the current services will be split into two types: stateless services and stateful services.
Firstly, these two types of services will adhere to the following standards:
-
All stateless service interfaces will have the suffix
Managersuch asCatalogManagerorOptimizerManager. -
Stateless services can provide more complex functionalities than direct database access, such as CatalogCache, etc., but they must assume that state changes will occur on other nodes. Therefore, stateless services need to pay attention to maintaining the consistency between in-memory objects and the database state.
-
Stateful service interfaces will have the suffix
Servicesuch asTableServiceorOptimizingService, and will share a common parent interface namedStatefulService, which includes aninitializemethod and adisposemethod. All methods of the stateful service interfaces must check the initialization state. -
Stateless services will be initialized before the leader election, and stateful services will be initialized after the election, and will only be initialized on the master node.
Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
Subtasks
- [x] #3393
- [x] #3406
- [x] #3425
- [x] #3438
- [x] #3429
- [x] #3440
1.Refactoring of the TableService Interface
- [x] CatalogManager: The TableService interface will no longer inherit from
CatalogService, andCatalogServicewill be modified to become a statelessCatalogManager. #3393 - [x] InternalTableManager: Interfaces related to
TableMetadatamanagement will be extracted intoInternalTableManager, which will be used byIcebergRestCatalogServer. - [x] TableBlockerManager: Interfaces related to
TableBlockerwill be extracted intoTableBlockerManager, which will be used byMixedFormatand Table Thrift API. - [x] MaintainedTableManager: Interfaces related to
ServerTableIdentifierandTableRuntimeMetawill be extracted intoMaintainedTableManager, which will be used by Process and Optimizing-related controllers. - [x] TableService: The remaining functionality of
TableServicewill be retained, including the maintenance ofTableRuntimeand the implementation of theTableRuntimeHandlerlistener chain invocation. https://github.com/apache/amoro/issues/3406
2.Refactoring of the DefaultOptimizingService Interface
- [x] Extract the implementation of
OptimizerManagerfromDefaultOptimizingServiceand reimplement it as a stateless service. - [ ] Refer to the design of TableConfig refresh and
TableRuntimeHandlerto implement the refresh and exploration ofOptimizingGroupConfig(due to modifications may not take place on the master node).
3.Implement the forwarding of necessary requests to the master node.
Since some features can only be implemented on the Master (such as Kill Process), it is necessary to provide a mechanism to send requests to the master node.
- [ ] Forward requests to the master node using the HTTP client generated based on Swagger.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct