zhangyue19921010 opened a new pull request #10688: URL: https://github.com/apache/druid/pull/10688
### Description The future mentioned in https://github.com/apache/druid/pull/6988 is very useful and can greatly improve the speed of historical node restart. But there are some potential risks due to push the loading work to query time. If segment files like `meta.smoosh` or `data.smoosh` **which Historical is served already** are damaged, Historical with lazyOnStart enable can restart successfully but will not detect file corruption during restarting. When queries hit these damaged files, these queries will fail and will not expose which specific files are damaged like mentioned in https://github.com/apache/druid/pull/10608 ### Tests Here are the undamaged segment files. <img width="1104" alt="屏幕快照 2020-12-17 下午6 29 49" src="https://user-images.githubusercontent.com/69956021/102495896-a9609400-40b1-11eb-8bbe-5583dfc054cb.png"> #### First case : meta.smoosh is damaged Remove a line `video_cro_network_name,0,997718245,1000412345` in that meta.smoosh file. <img width="415" alt="屏幕快照 2020-12-17 下午6 33 27" src="https://user-images.githubusercontent.com/69956021/102495917-af567500-40b1-11eb-924d-fcfd343ef50d.png"> Restart Historical node with lazy on start enable. #### Second case : data.smoosh is damaged Delete several bytes in that 00000.smoosh file randomly. Restart Historical node with lazy on start enable. **_In all scenarios, Historical can restart successfully, but queries will failed._** #### Solution This PR add a Segments file check step when restart Historical node with lazy on start enable. For meta.smoosh file, We will compare columns between meta.smoosh and columns deserialized from 00001.smoosh based on index.drd. If the number of columns and names are exactly equal, then the meta.smoosh is undamaged. For data.smoosh(00001 and 00000), we collect the column with largest start offset in each data file. And try to deserialize them. If deserialize successfully, it means each data file could be opened and undamaged. <hr> This PR has: - [ ] been self-reviewed. - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.) - [ ] added documentation for new or modified features or behaviors. - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links. - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/licenses.yaml) - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met. - [ ] added integration tests. - [ ] been tested in a test Druid cluster. <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist above are strictly necessary, but it would be very helpful if you at least self-review the PR. --> <hr> ##### Key changed/added classes in this PR * `IndexIO.java` ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
