-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the disk usage to avoid running out of disk capacity #1702
Conversation
Set high watermark and flood stage of disk used capacity. And forbid some operation is disk usage is too high.
@@ -1057,4 +1058,35 @@ void DataDir::_remove_check_paths_no_lock(const std::set<std::string>& paths) { | |||
} | |||
} | |||
|
|||
Status DataDir::update_capacity() { | |||
try { | |||
boost::filesystem::path path_name(_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::filesystem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++14 not support std::filesystem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++14 not support std::filesystem
be/src/olap/compaction.cpp
Outdated
@@ -186,4 +186,17 @@ OLAPStatus Compaction::check_correctness(const Merger& merger) { | |||
return OLAP_SUCCESS; | |||
} | |||
|
|||
OLAPStatus Compaction::check_disk_capacity() { | |||
int64_t incoming_data_size = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only in SegmentWriter will be ok. All writers only go through the SegmentWriter.
@@ -59,14 +59,14 @@ DataDir::DataDir(const std::string& path, int64_t capacity_bytes, | |||
TabletManager* tablet_manager, TxnManager* txn_manager) | |||
: _path(path), | |||
_capacity_bytes(capacity_bytes), | |||
_available_bytes(0), | |||
_disk_capacity_bytes(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_capacity_bytes and _disk_capacity_bytes are redundant ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, _capacity_bytes
is user specified disk capacity, but it currently not used.
_disk_capacity_bytes
is the capacity of the disk
be/src/olap/schema_change.cpp
Outdated
@@ -1889,10 +1889,16 @@ OLAPStatus SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangePa | |||
VLOG(10) << "begin to convert a history rowset. version=" | |||
<< rs_reader->version().first << "-" << rs_reader->version().second; | |||
|
|||
// check disk capacity | |||
int64_t tablet_size = rs_reader->rowset()->index_disk_size() + rs_reader->rowset()->data_disk_size(); | |||
if (sc_params.new_tablet->data_dir()->reach_capacity_limit(tablet_size)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify the entrance.
1f7acec
to
1c14526
Compare
Set high watermark and flood stage of disk used capacity.
And forbid some operations if disk usage is too high.
ISSUE: #1701