Optimize pipe TsFile cleanup on drop#18163
Conversation
2c0d324 to
c03d06c
Compare
jt2594838
left a comment
There was a problem hiding this comment.
If the system restarts before removing all files and after dropping the pipe, will the files still be removed?
After startup finds stale pipe hardlink directories, it does not delete them synchronously in the startup path. Instead, it registers a periodic cleanup job: periodicalJobRegistrar.register(
PERIODICAL_CLEANUP_JOB_ID,
new PeriodicalStalePipeDirCleaner(stalePipeDirs)::cleanOneRound,
PipeConfig.getInstance().getPipeSubtaskExecutorCronHeartbeatEventIntervalSeconds());The cleanup job deletes stale directories in throttled rounds. Each round stops when either condition is met: So one cleanup round deletes at most 100,000 paths or runs for at most 1,000 ms. This prevents DataNode startup from being blocked by a large number of leftover pipe TsFile hardlinks. If cleanup is not finished in one round, the next periodic round continues from the remaining files. |
Is it possible to reuse the logic for dropping pipe? And hence avoid introducing a new thread. |
Yes, I agree. Reusing the existing stale pipe directory cleanup logic is better than introducing a new dedicated thread. |
Description
As the title said
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR