Upgrade versions of vendored libs
This commit is contained in:
44
vendor/github.com/cockroachdb/pebble/compaction_iter.go
generated
vendored
44
vendor/github.com/cockroachdb/pebble/compaction_iter.go
generated
vendored
@@ -5,6 +5,7 @@
|
||||
package pebble
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/cockroachdb/pebble/internal/base"
|
||||
"github.com/cockroachdb/pebble/internal/bytealloc"
|
||||
"github.com/cockroachdb/pebble/internal/invariants"
|
||||
"github.com/cockroachdb/pebble/internal/keyspan"
|
||||
"github.com/cockroachdb/pebble/internal/rangekey"
|
||||
)
|
||||
@@ -156,7 +158,11 @@ type compactionIter struct {
|
||||
// Additionally, it is the internal state when the code is moving to the
|
||||
// next key so it can determine whether the user key has changed from
|
||||
// the previous key.
|
||||
key InternalKey
|
||||
key InternalKey
|
||||
// keyTrailer is updated when `i.key` is updated and holds the key's
|
||||
// original trailer (eg, before any sequence-number zeroing or changes to
|
||||
// key kind).
|
||||
keyTrailer uint64
|
||||
value []byte
|
||||
valueCloser io.Closer
|
||||
// Temporary buffer used for storing the previous user key in order to
|
||||
@@ -252,7 +258,12 @@ func (i *compactionIter) First() (*InternalKey, []byte) {
|
||||
if i.err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
i.iterKey, i.iterValue = i.iter.First()
|
||||
var iterValue LazyValue
|
||||
i.iterKey, iterValue = i.iter.First()
|
||||
i.iterValue, _, i.err = iterValue.Value(nil)
|
||||
if i.err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
if i.iterKey != nil {
|
||||
i.curSnapshotIdx, i.curSnapshotSeqNum = snapshotIndex(i.iterKey.SeqNum(), i.snapshots)
|
||||
}
|
||||
@@ -464,7 +475,12 @@ func (i *compactionIter) skipInStripe() {
|
||||
}
|
||||
|
||||
func (i *compactionIter) iterNext() bool {
|
||||
i.iterKey, i.iterValue = i.iter.Next()
|
||||
var iterValue LazyValue
|
||||
i.iterKey, iterValue = i.iter.Next()
|
||||
i.iterValue, _, i.err = iterValue.Value(nil)
|
||||
if i.err != nil {
|
||||
i.iterKey = nil
|
||||
}
|
||||
return i.iterKey != nil
|
||||
}
|
||||
|
||||
@@ -491,7 +507,26 @@ func (i *compactionIter) nextInStripe() stripeChangeType {
|
||||
return newStripe
|
||||
}
|
||||
key := i.iterKey
|
||||
if !i.equal(i.key.UserKey, key.UserKey) {
|
||||
|
||||
// NB: The below conditional is an optimization to avoid a user key
|
||||
// comparison in many cases. Internal keys with the same user key are
|
||||
// ordered in (strictly) descending order by trailer. If the new key has a
|
||||
// greater or equal trailer, or the previous key had a zero sequence number,
|
||||
// the new key must have a new user key.
|
||||
//
|
||||
// A couple things make these cases common:
|
||||
// - Sequence-number zeroing ensures ~all of the keys in L6 have a zero
|
||||
// sequence number.
|
||||
// - Ingested sstables' keys all adopt the same sequence number.
|
||||
if i.keyTrailer <= base.InternalKeyZeroSeqnumMaxTrailer || key.Trailer >= i.keyTrailer {
|
||||
if invariants.Enabled && i.equal(i.key.UserKey, key.UserKey) {
|
||||
prevKey := i.key
|
||||
prevKey.Trailer = i.keyTrailer
|
||||
panic(fmt.Sprintf("pebble: invariant violation: %s and %s out of order", key, prevKey))
|
||||
}
|
||||
i.curSnapshotIdx, i.curSnapshotSeqNum = snapshotIndex(key.SeqNum(), i.snapshots)
|
||||
return newStripe
|
||||
} else if !i.equal(i.key.UserKey, key.UserKey) {
|
||||
i.curSnapshotIdx, i.curSnapshotSeqNum = snapshotIndex(key.SeqNum(), i.snapshots)
|
||||
return newStripe
|
||||
}
|
||||
@@ -734,6 +769,7 @@ func (i *compactionIter) saveKey() {
|
||||
i.keyBuf = append(i.keyBuf[:0], i.iterKey.UserKey...)
|
||||
i.key.UserKey = i.keyBuf
|
||||
i.key.Trailer = i.iterKey.Trailer
|
||||
i.keyTrailer = i.iterKey.Trailer
|
||||
}
|
||||
|
||||
func (i *compactionIter) cloneKey(key []byte) []byte {
|
||||
|
||||
Reference in New Issue
Block a user