use of org.apache.accumulo.core.file.rfile.bcfile.MetaBlockDoesNotExist in project accumulo by apache.
the class SummaryReader method load.
private static List<SummarySerializer> load(BlockReader bcReader, Predicate<SummarizerConfiguration> summarySelector) throws IOException {
try (DataInputStream in = bcReader.getMetaBlock(SummaryWriter.METASTORE_INDEX)) {
List<SummarySerializer> stores = new ArrayList<>();
readHeader(in);
int numSummaries = WritableUtils.readVInt(in);
for (int i = 0; i < numSummaries; i++) {
SummarizerConfiguration conf = readConfig(in);
boolean inline = in.readBoolean();
if (inline) {
if (summarySelector.test(conf)) {
stores.add(SummarySerializer.load(conf, in));
} else {
SummarySerializer.skip(in);
}
} else {
int block = WritableUtils.readVInt(in);
int offset = WritableUtils.readVInt(in);
if (summarySelector.test(conf)) {
try (DataInputStream summaryIn = bcReader.getMetaBlock(SummaryWriter.METASTORE_PREFIX + "." + block)) {
long skipped = in.skip(offset);
while (skipped < offset) {
skipped += in.skip(offset - skipped);
}
stores.add(SummarySerializer.load(conf, summaryIn));
} catch (MetaBlockDoesNotExist e) {
// this is unexpected
throw new IOException(e);
}
}
}
}
return stores;
} catch (MetaBlockDoesNotExist e) {
return Collections.emptyList();
}
}
Aggregations