Search in sources :

Example 11 with RecordFactory

use of org.apache.jena.tdb.base.record.RecordFactory in project jena by apache.

the class AbstractTestNodeTableTrans method create.

private NodeTableTrans create(Transaction txn, NodeTable base) {
    RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId);
    Index idx = new IndexMap(recordFactory);
    ObjectFile objectFile = createObjectFile();
    NodeTableTrans ntt = new NodeTableTrans(txn, "test", base, idx, objectFile);
    return ntt;
}
Also used : NodeTableTrans(org.apache.jena.tdb.transaction.NodeTableTrans) RecordFactory(org.apache.jena.tdb.base.record.RecordFactory) IndexMap(org.apache.jena.tdb.index.IndexMap) ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) Index(org.apache.jena.tdb.index.Index)

Example 12 with RecordFactory

use of org.apache.jena.tdb.base.record.RecordFactory in project jena by apache.

the class JournalControl method recoverNodeDat.

/** Recover a node data file (".dat").
     *  Node data files are append-only so recovering, then not using the data is safe.
     *  Node data file is a precursor for full recovery that works from the master journal.
     */
private static void recoverNodeDat(DatasetGraphTDB dsg, FileRef fileRef) {
    // See DatasetBuilderTxn - same name generation code.
    RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId);
    NodeTable baseNodeTable = dsg.getConfig().nodeTables.get(fileRef);
    String objFilename = fileRef.getFilename() + "-" + Names.extJournal;
    objFilename = dsg.getLocation().absolute(objFilename);
    File jrnlFile = new File(objFilename);
    if (jrnlFile.exists() && jrnlFile.length() > 0) {
        syslog.info("Recovering node data: " + fileRef.getFilename());
        ObjectFile dataJrnl = FileFactory.createObjectFileDisk(objFilename);
        NodeTableTrans ntt = new NodeTableTrans(null, objFilename, baseNodeTable, new IndexMap(recordFactory), dataJrnl);
        ntt.append();
        ntt.close();
        dataJrnl.close();
        baseNodeTable.sync();
    }
    if (jrnlFile.exists())
        FileOps.delete(objFilename);
}
Also used : RecordFactory(org.apache.jena.tdb.base.record.RecordFactory) IndexMap(org.apache.jena.tdb.index.IndexMap) ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) BufferChannelFile(org.apache.jena.tdb.base.file.BufferChannelFile) File(java.io.File) ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Aggregations

RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)12 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)3 FileSet (org.apache.jena.tdb.base.file.FileSet)3 Record (org.apache.jena.tdb.base.record.Record)3 RangeIndex (org.apache.jena.tdb.index.RangeIndex)3 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)3 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)3 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)3 Location (org.apache.jena.tdb.base.file.Location)2 ObjectFile (org.apache.jena.tdb.base.objectfile.ObjectFile)2 RecordBufferPageMgr (org.apache.jena.tdb.base.recordbuffer.RecordBufferPageMgr)2 IndexMap (org.apache.jena.tdb.index.IndexMap)2 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)2 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 AtlasException (org.apache.jena.atlas.AtlasException)1 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)1 TDBException (org.apache.jena.tdb.TDBException)1 BufferChannelFile (org.apache.jena.tdb.base.file.BufferChannelFile)1