nic-6443 commented on code in PR #13717:
URL: https://github.com/apache/apisix/pull/13717#discussion_r3662535767


##########
apisix/core/config_etcd.lua:
##########
@@ -637,12 +667,35 @@ local function load_full_data(self, dir_res, headers)
                 if self.filter then
                     self.filter(item)
                 end
+
+            else
+                local prev_item = get_prev_item(prev_values, prev_values_hash, 
key)
+                if prev_item then
+                    -- keep serving with the last valid configuration instead 
of
+                    -- silently dropping the whole item on a full reload, see 
the
+                    -- incremental path in sync_data for the same semantics
+                    log.warn("failed to check item data of [", self.key, "/", 
key,
+                             "], keep the previous configuration, err: ", err)
+                    insert_tab(self.values, prev_item)
+                    self.values_hash[key] = #self.values
+                    carried[prev_item] = true
+                end
             end
 
             self:upgrade_version(item.modifiedIndex)
         end
     end
 
+    -- fire the clean handlers of the previous items that were not carried
+    -- over: they were either replaced by a new value or deleted from etcd
+    if prev_values then
+        for _, item in ipairs(prev_values) do
+            if item and not carried[item] then
+                config_util.fire_all_clean_handlers(item)
+            end
+        end
+    end

Review Comment:
   The entire clean handler should be removable after 
https://github.com/apache/apisix/pull/12426



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to