make sure spans are fully loaded before trying to flush them

pull/62/head
Zlatin Balevsky 2021-06-12 07:50:16 +01:00
parent d5a17e9b6a
commit 7b670b9037
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 3 additions and 0 deletions

View File

@ -253,6 +253,7 @@ public abstract class SkipSpan<K extends Comparable<? super K>, V> implements Fl
sl.delItem();
if(nKeys == 1) {
if((this.prev == null) && (this.next != null)) {
this.next.loadVals();
res[1] = this.next;
// We're the first node in the list... copy the next node over and kill it. See also bottom of SkipLevels.java
for(int i=0;i<next.nKeys;i++) {
@ -276,10 +277,12 @@ public abstract class SkipSpan<K extends Comparable<? super K>, V> implements Fl
//BlockFile.log.error("Killing this span " + this + ", prev " + this.prev + ", next " + this.next);
if(this.prev != null) {
this.prev.next = this.next;
this.prev.loadVals();
this.prev.flush();
}
if(this.next != null) {
this.next.prev = this.prev;
this.next.loadVals();
this.next.flush();
this.next = null;
}