AlinsRan commented on code in PR #12214: URL: https://github.com/apache/apisix/pull/12214#discussion_r2094960175
########## apisix/core/config_yaml.lua: ########## @@ -256,12 +281,26 @@ local function sync_data(self) end if data_valid then - insert_tab(self.values, conf_item) - local item_id = conf_item.value.id or self.key .. "#" .. id - item_id = tostring(item_id) - self.values_hash[item_id] = #self.values - conf_item.value.id = item_id - conf_item.clean_handlers = {} + local item_id = tostring(id) + local pre_index = self.values_hash[item_id] + if pre_index then + -- remove the old item + local pre_val = self.values[pre_index] + if pre_val and + (not pre_val.modifiedIndex or pre_val.modifiedIndex ~= modifiedIndex) then + log.error("fire all clean handlers for ", self.key, " id: ", id, + " modifiedIndex: ", modifiedIndex) + config_util.fire_all_clean_handlers(pre_val) + self.values[pre_index] = conf_item + conf_item.value.id = item_id + conf_item.clean_handlers = {} + end Review Comment: In the above processing, if the ID is the same and there is a modifiedIndex, it will not be overwritten. Here, the old table that satisfies the change will be overwritten and updated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org