-
Notifications
You must be signed in to change notification settings - Fork 231
removing tombstones #2989
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
base: next
Are you sure you want to change the base?
removing tombstones #2989
Conversation
fd5a12c
to
91cec06
Compare
|
||
boolean moveAhead = false; | ||
String latest = managedInformerEventSource.getLastSyncResourceVersion(resourceId.getNamespace()).orElse(null); | ||
if (latest != null && latest > newResource.getMetadata().getResourceVersion()) { |
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.
Is it guaranteed that those events (maybe for different resource names) come in order in watches?
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.
But I guess if we going to compare the resource versions in informers that does not matter.
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.
My understanding is that ordering is guarenteed. So this is applicable not only to getting rid of tombstones, but putting anything into the cache in general - added that as another simplification.
Also the javadoc on getLastSyncResourceVersion could use some improvement. Updates to the cache are made prior to async event processing. So the underlying cache state should be correct up to the given resourceVersion at the time we check getLastSyncResourceVersion.
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.
My understanding is that ordering is guarenteed. So this is applicable not only to getting rid of tombstones, but putting anything into the cache in general - added that as another simplification.
I see, I know that it is true for a single resource, but for example there are multiple resources in the same type, if that still comes in order, but I guess yes, can also quickly take a look today on some cluster and watch some events.
Thank you, this is great!!
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.
( also if you could join us tomorrow on community meeting we could discuss strategy would be great, thinking if these improvements should go to 5.2 or rather the next 5.3 so we can iterate and discuss more, and there is no pressure, since might be good to do a minor release soonish )
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.
Is that on zoom at 15:00 CEST?
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.
yes
78af174
to
a810ac9
Compare
"Temporarily moving ahead to target version {} for resource id: {}", | ||
newResource.getMetadata().getResourceVersion(), | ||
resourceId); | ||
cache.put(resourceId, newResource); |
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.
This should be safe to do without further conditions as long as there is no chance that the operator sdk is making effectively concurrent updates to the same resource - if that's possible, then we still need to compare the cache item to what is being put.
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.
Converted to a comment in the code
c0fbec7
to
f621fc9
Compare
var res = cache.get(resourceID); | ||
Optional<R> resource = temporaryResourceCache.getResourceFromCache(resourceID); | ||
if (resource.isPresent()) { | ||
if (resource.isPresent() && res.filter(r -> r.getMetadata().getResourceVersion() < resource.get().getMetadata().getResourceVersion()).isPresent()) { |
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.
If events are processed async from the cache update, it's possible for the informer cache to be more up-to-date than the temporary resource cache.
|
||
boolean moveAhead = false; | ||
String latest = managedInformerEventSource.getLastSyncResourceVersion(resourceId.getNamespace()).orElse(null); | ||
if (latest != null && latest > newResource.getMetadata().getResourceVersion()) { |
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.
Is that on zoom at 15:00 CEST?
added branch for 5.3 (as we discuss on community meeting) to target resource version comparison related issues: thank you! |
edbe2b6
to
65649f1
Compare
@csviri just wanted to double check - what if anything do you want in next? I was thinking that only the annotation removal would go into 5.3. I have enabled parse versions by default, which does need some refinement - perhaps a better name and we lack a configuration value for on the primary resources. If it is not enabled, the the temporary resource cache won't do anything. There's no smart exception handling yet. If non comparable versions are seen, then you'll just get an exception - the message could mention disabling the feature. |
Although this will work, in almost all cases, since:
We might want to ship this as a whole in 5.3. So we have also more time and refine it. We can then release 5.3 with those feature quite quickly don't have to wait for other feature. What do you think? |
Do I see that this PR is same as: #3010 Should we close one of those? |
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.
Added just one comment, I lean towards 5.3 regarding this feature, and completely remove the flag for parsing fro that version.
Otherwise LGTM
public synchronized void putAddedResource(T newResource) { | ||
putResource(newResource, null); | ||
(unknownState | ||
|| PrimaryUpdateAndCacheUtils.compareResourceVersions(resource, cached) > 0) |
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.
Answering #3010 (comment) here - yes we can switch to >= because we're checking canSkipEvent first. I was starting to think more about the implications of the annotation removal and wondering if we should hold on to the resource that was created until it was obsolete, but we'll discuss that more on the annotation removal pr.
Closed the other one for now - if enabling parse versions seems like it should be separated, then it will be reopened with all the other changes stripped out. |
I don't think it can remove the flag if you want to allow for non-conforming sources. The configuration would also need expanded to the controller itself. |
Signed-off-by: Steve Hawkins <[email protected]>
65649f1
to
76b39b1
Compare
My idea is that we would detect non-conforming sources dynamically, so if the comparison algorithm throws an error we can flip a flag and don't compare the resources anymore. |
But for sake of simplicity we could configure it on InformerEventSources for now. (maybe as next PR) |
@csviri I misread your working draft at some point and thought you were tracking a single latest revision - that's all I need to remove tombstone tracking. If we are not relying on comparable resource versions, then I think we can simply reuse the informer last synced version to reason about all puts - not just creates.
I've left the latest check as non-compiling as that will line up with changes you have in other prs.