private void buildNodeTableBPTreeIndex() { try { // Node table B+Tree index (i.e. node2id.dat/idn) log.info( "Node Table (3/3): building node table B+Tree index (i.e. node2id.dat and node2id.idn files)..."); final ProgressLogger monitor03 = new ProgressLogger( log, "records for node table (3/3) phase", BulkLoader.DataTickPoint, BulkLoader.superTick); monitor03.start(); String path = dsg.getLocation().getDirectoryPath(); new File(path, "node2id.dat").delete(); new File(path, "node2id.idn").delete(); final RecordFactory recordFactory = new RecordFactory(LenNodeHash, SizeOfNodeId); Transform<Pair<byte[], byte[]>, Record> transformPair2Record = new Transform<Pair<byte[], byte[]>, Record>() { @Override public Record convert(Pair<byte[], byte[]> pair) { monitor03.tick(); return recordFactory.create(pair.getLeft(), pair.getRight()); } }; int order = BPlusTreeParams.calcOrder(SystemTDB.BlockSize, recordFactory); BPlusTreeParams bptParams = new BPlusTreeParams(order, recordFactory); int readCacheSize = 10; int writeCacheSize = 100; FileSet destination = new FileSet(dsg.getLocation(), Names.indexNode2Id); BlockMgr blkMgrNodes = BlockMgrFactory.create( destination, Names.bptExtTree, SystemTDB.BlockSize, readCacheSize, writeCacheSize); BlockMgr blkMgrRecords = BlockMgrFactory.create( destination, Names.bptExtRecords, SystemTDB.BlockSize, readCacheSize, writeCacheSize); Iterator<Record> iter2 = Iter.iter(sdb03.iterator()).map(transformPair2Record); BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree( iter2, bptParams, recordFactory, blkMgrNodes, blkMgrRecords); bpt2.sync(); ProgressLogger.print(log, monitor03); } finally { sdb03.close(); sdb03 = null; } }
public NodeTableBuilder2( DatasetGraphTDB dsg, ProgressLogger monitor, DataBag<Tuple<Long>> outputTriples, DataBag<Tuple<Long>> outputQuads) { // dsg.getTripleTable().getNodeTupleTable().close() ; this.dsg = dsg; this.monitor = monitor; this.log = monitor.getLogger(); String filename = new FileSet(dsg.getLocation(), Names.indexId2Node).filename(Names.extNodeData); this.objects = FileFactory.createObjectFileDisk(filename); this.outputTriples = outputTriples; this.outputQuads = outputQuads; this.stats = new StatsCollectorNodeId(); this.sdb01 = new MultiThreadedSortedDataBag<Pair<byte[], byte[]>>( getThresholdPolicy(), serializationFactory, new PairComparator()); try { this.digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new AtlasException(e); } }