fix: delete old sst files when re-downloading sst files in full synchronization #2186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When RsyncClient(https://github.com/OpenAtomFoundation/pika/blob/unstable/src/rsync_client.cc) downloads a sst file in a master-slave replication, if the request times out more than the set number of times, it will retry downloading the entire file. Currently, the path used to delete temporary files is incorrect, resulting in deletion failure. When re-downloading, the old file is actually appended, which ultimately leads to an sst file mismatch with the manifest and a RocksDBiine open failure.
Chinese:
rsync主从复制下载sst文件时,如果请求超时超过设定的次数,会重试下载整个文件。目前的实现中删除临时文件时的路径不对,所以导致删除失败,重新下载的时候实际是在追加写老的文件,最终导致sst文件与manifest不匹配,rocksdb打开失败。