Skip to content

Commit

Permalink
[CLIENT-3295] Duplicate parsing of fields in RecordParser.ParseRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed Jan 15, 2025
1 parent 6f45202 commit 80b9976
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions record_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,14 @@ func (rp *recordParser) parseTranDeadline(txn *Txn) {
}
}
func (rp *recordParser) parseRecord(key *Key, isOperation bool) (*Record, Error) {
var bins BinMap
receiveOffset := rp.cmd.dataOffset

// There can be fields in the response (setname etc).
// But for now, ignore them. Expose them to the API if needed in the future.
if rp.fieldCount > 0 {
// Just skip over all the fields
for i := 0; i < rp.fieldCount; i++ {
fieldSize := int(Buffer.BytesToUint32(rp.cmd.dataBuffer, receiveOffset))
receiveOffset += (4 + fieldSize)
}
if rp.opCount == 0 {
// Bin data was not returned.
return newRecord(rp.cmd.node, key, nil, rp.generation, rp.expiration), nil
}

if rp.opCount > 0 {
bins = make(BinMap, rp.opCount)
}
receiveOffset := rp.cmd.dataOffset

bins := make(BinMap, rp.opCount)
for i := 0; i < rp.opCount; i++ {
opSize := int(Buffer.BytesToUint32(rp.cmd.dataBuffer, receiveOffset))
particleType := int(rp.cmd.dataBuffer[receiveOffset+5])
Expand Down

0 comments on commit 80b9976

Please sign in to comment.