index.remove(key);
return null;
}
long memr = len + index.row().primaryKeyLength + 64;
if (MemoryControl.available() < memr) {
if (!MemoryControl.request(memr, true)) throw new RowSpaceExceededException(memr, "HeapReader.get()/check"); // not enough memory available for this blob
}
// read the key
byte[] keyf;
try {
keyf = new byte[index.row().primaryKeyLength];
} catch (OutOfMemoryError e) {
throw new RowSpaceExceededException(index.row().primaryKeyLength, "HeapReader.get()/keyf");
}
file.readFully(keyf, 0, keyf.length);
if (!this.ordering.equal(key, keyf)) {
// verification of the indexed access failed. we must re-read the index
Log.logSevere("HeapReader", "indexed verification access failed for " + heapFile.toString());
// this is a severe operation, it should never happen.
// remove entry from index because keeping that element in the index would not make sense
index.remove(key);
// nothing to return
return null;
// but if the process ends in this state, it would completely fail
// if the index is not rebuild now at once
//initIndexReadFromHeap();
}
// read the blob
byte[] blob;
try {
blob = new byte[len];
} catch (OutOfMemoryError e) {
throw new RowSpaceExceededException(len, "HeapReader.get()/blob");
}
file.readFully(blob, 0, blob.length);
return blob;
}