Test/Operator Modernization #1014
Replies: 3 comments 7 replies
-
All sound reasonable to me. One more I'd add is we should get rid of the original sort related operators for cache operators. Then we can remove index and previous index from the change. |
Beta Was this translation helpful? Give feedback.
-
Sounds complicated. For single change set operators I think it should be for the producer to handle the batches. However, for the merge / combiner related changesets it's definitely worth seeing whether it's feasible. |
Beta Was this translation helpful? Give feedback.
-
I'm about to check in the updates for cache Do we actually WANT the behavior described in 3.1? The more I think about it, the more I think we really don't. That is, we should publish an initial changeset, upon subscription, when the collection is not empty, but there's no need for it if it is. As far as I can recall, there's only ONE reason that we would need to do this, and it's for aggregation operators, but.... aggregation operators could just be reworked to not require an initial changeset. Specifically, we can implement that aggregation operators themselves always publish an initial value, even when they don't receive an initial changeset (in which case, they can simply assume that the upstream is empty, and aggregate based on that). In the process of updating the All this in mind, I think it's a MUCH simpler solution to just make aggregation operators not require an initial changeset. I don't know how much complexity is baked into those operators, though, so I'm going to see if I can prove that concept before we commit to it. Are there any other scenarios I'm not thinking of where publishing an initial empty changeset is useful? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So, with most of the outstanding issues and feature requests cleared out, I'm interested in dong some pro-active maintenance work, I.E. seeking out bug and enhancements in the existing codebase.
The way to do this, I figure, is to focus on enhancing test thoroughness, across existing operators. There's a few things we've talked about in passing, over the last couple years, that we'd like to be consistent about:
1.1. Errors in source streams should virtually always propagate downstream, particularly in scenarios where there are multiple source streams, or child streams, involved.
1.2. Exceptions thrown by delegates should be caught and forwarded downstream.
1.3.
.SubscribeSafe()
should be used to ensure that immediate exceptions get caught and forwarded downstream.2.1. Downstream completion should, generally, wait for all upstream completions to occur. What this means specifically will vary from operator to operator, but ultimately, a completion should occur when there is no possibility for further "next" notifications to occur.
3.1. Operators should always forward an initial changeset, even when empty, and even when the operator otherwise suppresses empty changesets.
3.1.1. That's not to say that operators should publish an initial changeset upon subscription, like source collections do, they should just respond to the first changeset they see by always emitting at least an empty changeset.
3.2. Operators should generally suppress empty changesets after the initial changeset. Exceptions include operators where an option for this is specified by the consumer, or the operator documents otherwise.
4.1. Operators should generate at most one downstream changeset for each upstream notification.
4.2. @dwcullop proposed recently that we could even do better than this: that when a notification comes in while another is being processed, and has to wait, it can signal to the first notification to hold its changeset, so the second notification can add on to it. Thoughts?
5.1. Basically, use
.ValidateChangeSets()
downstream of operators being tested. This verifies that key values are always correct, items are never removed before being added, etc.6.1. Notification sequencing, I.E. "only one error or completion notification can occur, and those should end the stream." This theoretically shouldn't be an issue, so long as we're using
System.Reactive
base types, but being explicit helps make us future-proof.6.2. Notification synchronization, I.E. notifications coming out of a stream should be serialized. I.E. any operator that consumes multiple source streams needs to be exercised for multi-thread safety, along with use of
.ValidateSynchronization()
.I think that's everything I've had on my mind. @dwcullop @RolandPheasant I'd like to lake sure we're all in agreement on these points before I really start digging into writing new tests.
Beta Was this translation helpful? Give feedback.
All reactions