fix append sample size not correct

This commit is contained in:
ChangerR 2024-07-17 09:56:54 +00:00 committed by ob-robot
parent 1bc5b4c658
commit e03f133ffc
2 changed files with 6 additions and 3 deletions

View File

@ -147,7 +147,7 @@ public:
const static uint64_t RATE_BASE100 = 10000000;
k_ = 0;
if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_2_0) {
uint64_t rate = static_cast<uint64_t>(ceil(sample_rate * RATE_BASE));
uint64_t rate = static_cast<uint64_t>(floor(sample_rate * RATE_BASE));
uint64_t divisor = gcd(rate, RATE_BASE100);
sample_rate_ = rate / divisor;
sample_step_ = RATE_BASE100 / divisor;

View File

@ -350,7 +350,8 @@ int ObOptStatSqlService::fetch_table_stat(const uint64_t tenant_id,
"macro_blk_cnt as macro_block_num, "
"micro_blk_cnt as micro_block_num, "
"stattype_locked as stattype_locked,"
"last_analyzed FROM %s ", share::OB_ALL_TABLE_STAT_TNAME))) {
"last_analyzed,"
"spare1 as sample_size FROM %s ", share::OB_ALL_TABLE_STAT_TNAME))) {
LOG_WARN("fail to append SQL stmt string.", K(sql), K(ret));
} else if (OB_FAIL(sql.append_fmt(" WHERE TENANT_ID = %ld AND TABLE_ID=%ld",
ObSchemaUtils::get_extract_tenant_id(exec_tenant_id, tenant_id),
@ -410,7 +411,8 @@ int ObOptStatSqlService::batch_fetch_table_stats(sqlclient::ObISQLConnection *co
"macro_blk_cnt as macro_block_num, "
"micro_blk_cnt as micro_block_num, "
"stattype_locked as stattype_locked,"
"last_analyzed FROM %s", share::OB_ALL_TABLE_STAT_TNAME))) {
"last_analyzed,"
"spare1 as sample_size FROM %s", share::OB_ALL_TABLE_STAT_TNAME))) {
LOG_WARN("fail to append SQL stmt string.", K(sql), K(ret));
} else if (OB_FAIL(generate_in_list(part_ids, part_list))) {
LOG_WARN("failed to generate in list", K(ret));
@ -1189,6 +1191,7 @@ int ObOptStatSqlService::fill_table_stat(common::sqlclient::ObMySQLResult &resul
stat.set_stat_expired_time(ObTimeUtility::current_time() + ObOptStatMonitorCheckTask::CHECK_INTERVAL);
}
}
EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, sample_size, stat, int64_t);
}
return ret;
}