Skip to content

Commit 04a694e

Browse files
csviriCopilot
andauthored
docs: simpler event filtering section read-after-write-consistency blog (#3449)
* docs: simpler event filtering section read-after-write-consistency blog the current description described the algorithm in unecessary depth, for me seemed rather confusing. Therefore, referting it with an updated version of original form. Signed-off-by: Attila Mészáros <a_meszaros@apple.com> * wording Signed-off-by: Attila Mészáros <a_meszaros@apple.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent afc32de commit 04a694e

1 file changed

Lines changed: 9 additions & 35 deletions

File tree

docs/content/en/blog/news/read-after-write-consistency.md

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -223,41 +223,15 @@ sequenceDiagram
223223

224224
## Filtering events for our own updates
225225

226-
When we update a resource, eventually the informer will propagate an event that would trigger a reconciliation.
227-
However, this is mostly not desired. Since we already have the up-to-date resource at that point,
228-
we would like to be notified only if the resource is changed after our change.
229-
230-
The framework runs a per-resource *event filter window* around each in-flight
231-
write: it records the resource version returned by our update, buffers any
232-
related events that arrive in the meantime, and at the end of the window
233-
decides what (if anything) to surface to the reconciler. The rules:
234-
235-
- **Pure own echo**: if the only events in the window are watch events whose
236-
resource versions match our recorded own writes (and the action is `UPDATED`),
237-
they are filtered out — the reconciler isn't bothered.
238-
- **Foreign change in the window**: if a resource version arrived that was *not*
239-
one of our own writes — e.g. a third party modified the resource between two
240-
of our updates — the framework synthesizes a single `UPDATED` event covering
241-
the whole window (`previousResource` = the resource just before the window,
242-
`resource` = the latest known state). The reconciler is notified once, with a
243-
faithful before/after picture, instead of receiving each underlying watch
244-
event individually.
245-
- **DELETE in the middle**: if the resource was deleted at some point during
246-
the window, that DELETE participates in the synthesis. A trailing `DELETED`
247-
is surfaced verbatim; a DELETE-then-recreate inside the window collapses to
248-
an `UPDATED` from the deleted state to the recreated state.
249-
- **Held foreign events**: a foreign event that arrives *before* the matching
250-
own write echo is buffered until the write completes. This avoids
251-
surfacing it as foreign only to immediately overwrite it with a synthesized
252-
echo.
253-
- **ReList**: events arriving while the informer is performing a relist are
254-
tagged. Because a relist may have hidden events, the framework defaults to
255-
surfacing such events to the reconciler rather than silently filtering
256-
them — even when they would otherwise look like our own echoes.
257-
258-
This way we significantly reduce the number of reconciliations, making the whole
259-
process much more efficient, while preserving the invariant that any
260-
foreign change reaches the reconciler.
226+
When we update a resource, the informer will eventually propagate an event that would trigger a reconciliation.
227+
In most cases, however, this is not desirable. Since we already have the up-to-date resource at that point,
228+
we want to be notified only when the change originates outside our reconciler.
229+
Therefore, in addition to caching the resource, we filter out events caused by our own updates.
230+
231+
Note that the implementation of this is relatively complex: while performing the update, we record all the
232+
events received in the meantime and decide whether to propagate them further once the update request completes.
233+
234+
This way, we significantly reduce the number of reconciliations, making the whole process much more efficient.
261235

262236
### The case for instant reschedule
263237

0 commit comments

Comments
 (0)