diff --git a/src/storage/access/ob_index_tree_prefetcher.cpp b/src/storage/access/ob_index_tree_prefetcher.cpp index a1deb0d54..346cc3173 100755 --- a/src/storage/access/ob_index_tree_prefetcher.cpp +++ b/src/storage/access/ob_index_tree_prefetcher.cpp @@ -1204,7 +1204,7 @@ public: } else if (OB_UNLIKELY(!index_info.is_valid() || !rowkey.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("Invalid MicroIndexInfo", K(ret), K(index_info), K(rowkey)); - } else if (OB_FAIL(index_info.endkey_->compare(rowkey, datum_utils_, cmp_ret))) { + } else if (OB_FAIL(index_info.endkey_->compare(rowkey, datum_utils_, cmp_ret, false))) { LOG_WARN("fail to compare rowkey", K(ret), KPC(index_info.endkey_), K(rowkey)); } return cmp_ret; @@ -1268,7 +1268,7 @@ int ObIndexTreeMultiPassPrefetcher::c int64_t start_idx = start_pos % max_micro_handle_cnt_; int64_t end_idx = end_pos % max_micro_handle_cnt_; if (!is_reverse) { - if (OB_FAIL(micro_data_infos_[end_idx].endkey_->compare(border_rowkey, datum_utils, cmp_ret))) { + if (OB_FAIL(micro_data_infos_[end_idx].endkey_->compare(border_rowkey, datum_utils, cmp_ret, false))) { LOG_WARN("Fail to compare endkey", K(ret), K(border_rowkey), K(micro_data_infos_[start_idx].endkey_)); } else if (cmp_ret < 0) { for (int64_t pos = start_pos; pos < end_pos; pos++) { @@ -1286,7 +1286,7 @@ int ObIndexTreeMultiPassPrefetcher::c } else { cmp_ret = 0; // split to [start_idx, max_micro_handle_cnt_ - 1], [0, end_idx - 1] - if (OB_FAIL(micro_data_infos_[max_micro_handle_cnt_ - 1].endkey_->compare(border_rowkey, datum_utils, cmp_ret))) { + if (OB_FAIL(micro_data_infos_[max_micro_handle_cnt_ - 1].endkey_->compare(border_rowkey, datum_utils, cmp_ret, false))) { LOG_WARN("Fail to compare endkey", K(ret), K(border_rowkey), K(micro_data_infos_[max_micro_handle_cnt_ - 1])); } else if (cmp_ret < 0) { for (int64_t idx = start_idx; idx < max_micro_handle_cnt_; idx++) { @@ -1315,7 +1315,7 @@ int ObIndexTreeMultiPassPrefetcher::c } else { cmp_ret = 0; // split to [start_idx, max_micro_handle_cnt_ - 1], [0, end_idx] - if (OB_FAIL(micro_data_infos_[0].endkey_->compare(border_rowkey, datum_utils, cmp_ret))) { + if (OB_FAIL(micro_data_infos_[0].endkey_->compare(border_rowkey, datum_utils, cmp_ret, false))) { LOG_WARN("Fail to compare endkey", K(ret), K(border_rowkey), K(micro_data_infos_[0])); } else if (cmp_ret > 0) { for (int64_t idx = start_idx; idx < max_micro_handle_cnt_; idx++) { diff --git a/src/storage/blocksstable/ob_datum_rowkey.cpp b/src/storage/blocksstable/ob_datum_rowkey.cpp index 368d72652..7a0c8ba76 100644 --- a/src/storage/blocksstable/ob_datum_rowkey.cpp +++ b/src/storage/blocksstable/ob_datum_rowkey.cpp @@ -94,7 +94,8 @@ int ObDatumRowkey::equal(const ObDatumRowkey &rhs, const ObStorageDatumUtils &da return ret; } -int ObDatumRowkey::compare(const ObDatumRowkey &rhs, const ObStorageDatumUtils &datum_utils, int &cmp_ret) const +int ObDatumRowkey::compare(const ObDatumRowkey &rhs, const ObStorageDatumUtils &datum_utils, int &cmp_ret, + const bool compare_datum_cnt) const { int ret = OB_SUCCESS; @@ -114,7 +115,7 @@ int ObDatumRowkey::compare(const ObDatumRowkey &rhs, const ObStorageDatumUtils & STORAGE_LOG(WARN, "Failed to compare datum rowkey", K(ret), K(i), K(*this), K(rhs)); } } - if (0 == cmp_ret) { + if (0 == cmp_ret && compare_datum_cnt) { cmp_ret = datum_cnt_ - rhs.datum_cnt_; } } diff --git a/src/storage/blocksstable/ob_datum_rowkey.h b/src/storage/blocksstable/ob_datum_rowkey.h index 650180b0b..012e5e827 100644 --- a/src/storage/blocksstable/ob_datum_rowkey.h +++ b/src/storage/blocksstable/ob_datum_rowkey.h @@ -73,7 +73,8 @@ public: #undef DEF_ROWKEY_TYPE_FUNCS int equal(const ObDatumRowkey &rhs, const ObStorageDatumUtils &datum_utils, bool &is_equal) const; - int compare(const ObDatumRowkey &rhs, const ObStorageDatumUtils &datum_utils, int &cmp_ret) const; + int compare(const ObDatumRowkey &rhs, const ObStorageDatumUtils &datum_utils, int &cmp_ret, + const bool compare_datum_cnt = true) const; int from_rowkey(const ObRowkey &rowkey, common::ObIAllocator &allocator); int from_rowkey(const ObRowkey &rowkey, ObStorageDatumBuffer &datum_buffer); int to_store_rowkey(const common::ObIArray &col_descs, diff --git a/src/storage/blocksstable/ob_index_block_row_scanner.cpp b/src/storage/blocksstable/ob_index_block_row_scanner.cpp index e20115c35..4326abaae 100644 --- a/src/storage/blocksstable/ob_index_block_row_scanner.cpp +++ b/src/storage/blocksstable/ob_index_block_row_scanner.cpp @@ -414,10 +414,10 @@ int ObIndexBlockRowScanner::check_blockscan( LOG_WARN("Fail to get last row of micro block", K(ret), K_(end)); } else if (OB_FAIL(last_endkey.assign(tmp_datum_row.storage_datums_, datum_utils_->get_rowkey_count()))) { LOG_WARN("Fail to assign storage datum to endkey", K(ret), K(tmp_datum_row)); - } else if (OB_FAIL(last_endkey.compare(rowkey, *datum_utils_, cmp_ret))) { + } else if (OB_FAIL(last_endkey.compare(rowkey, *datum_utils_, cmp_ret, false))) { LOG_WARN("Fail to compare rowkey", K(ret), K(last_endkey), K(rowkey)); } - } else if (OB_FAIL((idx_data_header_->rowkey_array_ + end_)->compare(rowkey, *datum_utils_, cmp_ret))) { + } else if (OB_FAIL((idx_data_header_->rowkey_array_ + end_)->compare(rowkey, *datum_utils_, cmp_ret, false))) { LOG_WARN("Fail to compare rowkey", K(ret), K(rowkey)); }