private IndexStatistics loadIndexStatisticsInternal(Session session, Index index) throws PersistitException {
RowDef indexRowDef = index.leafMostTable().rowDef();
RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);
Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
exchange.clear()
.append(indexStatisticsRowDef.table().getOrdinal())
.append((long)indexRowDef.getRowDefId())
.append((long)index.getIndexId());
if (!exchange.fetch().getValue().isDefined()) {
return null;
}
IndexStatistics result = decodeHeader(session, exchange, indexStatisticsRowDef, index);
while (exchange.traverse(Key.GT, true)) {
if (exchange.getKey().getDepth() <= indexStatisticsRowDef.getHKeyDepth()) {
break; // End of children.
}
decodeEntry(session, exchange, indexStatisticsEntryRowDef, result);
}
if (logger.isDebugEnabled()) {