Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions be/src/olap/tablet_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,6 @@ OLAPStatus TabletManager::drop_tablets_on_error_root_path(
++it;
}
}

if (_tablet_map[tablet_id].table_arr.empty()) {
_tablet_map.erase(tablet_id);
}
}
}

Expand Down Expand Up @@ -923,14 +919,32 @@ OLAPStatus TabletManager::report_all_tablets_info(std::map<TTabletId, TTablet>*

OLAPStatus TabletManager::start_trash_sweep() {
ReadLock rlock(&_tablet_map_lock);
for (const auto& item : _tablet_map) {
std::vector<int64_t> tablets_to_clean;
for (auto& item : _tablet_map) {
// try to clean empty item
if (item.second.table_arr.empty()) {
// try to get schema change lock if could get schema change lock, then nobody
// own the lock could remove the item
// it will core if schema change thread may hold the lock and this thread will deconstruct lock
if (item.second.schema_change_lock.trylock() == OLAP_SUCCESS) {
item.second.schema_change_lock.unlock();
tablets_to_clean.push_back(item.first);
}
}
for (TabletSharedPtr tablet : item.second.table_arr) {
if (tablet == nullptr) {
continue;
}
tablet->delete_expired_inc_rowsets();
}
}
// clean empty tablet id item
for (const auto& tablet_id_to_clean : tablets_to_clean) {
if (_tablet_map[tablet_id_to_clean].table_arr.empty()) {
_tablet_map.erase(tablet_id_to_clean);
}
}

auto it = _shutdown_tablets.begin();
for (; it != _shutdown_tablets.end();) {
// check if the meta has the tablet info and its state is shutdown
Expand Down Expand Up @@ -1247,10 +1261,6 @@ OLAPStatus TabletManager::_drop_tablet_directly_unlocked(
}
}

if (_tablet_map[tablet_id].table_arr.empty()) {
_tablet_map.erase(tablet_id);
}

res = dropped_tablet->deregister_tablet_from_dir();
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to unregister from root path. "
Expand Down
3 changes: 2 additions & 1 deletion fe/src/main/java/org/apache/doris/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,9 @@ public class Config extends ConfigBase {
* After dropping database(table/partition), you can recover it by using RECOVER stmt.
* And this specifies the maximal data retention time. After time, the data will be deleted permanently.
*/
// TODO(ygl): temp modify it for test !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ConfField(mutable = true, masterOnly = true)
public static long catalog_trash_expire_second = 86400L; // 1day
public static long catalog_trash_expire_second = 10L; // 1day
/*
* Maximal bytes that a single broker scanner will read.
* Do not set this if you know what you are doing.
Expand Down