fix recover table stat failed

This commit is contained in:
wxhwang
2023-10-31 17:43:03 +00:00
committed by ob-robot
parent 0381671bd8
commit 92ad623e8c
5 changed files with 10 additions and 4 deletions

View File

@ -245,12 +245,14 @@ int ObOptStatManager::update_column_stat(share::schema::ObSchemaGetterGuard *sch
const ObObjPrintParams &print_params)
{
int ret = OB_SUCCESS;
ObArenaAllocator allocator("UpdateColStat", OB_MALLOC_NORMAL_BLOCK_SIZE, tenant_id);
int64_t current_time = ObTimeUtility::current_time();
if (!inited_) {
ret = OB_NOT_INIT;
LOG_WARN("optimizer statistics manager has not been initialized.", K(ret));
} else if (OB_FAIL(stat_service_.get_sql_service().update_column_stat(schema_guard,
tenant_id,
allocator,
trans,
column_stats,
current_time,
@ -384,6 +386,7 @@ int ObOptStatManager::batch_write(share::schema::ObSchemaGetterGuard *schema_gua
const ObObjPrintParams &print_params)
{
int ret = OB_SUCCESS;
ObArenaAllocator allocator("UpdateColStat", OB_MALLOC_NORMAL_BLOCK_SIZE, tenant_id);
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("optimizer statistics manager has not been initialized.", K(ret));
@ -399,6 +402,7 @@ int ObOptStatManager::batch_write(share::schema::ObSchemaGetterGuard *schema_gua
} else if (!column_stats.empty() &&
OB_FAIL(stat_service_.get_sql_service().update_column_stat(schema_guard,
tenant_id,
allocator,
trans,
column_stats,
current_time,

View File

@ -476,6 +476,7 @@ int ObOptStatSqlService::update_table_stat(const uint64_t tenant_id,
int ObOptStatSqlService::update_column_stat(share::schema::ObSchemaGetterGuard *schema_guard,
const uint64_t exec_tenant_id,
ObIAllocator &allocator,
ObMySQLTransaction &trans,
const ObIArray<ObOptColumnStat*> &column_stats,
const int64_t current_time,
@ -488,7 +489,6 @@ int ObOptStatSqlService::update_column_stat(share::schema::ObSchemaGetterGuard *
ObSqlString insert_histogram;
ObSqlString delete_histogram;
ObSqlString column_stats_sql;
ObArenaAllocator allocator("UpdateColStat", OB_MALLOC_NORMAL_BLOCK_SIZE, exec_tenant_id);
bool need_histogram = false;
if (!inited_) {
ret = OB_NOT_INIT;

View File

@ -105,6 +105,7 @@ public:
const bool is_history_stat = false);
int update_column_stat(share::schema::ObSchemaGetterGuard *schema_guard,
const uint64_t exec_tenant_id,
ObIAllocator &allocator,
ObMySQLTransaction &trans,
const common::ObIArray<ObOptColumnStat*> &column_stats,
const int64_t current_time,