0
0
Fork 0

scorch zap panic if mergeFields() sees unsorted fields

mergeFields depends on the fields from the various segments being
sorted for the fieldsSame comparison to work.

Of note, the 'fieldi > 1' guard skips the 0th field, which should
always be the '_id' field.
This commit is contained in:
Steve Yen 2018-03-20 11:17:46 -07:00
parent 85b4a31e2a
commit 2f4d3d8587
1 changed files with 4 additions and 0 deletions

View File

@ -755,6 +755,10 @@ func mergeFields(segments []*SegmentBase) (bool, []string) {
if len(segment0Fields) != len(fields) || segment0Fields[fieldi] != field {
fieldsSame = false
}
if fieldi > 1 && field <= fields[fieldi-1] {
panic(fmt.Sprintf("mergeFields on unsorted fields: %#v", fields))
}
}
}