Skip to content

Commit

Permalink
Enhancement: should skip path check for tablets in trash (StarRocks#1180
Browse files Browse the repository at this point in the history
)

If a tablet has been dropped but has not been removed from RocksDB, should skip
the garbage path checking for it.

perform_path_gc_by_tablet will do the following steps to decide whether a tablet directory can be removed:

Call TabletManager::get_tablet if see if the tablet is resident in memory and if so, skip deleting the directory
Read the RocksDB to see if the tablet meta exist in RocksDB and if so, skip deleting the directory
All above checks passed, begin to delete the directory.
For an already-dropped tablet but with its meta still existing in RocksDB, if we pass false as the second argument of TabletManager::get_tablet, the first two steps are required, but if we pass true as the argument, only the first step needed.
  • Loading branch information
sduzh authored Nov 11, 2021
1 parent 94af746 commit 0b73774
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion be/src/storage/data_dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ void DataDir::perform_path_gc_by_tablet() {
LOG(WARNING) << "invalid tablet id " << tablet_id << " or schema hash " << schema_hash << ", path=" << path;
continue;
}
TabletSharedPtr tablet = _tablet_manager->get_tablet(tablet_id, false);
TabletSharedPtr tablet = _tablet_manager->get_tablet(tablet_id, true);
if (tablet != nullptr) {
// could find the tablet, then skip check it
continue;
Expand Down

0 comments on commit 0b73774

Please sign in to comment.