Closed chris-ramon closed 8 years ago
Awesome! I left some minor comments inline. Also, I queued a few builds and it does indeed look like this fixed the problem. Thanks for tracking this down!
@slimsag thanks for reviewing this one, I def agree on the comments you mentioned above, I've sent the updates.
I have a question because I'm not familiar with the code.
Is the order of collected packets non-deterministic? I see that you're sorting a slice. If it's deterministic, isn't it possible to simply arrange the "want" slice to have the same order as the "got", removing the need for dynamic sorting?
If the order is indeed non-deterministic, then this solution is good.
Thanks @chris-ramon -- LGTM.
@shurcooL yeah, the order is non-deterministic. We were seeing builds fail randomly (see #101) and not deterministically. Out of my curiosity, and for your record, I fact checked. The reason this happens is because ChunkedCollector.Collect uses a map for internally storing these. You can see that here (look for pendingBySpanID
): https://sourcegraph.com/github.com/sourcegraph/appdash@master/.GoPackage/github.com/sourcegraph/appdash/.def/ChunkedCollector/Collect
I understand and I've confirmed that's right, thanks. :+1:
Details
Issue: #101
TestChunkedCollector
- it does intermittently fails becasereflect.DeepEqual
cares about element position when comparing, soexpected
&actual
variables being compare sometimes might have the same elements but in different order.type byTraceID
which we do use to sort[]*wire.CollectPacket
withinTestChunkedCollector
.