-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
removing the deltafifo to simplify the informer code #3061
Conversation
Can one of the admins verify this patch? |
c32ad76
to
80e2f65
Compare
9b0bde4
to
9624721
Compare
I don't agree with the sonarcloud bugs - seems like a valid usage of capturing arguments. I can clear out the type related code smells on a follow-on pr to refine the Cache interface. |
I'll rebase this after #3055 is committed |
I like this change. I think it'll simplify the flow a lot. Please note that with this we're diverging from client-go's notification distribution mechanism where it pops item from DeltaFifo and processes it. https://github.com/kubernetes/client-go/blob/master/tools/cache/controller.go#L181 |
I think that many of the low-level implementations that were initially ported from the Go Shared Informers made sense from a Golang perspective but not in a Java word. |
From a consumer's perspective nothing meaningful changes. The deltafifo is acting as an intermediary between the watch events and the cache updates / event distribution. However the cost of updating the deltafifo should if roughly the same as an operation directly on the cache (similar global lock, several hash lookups, etc.) - and the end event distribution is already happening on a different thread with the SharedProcessor. The deletefifo is not combining events in any meaningful way. It's only a narrow check for duplicate deletion, which should be handled anyway by the removal of the object from cache by the first delete. So I can't see much value in it currently and it holds a thread. |
Hi @shawkins |
I can update it if you want. My understanding was this may not go in anytime soon, so I'm not sure how often I need to rebase it. |
Relates to: #2010 |
OK sorry, I must be missing something. Why shouldn't this be merged? |
That was from a side conversation with @metacosm about not holding up the 5.4 release. I'll go ahead an update it. |
I think I just read this in the Java Operators GChat. The idea is to release 5.4 with not too much delay. I wanted to include most of the Informer improvements, and the required generator fixes. Since the latter need an updated version of Sundr.io I think we might be looking into next week for the 5.4 release. |
test failure doesn't seem related to this PR:
Anyway, I've restarted workflow |
This specific issue should go away with the sundrio update (hopefully). |
...rnetes-client/src/test/java/io/fabric8/kubernetes/client/informers/cache/ControllerTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx!
I have one more change I'd like to make here - I'd like to make the replace logic more consistent. |
I guess we're still waiting for the sundr.io fix, so feel free ;) |
this ensures that the cache state is fully updated by the time any of the notifications are processed
Okay this change fully makes use of the underlying stores replace method, and then processes notifications. |
Kudos, SonarCloud Quality Gate passed! |
…c8io#3061) * removing the deltafifo to simplify the informer code * better reuse of the actual store replace function this ensures that the cache state is fully updated by the time any of the notifications are processed
Description
The deltafifo adds a lot of complexity to the informer implementation with little to no benefit - it could only combine some delete events. It would be more straight-forward to just act directly over the cache. This reduces the number of threads dedicated to an informer by 1.
It's not in these changes, but it will allow the cache interface to become fully type safe
Type of change
test, version modification, documentation, etc.)
Checklist