Skip to content
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

Merged
merged 8 commits into from
Aug 27, 2019

Conversation

morningman
Copy link
Contributor

Set high watermark and flood stage of disk used capacity.
And forbid some operations if disk usage is too high.

ISSUE: #1701

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::filesystem

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@@ -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;
Copy link
Contributor

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),
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

@@ -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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify the entrance.

@morningman morningman merged commit 7e981b2 into apache:master Aug 27, 2019
@imay imay mentioned this pull request Sep 26, 2019
SWJTU-ZhangLei pushed a commit to SWJTU-ZhangLei/incubator-doris that referenced this pull request Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants