Skip to content

Commit 58497d7

Browse files
obdevob-robot
obdev
authored andcommitted
Fix the issue where IO isolation for local disks did not calculate the IOPS scale according to IO calibration.
1 parent 131afac commit 58497d7

File tree

7 files changed

+36
-6
lines changed

7 files changed

+36
-6
lines changed

deps/oblib/src/lib/tc/ob_tc.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ struct TCLink
2323

2424
struct TCRequest
2525
{
26-
TCRequest(): link_(NULL), qid_(-1), bytes_(0), start_ns_(0), storage_key_(0) {
26+
TCRequest(): link_(NULL), qid_(-1), bytes_(0), start_ns_(0), storage_key_(0), norm_bytes_(0) {
2727
}
28-
TCRequest(int qid, int64_t bytes): link_(NULL), qid_(qid), bytes_(bytes), start_ns_(0), storage_key_(0) {}
28+
TCRequest(int qid, int64_t bytes): link_(NULL), qid_(qid), bytes_(bytes), start_ns_(0), storage_key_(0), norm_bytes_(0) {}
2929
~TCRequest() {}
3030
TCLink link_;
3131
int qid_;
3232
int64_t bytes_;
3333
int64_t start_ns_;
3434
uint64_t storage_key_;
35+
int64_t norm_bytes_; // for local device
3536
};
3637

3738
class ITCHandler

deps/oblib/src/lib/tc/ob_tc_limit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BytesLimiter: public ITCLimiter
1616
BytesLimiter(int id, const char* name): ITCLimiter(id, TCLIMIT_BYTES, name, 0) {}
1717
BytesLimiter(int id, const char* name, uint64_t storage_key): ITCLimiter(id, TCLIMIT_BYTES, name, storage_key) {}
1818
~BytesLimiter() {}
19-
int64_t get_cost(TCRequest* req) { return req->bytes_; }
19+
int64_t get_cost(TCRequest* req) { return (req->norm_bytes_ == 0) ? req->bytes_ : req->norm_bytes_; }
2020
};
2121

2222
class CountLimiter: public ITCLimiter

src/share/io/io_schedule/ob_io_schedule_v2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ static void fill_qsched_req(ObIORequest& req, int qid)
284284
{
285285
req.qsched_req_.qid_ = qid;
286286
req.qsched_req_.bytes_ = req.get_align_size();
287+
req.qsched_req_.norm_bytes_ = req.is_object_device_req() ? req.qsched_req_.bytes_ : get_norm_bw(req.qsched_req_.bytes_, req.get_mode());
287288
}
288-
289289
int64_t ObTenantIOSchedulerV2::get_qindex(ObIORequest& req)
290290
{
291291
int ret = OB_SUCCESS;

src/share/io/ob_io_define.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ bool ObIOFlag::is_sys_module() const
269269
&& sys_module_id_ < SYS_MODULE_END_ID;
270270
}
271271

272+
bool ObIORequest::is_object_device_req() const
273+
{
274+
bool ret = false;
275+
if (io_result_ == nullptr) {
276+
} else {
277+
ret = io_result_->is_object_device_req_;
278+
}
279+
return ret;
280+
}
281+
272282
int64_t ObIOFlag::get_wait_event() const
273283
{
274284
return wait_event_id_;

src/share/io/ob_io_define.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ class ObIORequest : public common::ObDLinkBase<ObIORequest>
606606
ObIOGroupKey get_group_key() const;
607607
uint64_t get_sys_module_id() const;
608608
bool is_sys_module() const;
609+
bool is_object_device_req() const;
609610
char *calc_io_buf(); // calc the aligned io_buf of raw_buf_, which interact with the operating system
610611
const ObIOFlag &get_flag() const;
611612
ObIOMode get_mode() const; // 2 mode
@@ -627,7 +628,7 @@ class ObIORequest : public common::ObDLinkBase<ObIORequest>
627628

628629
int64_t get_remained_io_timeout_us();
629630

630-
TO_STRING_KV(K(is_inited_), K(tenant_id_), KP(control_block_), K(ref_cnt_), KP(raw_buf_), K(fd_),
631+
TO_STRING_KV(K(is_inited_), K(tenant_id_), KP(control_block_), K(ref_cnt_), KP(raw_buf_), K(fd_), K(is_object_device_req()),
631632
K(trace_id_), K(retry_count_), K(tenant_io_mgr_), K_(storage_accesser),
632633
KPC(io_result_), K_(part_id));
633634
private:

src/share/io/ob_io_manager.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ int64_t get_norm_iops(const int64_t size, const double iops, const ObIOMode mode
5757
}
5858
return norm_iops;
5959
}
60+
61+
// for local device
62+
int64_t get_norm_bw(const int64_t size, const ObIOMode mode)
63+
{
64+
int ret = OB_SUCCESS;
65+
int64_t norm_bw = size;
66+
double iops_scale = 0;
67+
bool is_io_ability_valid = false;
68+
if (mode == ObIOMode::MAX_MODE) {
69+
} else if (FALSE_IT(ObIOCalibration::get_instance().get_iops_scale(mode, size, iops_scale, is_io_ability_valid))) {
70+
} else if (iops_scale < std::numeric_limits<double>::epsilon()) {
71+
LOG_WARN("calc iops scale failed", K(ret), K(mode));
72+
} else {
73+
norm_bw = static_cast<int64_t>((double)STANDARD_IOPS_SIZE / iops_scale);
74+
}
75+
return max(norm_bw, 1);;
76+
}
6077
} // namespace common
6178
} // namespace oceanbase
6279
int64_t ObTrafficControl::IORecord::calc()
@@ -2695,7 +2712,7 @@ int ObTenantIOManager::print_io_status()
26952712
snprintf(io_status, sizeof(io_status),
26962713
"sys_group_name:%s, mode:%s, cur_req:%ld, hold_mem:%ld "
26972714
"[FAILED]: fail_size:%ld, fail_iops:%ld, fail_bw:%ld, [delay/us]:prepare:%ld, schedule:%ld, submit:%ld, rt:%ld, total:%ld, "
2698-
"[SUCC]: size:%ld, iops:%ld, norm_iops :%ld, bw:%ld, [delay/us]:prepare:%ld, schedule:%ld, submit:%ld, rt:%ld, total:%ld",
2715+
"[SUCC]: size:%ld, iops:%ld, norm_iops:%ld, bw:%ld, [delay/us]:prepare:%ld, schedule:%ld, submit:%ld, rt:%ld, total:%ld",
26992716
get_io_sys_group_name(module),
27002717
mode_str,
27012718
sys_mem_stat.group_mem_infos_.at(i).total_cnt_,

src/share/io/ob_io_manager.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ inline const char *get_resource_type_str(const ResourceType type)
6262
namespace common
6363
{
6464
int64_t get_norm_iops(const int64_t size, const double iops, const ObIOMode mode);
65+
int64_t get_norm_bw(const int64_t size, const ObIOMode mode);
6566
class ObTenantIOManager;
6667
#ifdef OB_BUILD_SHARED_STORAGE
6768
class ObSSIORequest;

0 commit comments

Comments
 (0)