updates
This commit is contained in:
parent
a8ef59a448
commit
1a952dfc5a
@ -2285,8 +2285,7 @@ Status CompactionJob::OpenCompactionOutputFile(
|
||||
/*enable_hash=*/paranoid_file_checks_);
|
||||
}
|
||||
|
||||
writable_file->SetIOPriority(
|
||||
GetRateLimiterPriority(RateLimiter::OpType::kWrite));
|
||||
writable_file->SetIOPriority(GetRateLimiterPriorityForWrite());
|
||||
writable_file->SetWriteLifeTimeHint(write_hint_);
|
||||
FileTypeSet tmp_set = db_options_.checksum_handoff_file_types;
|
||||
writable_file->SetPreallocationBlockSize(static_cast<size_t>(
|
||||
@ -2477,30 +2476,18 @@ std::string CompactionJob::GetTableFileName(uint64_t file_number) {
|
||||
file_number, compact_->compaction->output_path_id());
|
||||
}
|
||||
|
||||
Env::IOPriority CompactionJob::GetRateLimiterPriority(
|
||||
const RateLimiter::OpType op_type) {
|
||||
Env::IOPriority CompactionJob::GetRateLimiterPriorityForWrite() {
|
||||
if (versions_ && versions_->GetColumnFamilySet() &&
|
||||
versions_->GetColumnFamilySet()->write_controller()) {
|
||||
WriteController* write_controller =
|
||||
versions_->GetColumnFamilySet()->write_controller();
|
||||
// TODO: if all priorities are the same for read and write, update this.
|
||||
if (op_type == RateLimiter::OpType::kWrite) {
|
||||
if (write_controller->NeedsDelay() || write_controller->IsStopped()) {
|
||||
return Env::IO_USER;
|
||||
} else if (write_controller->NeedSpeedupCompaction()) {
|
||||
return Env::IO_HIGH;
|
||||
}
|
||||
|
||||
return Env::IO_LOW;
|
||||
} else {
|
||||
if (write_controller->NeedsDelay() || write_controller->IsStopped()) {
|
||||
return Env::IO_USER;
|
||||
} else if (write_controller->NeedSpeedupCompaction()) {
|
||||
return Env::IO_HIGH;
|
||||
}
|
||||
|
||||
return Env::IO_LOW;
|
||||
if (write_controller->NeedsDelay() || write_controller->IsStopped()) {
|
||||
return Env::IO_USER;
|
||||
} else if (write_controller->NeedSpeedupCompaction()) {
|
||||
return Env::IO_HIGH;
|
||||
}
|
||||
|
||||
return Env::IO_LOW;
|
||||
}
|
||||
|
||||
return Env::IO_LOW;
|
||||
|
@ -237,7 +237,7 @@ class CompactionJob {
|
||||
// `output_directory_`.
|
||||
virtual std::string GetTableFileName(uint64_t file_number);
|
||||
// The rate limiter priority (io_priority) is determined dynamically here.
|
||||
Env::IOPriority GetRateLimiterPriority(const RateLimiter::OpType op_type);
|
||||
Env::IOPriority GetRateLimiterPriorityForWrite();
|
||||
};
|
||||
|
||||
// CompactionServiceInput is used the pass compaction information between two
|
||||
|
@ -809,8 +809,7 @@ Status FlushJob::WriteLevel0Table() {
|
||||
|
||||
{
|
||||
auto write_hint = cfd_->CalculateSSTWriteHint(0);
|
||||
Env::IOPriority io_priority =
|
||||
GetRateLimiterPriority(RateLimiter::OpType::kWrite);
|
||||
Env::IOPriority io_priority = GetRateLimiterPriorityForWrite();
|
||||
db_mutex_->Unlock();
|
||||
if (log_buffer_) {
|
||||
log_buffer_->FlushBufferToLog();
|
||||
@ -1033,24 +1032,17 @@ Status FlushJob::WriteLevel0Table() {
|
||||
return s;
|
||||
}
|
||||
|
||||
Env::IOPriority FlushJob::GetRateLimiterPriority(
|
||||
const RateLimiter::OpType op_type) {
|
||||
Env::IOPriority FlushJob::GetRateLimiterPriorityForWrite() {
|
||||
if (versions_ && versions_->GetColumnFamilySet() &&
|
||||
versions_->GetColumnFamilySet()->write_controller()) {
|
||||
WriteController* write_controller =
|
||||
versions_->GetColumnFamilySet()->write_controller();
|
||||
|
||||
if (op_type == RateLimiter::OpType::kWrite) {
|
||||
if (write_controller->IsStopped() || write_controller->NeedsDelay()) {
|
||||
return Env::IO_USER;
|
||||
}
|
||||
return Env::IO_HIGH;
|
||||
} else {
|
||||
if (write_controller->IsStopped() || write_controller->NeedsDelay()) {
|
||||
return Env::IO_USER;
|
||||
}
|
||||
}
|
||||
|
||||
return op_type == RateLimiter::OpType::kWrite ? Env::IO_HIGH : Env::IO_USER;
|
||||
return Env::IO_HIGH;
|
||||
}
|
||||
|
||||
#ifndef ROCKSDB_LITE
|
||||
|
@ -124,7 +124,7 @@ class FlushJob {
|
||||
Status MemPurge();
|
||||
bool MemPurgeDecider();
|
||||
// The rate limiter priority (io_priority) is determined dynamically here.
|
||||
Env::IOPriority GetRateLimiterPriority(const RateLimiter::OpType op_type);
|
||||
Env::IOPriority GetRateLimiterPriorityForWrite();
|
||||
#ifndef ROCKSDB_LITE
|
||||
std::unique_ptr<FlushJobInfo> GetFlushJobInfo() const;
|
||||
#endif // !ROCKSDB_LITE
|
||||
|
Loading…
x
Reference in New Issue
Block a user