ChuanFF commented on PR #12288:
URL: https://github.com/apache/apisix/pull/12288#issuecomment-2995684914
@Baoyuantop if we want to removes old data that no longer exists, there is
a problem that how to records existing data keys,`ngx.shared.DICT.get_keys`
does not seem to be suitable(official document have a caution: Avoid calling
this method on dictionaries with a very large number of keys as it may lock the
dictionary for significant amount of time and block Nginx worker processes
trying to access the dictionary.)
I think we can prepare two tables, `data_history` and `data_existing`,
recording data to `data_existing` during `list` and `watch`, assigning
`data_existing` to `data_history` in `pre_list` and setting `data_existing` to
{}, then comparing `data_cached` with `data_existing` in `post_list` and
removes old data that no longer exists.
Test cases seem difficult to write, dirty data is generated only after the
watch ends and before the next list call, i do not know how to verify old data
that no longer exists, do you have any suggest?
Or can we ignore dirty data? After all, the conditions for dirty data to be
generated are harsh, and it seems to have no effect.
--
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]