}
public void rebuildPrimarySegment(int flushCount) {
long readTxnId = subService.getHighestCompletedTxnId();
startRebuild();
AutocommitBuffer buffer = new AutocommitBuffer(nextGeneration, flushCount);
for(String bag : subService.getBags(readTxnId)) {
log(Level.FINER, "Starting rebuild for bag \""+bag+"\"");
Iterator i = subService.query(bag, readTxnId, Util.literalMap(), Util.literalSMap());
while(i.hasNext()) {
DbResultMapView view = (DbResultMapView)i.next();
Map retCopy = (Map)DbServiceUtil.deepCopyResult(view);
// System.out.println("REBUILD :"+txnSpace+" : "+retCopy.toString());
buffer.putEntryIntoBag(retCopy, bag);
}
}
buffer.flush();
}