0
0
Fork 0

Merge pull request #848 from abhinavdangeti/curr

Getting rid of panics added for debugging MB-28719,MB-28781
This commit is contained in:
Abhinav Dangeti 2018-03-20 15:14:22 -07:00 committed by GitHub
commit ae27aa2f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 21 deletions

View File

@ -755,10 +755,6 @@ 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))
}
}
}

View File

@ -17,7 +17,6 @@ package zap
import (
"bytes"
"encoding/binary"
"fmt"
"math"
"sort"
"sync"
@ -289,16 +288,6 @@ func (s *interim) getOrDefineField(fieldName string) int {
return int(fieldIDPlus1 - 1)
}
// the fieldName must be for a known field
func (s *interim) getField(fieldName string) int {
fieldIDPlus1, exists := s.FieldsMap[fieldName]
if !exists || fieldIDPlus1 <= 0 {
panic(fmt.Sprintf("getField saw unknown fieldName: %s, fieldsMap: %#v",
fieldName, s.FieldsMap))
}
return int(fieldIDPlus1 - 1)
}
// fill Dicts and DictKeys from analysis results
func (s *interim) prepareDicts() {
var pidNext int
@ -339,14 +328,14 @@ func (s *interim) prepareDicts() {
for _, result := range s.results {
// walk each composite field
for _, field := range result.Document.CompositeFields {
fieldID := uint16(s.getField(field.Name()))
fieldID := uint16(s.getOrDefineField(field.Name()))
_, tf := field.Analyze()
visitField(fieldID, tf)
}
// walk each field
for i, field := range result.Document.Fields {
fieldID := uint16(s.getField(field.Name()))
fieldID := uint16(s.getOrDefineField(field.Name()))
tf := result.Analyzed[i]
visitField(fieldID, tf)
}
@ -450,14 +439,14 @@ func (s *interim) processDocument(docNum uint64,
// walk each composite field
for _, field := range result.Document.CompositeFields {
fieldID := uint16(s.getField(field.Name()))
fieldID := uint16(s.getOrDefineField(field.Name()))
ln, tf := field.Analyze()
visitField(fieldID, field.Name(), ln, tf)
}
// walk each field
for i, field := range result.Document.Fields {
fieldID := uint16(s.getField(field.Name()))
fieldID := uint16(s.getOrDefineField(field.Name()))
ln := result.Length[i]
tf := result.Analyzed[i]
visitField(fieldID, field.Name(), ln, tf)
@ -488,7 +477,7 @@ func (s *interim) processDocument(docNum uint64,
for _, loc := range tf.Locations {
var locf = uint16(fieldID)
if loc.Field != "" {
locf = uint16(s.getField(loc.Field))
locf = uint16(s.getOrDefineField(loc.Field))
}
var arrayposs []uint64
if len(loc.ArrayPositions) > 0 {
@ -528,7 +517,7 @@ func (s *interim) writeStoredFields() (
}
for _, field := range result.Document.Fields {
fieldID := uint16(s.getField(field.Name()))
fieldID := uint16(s.getOrDefineField(field.Name()))
opts := field.Options()