| 1008 | } |
| 1009 | |
| 1010 | bool Table::TryCollectInheritedFile() { |
| 1011 | if (GetTableName() == FLAGS_tera_master_meta_table_name) { |
| 1012 | return false; |
| 1013 | } |
| 1014 | |
| 1015 | std::set<uint64_t> live_tablets, dead_tablets; |
| 1016 | GetTabletsForGc(&live_tablets, &dead_tablets, true); |
| 1017 | |
| 1018 | std::set<uint64_t>::iterator it = dead_tablets.begin(); |
| 1019 | for (; it != dead_tablets.end(); ++it) { |
| 1020 | std::vector<TabletFile> tablet_files; |
| 1021 | CollectInheritedFileFromFilesystem(name_, *it, &tablet_files); |
| 1022 | |
| 1023 | if (tablet_files.empty()) { |
| 1024 | MutexLock l(&mutex_); |
| 1025 | AddEmptyDeadTablet(*it); |
| 1026 | } else { |
| 1027 | for (uint32_t i = 0; i < tablet_files.size(); i++) { |
| 1028 | MutexLock l(&mutex_); |
| 1029 | AddInheritedFile(tablet_files[i], false); |
| 1030 | } |
| 1031 | } |
| 1032 | } |
| 1033 | return dead_tablets.size() > 0; |
| 1034 | } |
| 1035 | |
| 1036 | bool Table::CollectInheritedFileFromFilesystem(const std::string& tablename, uint64_t tablet_num, |
| 1037 | std::vector<TabletFile>* tablet_files) { |