Reland advance to fix (#3555)

This commit is contained in:
Rafael Weinstein
2017-06-20 12:45:51 -07:00
committed by GitHub
parent 0c3af1c1c5
commit 763a87aa60
6 changed files with 23 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ import (
"os"
)
const NomsVersion = "7.11"
const NomsVersion = "7.12"
const NOMS_VERSION_NEXT_ENV_NAME = "NOMS_VERSION_NEXT"
const NOMS_VERSION_NEXT_ENV_VALUE = "1"

View File

@@ -308,8 +308,12 @@ func makeMapLeafChunkFn(vr ValueReader) makeChunkFn {
d.PanicIfFalse(level == 0)
mapData := make([]mapEntry, len(items), len(items))
var lastKey Value
for i, v := range items {
mapData[i] = v.(mapEntry)
entry := v.(mapEntry)
d.PanicIfFalse(lastKey == nil || lastKey.Less(entry.key))
lastKey = entry.key
mapData[i] = entry
}
m := newMap(newMapLeafSequence(vr, mapData...))

View File

@@ -95,8 +95,11 @@ func newOrderedMetaSequenceChunkFn(kind NomsKind, vr ValueReader) makeChunkFn {
tuples := make([]metaTuple, len(items))
numLeaves := uint64(0)
var lastKey orderedKey
for i, v := range items {
mt := v.(metaTuple)
d.PanicIfFalse(lastKey == emptyKey || lastKey.Less(mt.key))
lastKey = mt.key
tuples[i] = mt // chunk is written when the root sequence is written
numLeaves += mt.numLeaves
}

View File

@@ -107,6 +107,13 @@ func (sc *sequenceChunker) advanceTo(next *sequenceCursor) {
for sc.cur.compare(next) < 0 {
if sc.Append(sc.cur.current()) && sc.cur.atLastItem() {
if sc.cur.parent != nil {
if sc.cur.parent.compare(next.parent) < 0 {
// Case (4): We stopped consuming items on this level before entering
// the sequence referenced by |next|
reachedNext = false
}
// Note: Logically, what is happening here is that we are consuming the
// item at the current level. Logically, we'd call sc.cur.advance(),
// but that would force loading of the next sequence, which we don't
@@ -119,7 +126,6 @@ func (sc *sequenceChunker) advanceTo(next *sequenceCursor) {
sc.cur.seq = nil
}
reachedNext = false // Case (4)
break
}

View File

@@ -275,8 +275,12 @@ func makeSetLeafChunkFn(vr ValueReader) makeChunkFn {
d.PanicIfFalse(level == 0)
setData := make([]Value, len(items), len(items))
for i, v := range items {
setData[i] = v.(Value)
var lastValue Value
for i, item := range items {
v := item.(Value)
d.PanicIfFalse(lastValue == nil || lastValue.Less(v))
lastValue = v
setData[i] = v
}
set := newSet(newSetLeafSequence(vr, setData...))

View File

@@ -1 +1 @@
4:7.11:8s92pdafhd4hkhav6r4748u1rjlosh1k:5b1e9knhol2orv0a8ej6tvelc46jp92l:bsvid54jt8pjto211lcdl14tbfd39jmn:2:998se5i5mf15fld7f318818i6ie0c8rr:2
4:7.12:8s92pdafhd4hkhav6r4748u1rjlosh1k:5b1e9knhol2orv0a8ej6tvelc46jp92l:bsvid54jt8pjto211lcdl14tbfd39jmn:2:998se5i5mf15fld7f318818i6ie0c8rr:2