patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -13,9 +13,11 @@
#define USING_LOG_PREFIX SQL_OPT
#include "ob_index_info_cache.h"
#include "sql/resolver/dml/ob_dml_stmt.h"
namespace oceanbase {
namespace oceanbase
{
using namespace common;
namespace sql {
namespace sql
{
ObIndexInfoCache::~ObIndexInfoCache()
{
@ -26,11 +28,14 @@ ObIndexInfoCache::~ObIndexInfoCache()
}
}
int ObIndexInfoCache::get_index_info_entry(
const uint64_t table_id, const uint64_t index_id, IndexInfoEntry*& entry) const
int ObIndexInfoCache::get_index_info_entry(const uint64_t table_id,
const uint64_t index_id,
IndexInfoEntry *&entry) const
{
int ret = OB_SUCCESS;
if (table_id != table_id_ || OB_UNLIKELY(OB_INVALID_ID == index_id)) {
entry = NULL;
if (table_id != table_id_ ||
OB_UNLIKELY(OB_INVALID_ID == index_id)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("table_id is invalid", K(index_id), K_(table_id), K(ret));
} else {
@ -47,8 +52,9 @@ int ObIndexInfoCache::get_index_info_entry(
return ret;
}
int ObIndexInfoCache::get_query_range(
const uint64_t table_id, const uint64_t index_id, const QueryRangeInfo*& range_info) const
int ObIndexInfoCache::get_query_range(const uint64_t table_id,
const uint64_t index_id,
const QueryRangeInfo *&range_info) const
{
int ret = OB_SUCCESS;
range_info = NULL;
@ -56,13 +62,13 @@ int ObIndexInfoCache::get_query_range(
ret = OB_INVALID_ARGUMENT;
LOG_WARN("table_id is invalid", K(table_id), K_(table_id), K(ret));
} else {
IndexInfoEntry* entry = NULL;
IndexInfoEntry *entry = NULL;
if (OB_FAIL(get_index_info_entry(table_id, index_id, entry))) {
LOG_WARN("failed to get index_info entry", K(index_id), K(ret));
} else if (OB_ISNULL(entry)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("entry should not be null", K(ret));
} else if (entry->get_range_info().is_valid()) {
} else if (entry->get_range_info().is_valid()){
range_info = &entry->get_range_info();
} else {
LOG_TRACE("entry is invalid", K(table_id), K(index_id));
@ -71,8 +77,12 @@ int ObIndexInfoCache::get_query_range(
return ret;
}
int ObIndexInfoCache::get_access_path_ordering(
const uint64_t table_id, const uint64_t index_id, const OrderingInfo*& ordering_info) const
/*
* 这个接口和ob_join_order.cpp 的 get_access_path_ordering一样,只是从cache里面拿到ordering info
* */
int ObIndexInfoCache::get_access_path_ordering(const uint64_t table_id,
const uint64_t index_id,
const OrderingInfo *&ordering_info) const
{
int ret = OB_SUCCESS;
ordering_info = NULL;
@ -80,7 +90,7 @@ int ObIndexInfoCache::get_access_path_ordering(
ret = OB_INVALID_ARGUMENT;
LOG_WARN("table_id is invalid", K(table_id), K_(table_id), K(ret));
} else {
IndexInfoEntry* entry = NULL;
IndexInfoEntry *entry = NULL;
if (OB_FAIL(get_index_info_entry(table_id, index_id, entry))) {
LOG_WARN("failed to get index_info entry", K(index_id), K(ret));
} else if (OB_ISNULL(entry)) {
@ -93,7 +103,7 @@ int ObIndexInfoCache::get_access_path_ordering(
return ret;
}
int ObIndexInfoCache::add_index_info_entry(IndexInfoEntry* entry)
int ObIndexInfoCache::add_index_info_entry(IndexInfoEntry *entry)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(entry)) {
@ -101,7 +111,8 @@ int ObIndexInfoCache::add_index_info_entry(IndexInfoEntry* entry)
LOG_WARN("entry should not be null", K(ret));
} else if (entry_count_ >= common::OB_MAX_INDEX_PER_TABLE + 1) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid entry count", K(ret), K_(entry_count), K(common::OB_MAX_INDEX_PER_TABLE));
LOG_WARN("invalid entry count", K(ret), K_(entry_count),
K(common::OB_MAX_INDEX_PER_TABLE));
} else {
index_entrys_[entry_count_] = entry;
++entry_count_;
@ -109,5 +120,7 @@ int ObIndexInfoCache::add_index_info_entry(IndexInfoEntry* entry)
return ret;
}
} // end of namespace sql
} // end of namespace oceanbase
} //end of namespace sql
} //end of namespace oceanbase