-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[RFC] Modeling writes as an extensible workflow #3237
Comments
Few observations
There are few cases today that inherently rely on forwarding writes for correctness, for instance if the primary is partitioned off from the rest of the cluster, it continues to accept writes, once it forwards the request to the replica which meanwhile has been promoted to the primary, it then becomes aware of the problem and hence respond with a failure which otherwise would have been acknowledged and writes diverged.
With #1319, translogs would be decoupled from the Engine and would be made optional and extracted out |
At a high level this makes a lot of sense to me. If you see a refactor increment that would make the code better I would PR that on main. An alternative could be to try and setup the new workflow as proposed without touching the existing implementation, that could be a good start in a feature branch. |
Thanks @Bukhtawar ! These are exactly the kind of blind spots I was hoping to get feedback on. I'd like to understand this particular behavior more in depth. Are you aware of any reading material to learn more about this? Or could you point me to other resources (code, exceptions, etc.) from where I could start learning?
Decoupling translog behavior from Engine would indeed simplify its code. Assuming the next step is to decouple ingest/storage from Engine, I'm left wondering what value the Engine class itself is adding by encapsulating those two extension points. To use a food analogy again 😉 - what I'm asking is if the two extension points are like a bagel 🥯 and cream cheese (where it doesn't make sense to have them separately) or like fries 🍟 and soda (where it does) |
@nknize I saw this PR comment from you so I'd love to hear what you think about the ideas here, especially around what value the |
What's the problem?
Much of the code in the write path for segments is tightly coupled together. For example:
(I'll talk about why we would want to solve for these in a moment.)
This coupling is driven by the code architecture. In technical terms, I'd say it uses a compile-time, top-down (inheritance-based) chain of responsibility (CoR) design pattern. Put more simply, it's like spaghetti lasagna - lots of layers encasing lots of noodley code.
Such a design pattern poses two problems:
I think we can make this better (though that recipe is beyond saving IMO).
What should we do about it?
We should rearchitect write-path operations as a workflow comprised of the following configurable steps:
Persist and Forward will be conditional steps that rely on the output of prior steps to determine if they should execute.
Why do this now?
Because extensibility is one of key themes for Opensearch (#2095). It is essential that we start tackling this architectural limitation now since we have multiple ongoing initiatives for OpenSearch extensibility that require more run-time configurability:
Open Questions (aka things I'm mulling over)
Given the sheer breadth of functionality in the Opensearch codebase, there are probably other coupled components that I haven't considered. Please comment below if there are things that would break with this workflow approach, or other areas that may benefit from a similar approach.
The text was updated successfully, but these errors were encountered: