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
6 changes: 6 additions & 0 deletions be/src/olap/rowset/alpha_rowset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "olap/rowset/alpha_rowset.h"
#include "olap/rowset/alpha_rowset_meta.h"
#include "olap/rowset/rowset_meta_manager.h"
#include "util/hash_util.hpp"

namespace doris {

Expand Down Expand Up @@ -514,4 +515,9 @@ OLAPStatus AlphaRowset::reset_sizeinfo() {
return OLAP_SUCCESS;
}

std::string AlphaRowset::unique_id() {
// rowset path + rowset_id is unique for a rowset
return _rowset_path + "/" + std::to_string(rowset_id());
}

} // namespace doris
2 changes: 2 additions & 0 deletions be/src/olap/rowset/alpha_rowset.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class AlphaRowset : public Rowset {
// info by using segment's info
OLAPStatus reset_sizeinfo();

std::string unique_id() override;

private:
OLAPStatus _init_segment_groups();

Expand Down
2 changes: 2 additions & 0 deletions be/src/olap/rowset/rowset.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class Rowset : public std::enable_shared_from_this<Rowset> {

virtual bool check_path(const std::string& path) = 0;

virtual std::string unique_id() = 0;

bool need_delete_file() {
return _need_delete_file;
}
Expand Down
8 changes: 6 additions & 2 deletions be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,14 @@ void StorageEngine::start_delete_unused_rowset() {
void StorageEngine::add_unused_rowset(RowsetSharedPtr rowset) {
if (rowset == nullptr) { return; }
_gc_mutex.lock();
auto it = _unused_rowsets.find(rowset->rowset_id());
LOG(INFO) << "add unused rowset, rowset id:" << rowset->rowset_id()
<< ", version:" << rowset->version().first
<< "-" << rowset->version().second
<< ", unique id:" << rowset->unique_id();
auto it = _unused_rowsets.find(rowset->unique_id());
if (it == _unused_rowsets.end()) {
rowset->set_need_delete_file(true);
_unused_rowsets[rowset->rowset_id()] = rowset;
_unused_rowsets[rowset->unique_id()] = rowset;
}
_gc_mutex.unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/storage_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class StorageEngine {
static StorageEngine* _s_instance;

std::unordered_map<SegmentGroup*, std::vector<std::string>> _gc_files;
std::unordered_map<int64_t, RowsetSharedPtr> _unused_rowsets;
std::unordered_map<std::string, RowsetSharedPtr> _unused_rowsets;
Mutex _gc_mutex;

std::thread _unused_rowset_monitor_thread;
Expand Down