Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…367904046

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Jan 15, 2023
1 parent 5d7b991 commit 52d6c0b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
4 changes: 3 additions & 1 deletion contentcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ var (
)

type chunkedContentCoder struct {
// atomic access to this variable
bytesWritten uint64

final []byte
chunkSize uint64
currChunk uint64
Expand All @@ -45,7 +48,6 @@ type chunkedContentCoder struct {
compressed []byte // temp buf for snappy compression

w io.Writer
bytesWritten uint64 // atomic access to this variable
progressiveWrite bool

chunkMeta []MetaData
Expand Down
6 changes: 3 additions & 3 deletions docvalues.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ type docVisitState struct {
}

type docValueReader struct {
// atomic access to this variable
bytesRead uint64

field string
curChunkNum uint64
chunkOffsets []uint64
dvDataLoc uint64
curChunkHeader []MetaData
curChunkData []byte // compressed data cache
uncompressed []byte // temp buf for snappy decompression

// atomic access to this variable
bytesRead uint64
}

func (di *docValueReader) size() int {
Expand Down
6 changes: 3 additions & 3 deletions intDecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (
)

type chunkedIntDecoder struct {
// atomic access to this variable
bytesRead uint64

startOffset uint64
dataStartOffset uint64
chunkOffsets []uint64
curChunkBytes []byte
data []byte
r *memUvarintReader

// atomic access to this variable
bytesRead uint64
}

// newChunkedIntDecoder expects an optional or reset chunkedIntDecoder for better reuse.
Expand Down
6 changes: 3 additions & 3 deletions intcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ import (
const termNotEncoded = 0

type chunkedIntCoder struct {
// atomic access to this variable
bytesWritten uint64

final []byte
chunkSize uint64
chunkBuf bytes.Buffer
chunkLens []uint64
currChunk uint64

buf []byte

// atomic access to this variable
bytesWritten uint64
}

// newChunkedIntCoder returns a new chunk int coder which packs data into
Expand Down
6 changes: 3 additions & 3 deletions new.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ var interimPool = sync.Pool{New: func() interface{} { return &interim{} }}
// interim holds temporary working data used while converting from
// analysis results to a zap-encoded segment
type interim struct {
// atomic access to this variable
bytesWritten uint64

results []index.Document

chunkMode uint32
Expand Down Expand Up @@ -146,9 +149,6 @@ type interim struct {

lastNumDocs int
lastOutSize int

// atomic access to this variable
bytesWritten uint64
}

func (s *interim) reset() (err error) {
Expand Down
12 changes: 6 additions & 6 deletions posting.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ var NormBits1Hit = uint64(1)

// PostingsList is an in-memory representation of a postings list
type PostingsList struct {
// atomic access to this variable
bytesRead uint64

sb *SegmentBase
postingsOffset uint64
freqOffset uint64
Expand All @@ -109,9 +112,6 @@ type PostingsList struct {
normBits1Hit uint64

chunkSize uint64

// atomic access to this variable
bytesRead uint64
}

// represents an immutable, empty postings list
Expand Down Expand Up @@ -324,6 +324,9 @@ func (rv *PostingsList) init1Hit(fstVal uint64) error {

// PostingsIterator provides a way to iterate through the postings list
type PostingsIterator struct {
// atomic access to this variable
bytesRead uint64

postings *PostingsList
all roaring.IntPeekable
Actual roaring.IntPeekable
Expand All @@ -344,9 +347,6 @@ type PostingsIterator struct {

includeFreqNorm bool
includeLocs bool

// atomic access to this variable
bytesRead uint64
}

var emptyPostingsIterator = &PostingsIterator{}
Expand Down
8 changes: 4 additions & 4 deletions segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (*ZapPlugin) Open(path string) (segment.Segment, error) {
// SegmentBase is a memory only, read-only implementation of the
// segment.Segment interface, using zap's data representation.
type SegmentBase struct {
// atomic access to this variable
bytesRead uint64
bytesWritten uint64

mem []byte
memCRC uint32
chunkMode uint32
Expand All @@ -103,10 +107,6 @@ type SegmentBase struct {
fieldDvNames []string // field names cached in fieldDvReaders
size uint64

// atomic access to this variable
bytesRead uint64
bytesWritten uint64

m sync.Mutex
fieldFSTs map[uint16]*vellum.FST
}
Expand Down

0 comments on commit 52d6c0b

Please sign in to comment.