yanghua commented on issue #923: HUDI-247 Unify the initialization of HoodieTableMetaClient in test for hoodie-client module URL: https://github.com/apache/incubator-hudi/pull/923#issuecomment-535315672 @vinothchandar I have two motivation to refactor the `new HoodieTableMetaClient()` style code: * `HoodieTableMetaClient` uses Hadoop File System, the original implementation did not explicitly release it (call `fs.close()`) while just wait for GC to recycle these objects, it is a bad way. we need to release expensive resources as soon as possible. * Reuse existed object is a better way. Our essential purpose is to clear and initialize the inner state of a hoodie table meta client again. Reuse the client object can provide better performance, less object creation, GC frequency. A `reloadMetaClient` or `reInitMetaClient` method has a better expressiveness in a context than re-initialize an instance of `HoodieTableMetaClient`. Actually, when I see this code style firstly, I feel strange, why we always re-initialize the object so many times? Are they redundant or unnecessary? This is my first impression. About your concern, IMHO, we may not worry about it. Since the developers remember to re-initialize an object they should remember to invoke the `reloadMetaClient` method to achieve the same purpose. They know their motivation, now, they only need to know there is another method can replace the old style to achieve this, and at the same time release the resource ASAP correctly.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
