-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onUpdate is called on re-list even if resourceVersion is unchaged #3969
Comments
Internally this is processed as a resync event, so this should only happen if the listener is due for resync events. Line 97 in 12af747
|
this is on 6.0.0-SNAPSHOT @shawkins . I don't remember that it was that way on 5.x |
It's been this way since #3318
From what I recall not filtering matches the behavior of the go client. If you have resync disabled, then you won't see events like this. |
In our project, we are ending up filtering the event, as disabling resync was not also an option. Because, we are fearing to loose some events at some point. So, having a regular resync makes things clearer for us. What do you suggest @shawkins ? I would be interested in knowing how users of go client are handling this. any feedback? |
All resync events have unchanged resourceVersions - if you are filtering them then you have effectively disabled resync. |
It's worth mentioning that in 5.11+ relists are much less frequent as the underlying watch will use bookmarks. |
unless we really missed an event. In this case, a We will give it a try that way then. And, we will also try a version with And, we can probably close the issue then, and I may ask to re-open if I got additional arguments for the discussion. Thanks @shawkins |
Can you clarify which local object you are referring to? What I'm saying is that on all resync events when onUpdate is called oldObj and newObj will be the same. |
we are putting some watched objects (ConfigMap) in our local cache (basically a Map). When we received an update event for an object, we were replacing it (delete/insert) in our local cache. |
How does the local cache differ from the informer cache/store? |
it was there for historical reason, even before we migrated to informers. We have objects coming from file, and others for which the That's our internal sauce. We cannot change it easily without risking another set of regressions. |
Here's the relevant commit from the go client kubernetes/client-go@b775e00
The implication here is that their handling of the Replace event happens regardless of whether the Handlers use resync. So our handling already differs. At the time that we process the event we can discern if it's an update or a sync. I'll walk back my earlier assessment and say that it seems fine to take this one step further and to just not emit these in the sync case.
Understandable. I'm always curious to see how resync is being used as there's a lot of somewhat fragile logic dedicated to it and it's a blunt instrument - at it's core it's simply a timed job that iterates over the cache values and calls onUpdate. I'd like to better understand how it might be improved - such as only re-syncing for handler calls that through an exception (relates to #3968) |
@akram is this something you can do the pr for? |
@shawkins it seems good to have the discussion about it. And, these small implementations differences or behaviour are often the causes of bugs :-) Regarding working out a PR right now, I don't have a lot of time this week, and I could have a look only by the end of next week. And, also, currently, we are using a 5.x version, which may differ from 6.x, so, my PR would probably only target 5.x. If, you think that you could be more efficient in writing a PR for 6.x, feel free to go ahead, I can then focus on migrating our plugin to 6.x and wait for the 6.0.0 Final. Also, the question of backward compatibility is important here. For users who already "exploit" the existing behaviour, they may be impacted. So, should we introduce a compatibility flag? and what should be the default? |
I would not introduce a flag. These events are dependent upon a relist, which there is no user way of triggering and will be very rare with 5.11+. These events also don't represent a change, so it would be odd for a user to be dependent upon them - at worst it's an infrequent off period sync event. So this is really a narrow change, which after reviewing the work in the go client, I'm fine with diverging further. |
…mers opening back up to store modifications - but they are atomic and based upon resourceVersion also stop emiting sync events on relist (which was a natural result of the first changes) and several other informer related changes
also omitting resync events on relist
also omitting resync events on relist
…s complete also omitting resync events on relist
also omitting resync events on relist
also omitting resync events on relist
Describe the bug
When a re-list happens, an onUpdate event is received even if the object resourceVersion didn't change.
5.10.1
Fabric8 Kubernetes Client version
5.10.1@latest
Steps to reproduce
create a test having a relist to a quite short version
wait for the relist to happen
see that an onUpdate is triggered for even a not changed object
Expected behavior
the onUpdate should not be triggered if resourceVersion is unchanged
Runtime
OpenShift
Kubernetes API Server version
1.22.3@latest
Environment
Amazon
Fabric8 Kubernetes Client Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: