Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: trueeyu <lxhhust350@qq.com>
  • Loading branch information
trueeyu committed Sep 7, 2023
1 parent cb07d99 commit 7e89e69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion be/src/storage/data_dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Status DataDir::load() {
if (!load_rowset_status.ok()) {
LOG(WARNING) << "errors when load rowset meta from meta env, skip this data dir:" << _path;
} else {
LOG(INFO) << "load rowset from meta finished, data dir: " << _path;
LOG(INFO) << "load rowset from meta finished, data dir: " << _path << ", size=" << dir_rowset_metas.size();
}

// load tablet
Expand Down Expand Up @@ -323,13 +323,15 @@ Status DataDir::load() {
// 1. add committed rowset to txn map
// 2. add visible rowset to tablet
// ignore any errors when load tablet or rowset, because fe will repair them after report
size_t invalid_rowset_count = 0;
for (const auto& rowset_meta : dir_rowset_metas) {
TabletSharedPtr tablet = _tablet_manager->get_tablet(rowset_meta->tablet_id(), false);
// tablet maybe dropped, but not drop related rowset meta
if (tablet == nullptr) {
// LOG(WARNING) << "could not find tablet id: " << rowset_meta->tablet_id()
// << ", schema hash: " << rowset_meta->tablet_schema_hash()
// << ", for rowset: " << rowset_meta->rowset_id() << ", skip this rowset";
invalid_rowset_count++;
continue;
}
RowsetSharedPtr rowset;
Expand Down Expand Up @@ -370,6 +372,7 @@ Status DataDir::load() {
<< " current valid tablet uid=" << tablet->tablet_uid();
}
}
LOG(INFO) << "load invalid rowset count: " << invalid_rowset_count;
return Status::OK();
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/storage/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ void StorageEngine::_clean_unused_rowset_metas() {

TabletSharedPtr tablet = _tablet_manager->get_tablet(rowset_meta->tablet_id(), tablet_uid);
if (tablet == nullptr) {
invalid_rowset_metas.push_back(rowset_meta);
return true;
}
if (rowset_meta->rowset_state() == RowsetStatePB::VISIBLE && (!tablet->rowset_meta_is_useful(rowset_meta))) {
Expand All @@ -1037,6 +1038,7 @@ void StorageEngine::_clean_unused_rowset_metas() {
auto data_dirs = get_stores();
for (auto data_dir : data_dirs) {
(void)RowsetMetaManager::traverse_rowset_metas(data_dir->get_meta(), clean_rowset_func);
LOG(INFO) << "Traverse invalid rowset count: " << invalid_rowset_metas.size();
for (auto& rowset_meta : invalid_rowset_metas) {
(void)RowsetMetaManager::remove(data_dir->get_meta(), rowset_meta->tablet_uid(), rowset_meta->rowset_id());
}
Expand Down

0 comments on commit 7e89e69

Please sign in to comment.