zy-kkk opened a new pull request, #33971:
URL: https://github.com/apache/doris/pull/33971
## Proposed changes
Issue Number: close #xxx
This PR introduces several important improvements aimed at enhancing the
robustness, maintainability, and error handling efficiency of database
connectivity and data retrieval processes. Here are the main optimization
points:
1. **Code Abstraction and Reuse**:
- Introduced `getRequiredMapping` method to centralize the common logic
for retrieving database, table, and column names. This change reduces
repetitive code across multiple functions, making the overall code structure
more compact and consistent.
2. **Unified Error Handling**:
- In the new `getRequiredMapping` method, missing mappings are handled
uniformly. If a mapping is not found, the corresponding loading function is
automatically triggered, and an exception is thrown if data remains missing.
This approach simplifies error management and enhances code readability and
maintainability.
3. **Enhanced Exception Safety**:
- Added more rigorous checks at all critical data access points to ensure
timely feedback and handling of exceptions when data is not successfully
loaded, rather than just relying on the default behavior of data structures.
4. **Improved Robustness**:
- Used `ConcurrentHashMap` and `AtomicBoolean` to ensure data consistency
and thread safety in a multi-threaded environment. Optimized data checks and
exception handling logic reduce potential issues caused by concurrent
modifications.
5. **Improved Logging**:
- Enhanced detailed logging at all points of data loading and exception
handling. This not only helps in monitoring runtime states but also facilitates
troubleshooting and subsequent debugging.
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]