From d71eaeea2b4886188a40abc6dcb0e07693318a38 Mon Sep 17 00:00:00 2001 From: lixingjia <49072684+lixingjia77@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:32:56 +0800 Subject: [PATCH] fix: K(buf) in logging statement is invalid (#2159) --- src/share/ob_lob_access_utils.cpp | 8 ++++---- src/sql/engine/expr/ob_datum_cast.cpp | 16 ++++++++-------- src/storage/tx/ob_tx_log.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/share/ob_lob_access_utils.cpp b/src/share/ob_lob_access_utils.cpp index 050a42f0f0..daadf19b36 100644 --- a/src/share/ob_lob_access_utils.cpp +++ b/src/share/ob_lob_access_utils.cpp @@ -1154,7 +1154,7 @@ int ObTextStringResult::fill_inrow_templob_header(const int64_t inrow_data_len, if (OB_ISNULL(buf) || (buf_len == 0)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("Lob: try to fill inrow templob header with empty buffer", - K(ret), K(inrow_data_len), K(buf), K(buf_len)); + K(ret), K(inrow_data_len), KP(buf), K(buf_len)); } else if (inrow_data_len <= OB_MAX_LONGTEXT_LENGTH - MAX_TMP_LOB_HEADER_LEN) { ObLobLocatorV2 locator(buf, static_cast(buf_len), true); // temp lob in oracle mode not need extern neither, for it does not have rowkey @@ -1171,13 +1171,13 @@ int ObTextStringResult::fill_inrow_templob_header(const int64_t inrow_data_len, 0, 0, false))) { - LOG_WARN("Lob: fill temp lob locator failed", K(ret), K(inrow_data_len), K(buf), K(buf_len)); + LOG_WARN("Lob: fill temp lob locator failed", K(ret), K(inrow_data_len), KP(buf), K(buf_len)); } else if (OB_FAIL((locator.set_payload_data(&lob_common, empty_str)))) { - LOG_WARN("Lob: set temp lob locator payload failed", K(ret), K(inrow_data_len), K(buf), K(buf_len)); + LOG_WARN("Lob: set temp lob locator payload failed", K(ret), K(inrow_data_len), KP(buf), K(buf_len)); } } else { // oversized ret = OB_NOT_SUPPORTED; - LOG_WARN("Lob: not support length bigger than 512M", K(ret), K(inrow_data_len), K(buf), K(buf_len)); + LOG_WARN("Lob: not support length bigger than 512M", K(ret), K(inrow_data_len), KP(buf), K(buf_len)); } return ret; } diff --git a/src/sql/engine/expr/ob_datum_cast.cpp b/src/sql/engine/expr/ob_datum_cast.cpp index aa976ba6c2..4b7e9ee8f6 100644 --- a/src/sql/engine/expr/ob_datum_cast.cpp +++ b/src/sql/engine/expr/ob_datum_cast.cpp @@ -2892,7 +2892,7 @@ int common_datetime_string(const ObExpr &expr, const ObObjType in_type, const Ob if (OB_SUCC(ret) && OB_FAIL(ObTimeConverter::datetime_to_str(in_val, tz_info, nls_format, in_scale, buf, buf_len, out_len))) { LOG_WARN("failed to convert datetime to string", K(ret), K(in_val), KP(tz_info), - K(nls_format), K(in_scale), K(buf), K(out_len)); + K(nls_format), K(in_scale), KP(buf), K(out_len)); } } } @@ -6700,7 +6700,7 @@ CAST_FUNC_NAME(bit, datetime) char buf[BUF_LEN] = {0}; ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(buf), K(BUF_LEN), K(in_val), K(pos)); + LOG_WARN("fail to store val", KP(buf), K(BUF_LEN), K(in_val), K(pos)); } else { ObObjType out_type = expr.datum_meta_.type_; ObString str(pos, buf); @@ -6749,7 +6749,7 @@ CAST_FUNC_NAME(bit, date) char buf[BUF_LEN] = {0}; ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(buf), K(BUF_LEN), K(in_val), K(pos)); + LOG_WARN("fail to store val", KP(buf), K(BUF_LEN), K(in_val), K(pos)); } else { ObString str(pos, buf); if (CAST_FAIL(ObTimeConverter::str_to_date(str, out_val, date_sql_mode))) { @@ -6784,7 +6784,7 @@ CAST_FUNC_NAME(bit, time) char buf[BUF_LEN] = {0}; ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(buf), K(BUF_LEN), K(in_val), K(pos)); + LOG_WARN("fail to store val", KP(buf), K(BUF_LEN), K(in_val), K(pos)); } else { ObString str(pos, buf); ObScale res_scale; @@ -6834,7 +6834,7 @@ CAST_FUNC_NAME(bit, string) char buf[BUF_LEN] = {0}; ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(ret), K(in_val), K(length), K(buf), K(BUF_LEN), K(pos)); + LOG_WARN("fail to store val", K(ret), K(in_val), K(length), KP(buf), K(BUF_LEN), K(pos)); } else { ObString str(pos, buf); bool has_set_res = false; @@ -6866,7 +6866,7 @@ CAST_FUNC_NAME(bit, text) char buf[BUF_LEN] = {0}; ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(ret), K(in_val), K(length), K(buf), K(BUF_LEN), K(pos)); + LOG_WARN("fail to store val", K(ret), K(in_val), K(length), KP(buf), K(BUF_LEN), K(pos)); } else { ObString str(pos, buf); ObString res_str; @@ -6894,7 +6894,7 @@ CAST_FUNC_NAME(bit, json) uint64_t in_val = child_res->get_uint(); ObLengthSemantics length = expr.args_[0]->datum_meta_.length_semantics_; if (OB_FAIL(bit_to_char_array(in_val, length, buf, BUF_LEN, pos))) { - LOG_WARN("fail to store val", K(ret), K(in_val), K(length), K(buf), K(BUF_LEN), K(pos)); + LOG_WARN("fail to store val", K(ret), K(in_val), K(length), KP(buf), K(BUF_LEN), K(pos)); } else { ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator(); @@ -6904,7 +6904,7 @@ CAST_FUNC_NAME(bit, json) ObString raw_bin; if (OB_FAIL(ObJsonWrapper::get_raw_binary(j_base, raw_bin, &temp_allocator))) { - LOG_WARN("fail to get int json binary", K(ret), K(in_val), K(buf), K(BUF_LEN)); + LOG_WARN("fail to get int json binary", K(ret), K(in_val), KP(buf), K(BUF_LEN)); } else if (OB_FAIL(common_json_bin(expr, ctx, res_datum, raw_bin))) { LOG_WARN("fail to fill json bin lob locator", K(ret)); } diff --git a/src/storage/tx/ob_tx_log.cpp b/src/storage/tx/ob_tx_log.cpp index fc10ab2d7f..f4455beadd 100644 --- a/src/storage/tx/ob_tx_log.cpp +++ b/src/storage/tx/ob_tx_log.cpp @@ -656,7 +656,7 @@ int ObTxRedoLog::set_mutator_buf(char *buf) int ret = OB_SUCCESS; if (nullptr == buf || mutator_size_ >= 0) { ret = OB_INVALID_ARGUMENT; - TRANS_LOG(ERROR, "invalid mutator buf", K(buf), K(mutator_size_)); + TRANS_LOG(ERROR, "invalid mutator buf", KP(buf), K(mutator_size_)); } else { mutator_buf_ = buf; } @@ -670,7 +670,7 @@ int ObTxRedoLog::set_mutator_size(const int64_t size, const bool after_fill) || (after_fill && mutator_size_ < size)) { ret = OB_INVALID_ARGUMENT; TRANS_LOG(ERROR, "invalid argument when set mutator size", K(after_fill), K(size), - K(mutator_size_), K(mutator_buf_)); + K(mutator_size_), KP(mutator_buf_)); } else if (!after_fill) { int len = 0; SERIALIZE_SIZE_HEADER(UNIS_VERSION); @@ -1393,7 +1393,7 @@ int ObTxLogBlock::init_for_replay(const char *buf, const int64_t &size) || OB_ISNULL(buf) || size <= 0) { ret = OB_INVALID_ARGUMENT; - TRANS_LOG(ERROR, "invalid argument", K(buf), K(size), K(*this)); + TRANS_LOG(ERROR, "invalid argument", KP(buf), K(size), K(*this)); } else { replay_buf_ = buf; len_ = size; @@ -1415,7 +1415,7 @@ int ObTxLogBlock::init_for_replay(const char *buf, const int64_t &size, int skip ret = OB_INIT_TWICE; } else if (OB_ISNULL(buf) || size <= 0) { ret = OB_INVALID_ARGUMENT; - TRANS_LOG(ERROR, "invalid argument", K(buf), K(size), K(*this)); + TRANS_LOG(ERROR, "invalid argument", KP(buf), K(size), K(*this)); } else { replay_buf_ = buf; len_ = size;