Fix: update_cold must not overwrite SHM stat_values and fetch_mark
Mon's update_map_rule() called update_cold() which blindly copied RuleStatLocal's stat_values (always empty in mon) and fetch_mark (always false in mon) into SHM, destroying accumulated data and breaking the mon-cron handshake. stat_values and fetch_mark are managed exclusively by the add_stat_value/get_stat_value handshake. The cold sync path only needs to transport running_time and shear_times.
This commit is contained in:
parent
02447c733a
commit
b3932b0af8
@ -134,9 +134,7 @@ bool EqpStat::update_cold(const std::string &ruleid,
|
|||||||
const RuleStatShm::RuleStatLocal &rule_stat) {
|
const RuleStatShm::RuleStatLocal &rule_stat) {
|
||||||
try {
|
try {
|
||||||
RuleStatShm::RuleStatCold cold;
|
RuleStatShm::RuleStatCold cold;
|
||||||
cold.stat_values.assign(rule_stat.stat_values.begin(),
|
// stat_values 和 fetch_mark 由 SHM 的 add_stat_value/get_stat_value 握手管理
|
||||||
rule_stat.stat_values.end());
|
|
||||||
cold.fetch_mark = rule_stat.fetch_mark;
|
|
||||||
cold.running_time = rule_stat.running_time;
|
cold.running_time = rule_stat.running_time;
|
||||||
cold.shear_times = rule_stat.shear_times;
|
cold.shear_times = rule_stat.shear_times;
|
||||||
return mapRuleStat.update_cold_fields(ruleid, cold);
|
return mapRuleStat.update_cold_fields(ruleid, cold);
|
||||||
|
|||||||
@ -166,10 +166,10 @@ struct RuleStatCold {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 仅同步 running_time / shear_times,不覆盖 stat_values 和 fetch_mark
|
||||||
|
///(后者由 add_stat_value / get_stat_value 握手管理)
|
||||||
bool update_cold(const RuleStatCold &value) {
|
bool update_cold(const RuleStatCold &value) {
|
||||||
try {
|
try {
|
||||||
stat_values = value.stat_values;
|
|
||||||
fetch_mark = value.fetch_mark;
|
|
||||||
running_time = value.running_time;
|
running_time = value.running_time;
|
||||||
shear_times = value.shear_times;
|
shear_times = value.shear_times;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user