tikv / titan

A RocksDB plugin for key-value separation, inspired by WiscKey.
https://pingcap.com/blog/titan-storage-engine-design-and-implementation/
Apache License 2.0
489 stars 165 forks source link

Fix obsolete file of same file number as new manifest can't be deleted #301

Closed v01dstar closed 10 months ago

v01dstar commented 10 months ago

Close https://github.com/tikv/tikv/issues/16256

tonyxuqqi commented 10 months ago

I don't get the overall idea. To me it seems the logic has no difference. Before the change, it will only check "if (alive_files.find(file_number) != alive_files.end()) continue;" The original code makes new_manifest_file_number part of alive_files.

But now, alive_files do not ocntain new_manifest_file_number, but the code check it and skip explicitly. if (file_number == new_manifest_file_number && file_type == kDescriptorFile)

v01dstar commented 10 months ago

I don't get the overall idea. To me it seems the logic has no difference. Before the change, it will only check "if (alive_files.find(file_number) != alive_files.end()) continue;" The original code makes new_manifest_file_number part of alive_files.

But now, alive_files do not ocntain new_manifest_file_number, but the code check it and skip explicitly. if (file_number == new_manifest_file_number && file_type == kDescriptorFile)

It was an orphaned blob file that can not be GCed since it has the same file number as the manifest (they have different prefix and suffix though). Now, alive_files only contains blob files that are listed in the manifest (applied files), and special-case the newly created manifest.