X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Finternal%2Ftrace%2Fv2%2Fgeneration.go;h=4cdf76e21c06f95463fbff4d819a4f837f23ceac;hb=e8298c09b1154e3eb3560352ebbea6d11d87772e;hp=b4305157939c75117ce5acff9bd90694cebd5555;hpb=acc8cb6a5f23d7fb57ea5825decd6bf0ae8723e9;p=gostls13.git diff --git a/src/internal/trace/v2/generation.go b/src/internal/trace/v2/generation.go index b430515793..4cdf76e21c 100644 --- a/src/internal/trace/v2/generation.go +++ b/src/internal/trace/v2/generation.go @@ -95,15 +95,11 @@ func readGeneration(r *bufio.Reader, spill *spilledBatch) (*generation, *spilled if g.freq == 0 { return nil, nil, fmt.Errorf("no frequency event found") } - for _, batches := range g.batches { - sorted := slices.IsSortedFunc(batches, func(a, b batch) int { - return cmp.Compare(a.time, b.time) - }) - if !sorted { - // TODO(mknyszek): Consider just sorting here. - return nil, nil, fmt.Errorf("per-M streams are out-of-order") - } - } + // N.B. Trust that the batch order is correct. We can't validate the batch order + // by timestamp because the timestamps could just be plain wrong. The source of + // truth is the order things appear in the trace and the partial order sequence + // numbers on certain events. If it turns out the batch order is actually incorrect + // we'll very likely fail to advance a partial order from the frontier. // Compactify stacks and strings for better lookup performance later. g.stacks.compactify()