public boolean isUseLogAddressing() { return getOwner().isUseLogAddressing(); }
public void storeL2PIndexEntry(long offset, long itemIndex) throws SVNException { final FSFS fsfs = getOwner(); final String txnID = getTxnID(); if (fsfs.isUseLogAddressing()) { final FSL2PProtoIndex protoIndex = FSL2PProtoIndex.open(fsfs, txnID, true); assert protoIndex != null; try { protoIndex.addEntry(offset, itemIndex); } finally { if (protoIndex != null) { protoIndex.close(); } } } }
private FSFile openAndSeekTransaction(FSRepresentation rep) throws SVNException { FSFile file = getTransactionRevisionPrototypeFile(rep.getTxnId()); long itemIndex = rep.getItemIndex(); long offset; if (isUseLogAddressing()) { offset = lookupOffsetInProtoIndex(file, rep.getTxnId(), itemIndex); } else { offset = itemIndex; } file.seek(offset); return file; }
private void packRevShard(FSFS fsfs, long shard, File shardPath) throws SVNException { File packDir = fsfs.getPackDir(shard); File packFile = fsfs.getPackFile(shard); File manifestFile = fsfs.getManifestFile(shard); firePackEvent(shard, true); SVNFileUtil.deleteAll(packDir, false, myCanceller); if (fsfs.isUseLogAddressing()) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.FS_UNSUPPORTED_FORMAT, "Logical addressing is unsupported for FS format ''{0}''", new Object[]{new Integer(fsfs.getDBFormat())}); SVNErrorManager.error(errorMessage, SVNLogType.FSFS); } else { packPhysicallyAddressed(fsfs, shard, shardPath, packFile, manifestFile); } }
public void storeP2LIndexEntry(FSP2LEntry entry) throws SVNException { final FSFS fsfs = getOwner(); final String txnID = getTxnID(); if (getOwner().isUseLogAddressing()) { final FSP2LProtoIndex protoIndex = FSP2LProtoIndex.open(fsfs, txnID, true); assert protoIndex != null; try { protoIndex.writeEntry(entry); } finally { if (protoIndex != null) { protoIndex.close(); } } } }
private FSFile openAndSeekRevision(long revision, long itemIndex) throws SVNException { ensureRevisionsExists(revision); FSFile file = getPackOrRevisionFSFile(revision); long offset; if (isUseLogAddressing()) { offset = lookupOffsetInIndex(file, revision, itemIndex); } else { if (isPackedRevision(revision)) { long revOffset = getPackedOffset(revision); itemIndex += revOffset; } offset = itemIndex; } file.seek(offset); return file; }
final FSFS fsfs = getOwner(); myTxnRevFile = fsfs.getTransactionProtoRevFile(myTxnID); if (fsfs.isUseLogAddressing()) { final FSP2LProtoIndex index = FSP2LProtoIndex.open(fsfs, myTxnID, false); assert index != null;
public long allocateItemIndex(long offset) throws SVNException { final FSFS fsfs = getOwner(); final String txnID = getTxnID(); if (fsfs.isUseLogAddressing()) { final FSTransactionItemIndex itemIndexFile = FSTransactionItemIndex.open(fsfs, txnID); assert itemIndexFile != null; try { final long itemIndex = itemIndexFile.allocateItemIndex(offset); storeL2PIndexEntry(offset, itemIndex); return itemIndex; } finally { if (itemIndexFile != null) { itemIndexFile.close(); } } } else { return offset; } }
public long writeFinalChangedPathInfo(final CountingOutputStream protoFile) throws SVNException, IOException { long offset = protoFile.getPosition(); Map changedPaths = getChangedPaths(); boolean includeNodeKind = getOwner().getDBFormat() >= FSFS.MIN_KIND_IN_CHANGED_FORMAT; if (getOwner().isUseLogAddressing()) { protoFile.resetChecksum(); } writeChanges(protoFile, changedPaths, includeNodeKind, true); if (getOwner().isUseLogAddressing()) { long size = protoFile.getPosition() - offset; FSP2LProtoIndex.ItemType itemType = FSP2LProtoIndex.ItemType.CHANGES; long revision = SVNRepository.INVALID_REVISION; long number = FSID.ITEM_INDEX_CHANGES; int checksum = protoFile.finalizeChecksum(); FSP2LEntry entry = new FSP2LEntry(offset, size, itemType, checksum, revision, number); storeP2LIndexEntry(entry); storeL2PIndexEntry(entry.getOffset(), FSID.ITEM_INDEX_CHANGES); } return offset; }
if (myOwner.isUseLogAddressing()) { throw new UnsupportedOperationException("TODO");
if (getOwner().isUseLogAddressing()) { final long itemIndex = allocateItemIndex(offset); final long size = protoFile.getPosition() - offset;
private void checkRepresentation(FSFS fsfs, FSRepresentation representation, Object hint) throws SVNException { if (fsfs.isUseLogAddressing()) { final long startRevision = fsfs.getPackedBaseRevision(representation.getRevision()); if (hint != null) { //TODO: this can speedup algorithm somehow } FSFile revFile = null; if (revFile == null || true) { revFile = fsfs.getPackOrRevisionFSFile(representation.getRevision()); } hint = revFile;//TODO: this can speedup algorithm somehow final long offset = fsfs.lookupOffsetInIndex(revFile, representation.getRevision(), representation.getItemIndex()); final FSP2LEntry entry = lookupP2LEntry(revFile, representation.getRevision(), offset); if (entry == null || entry.getType().getCode() < FSP2LProtoIndex.ItemType.FILE_REP.getCode() || entry.getType().getCode() > FSP2LProtoIndex.ItemType.DIR_PROPS.getCode()) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "No representation found at offset {0} for item %s in revision {1}", new Object[]{new Long(offset), new Long(representation.getItemIndex())}); SVNErrorManager.error(errorMessage, SVNLogType.FSFS); } } else { //TODO createRepresentationState(); this assigns the "hint" } }
long changedPathOffset = txnRoot.writeFinalChangedPathInfo(revWriter); if (myFSFS.isUseLogAddressing()) { txnRoot.writeIndexData(revWriter, newRevision, myTxn.getTxnId()); } else {
truncateToSize = true; } else { if (fsfs.isUseLogAddressing()) { rep.setItemIndex(myTxnRoot.allocateItemIndex(myRepOffset)); fsfs.putTxnRevisionNode(myRevNode.getId(), myRevNode); if (oldRep == null && fsfs.isUseLogAddressing()) { final int checksum = myTargetFileOS.finalizeChecksum();
if (getOwner().isUseLogAddressing() && atRoot) { itemIndex = FSID.ITEM_INDEX_ROOT_NODE; storeL2PIndexEntry(myOffset, itemIndex); getOwner().putTxnRevisionNode(id, revNode); if (getOwner().isUseLogAddressing()) { final int checksum = checksumOutputStream.finalizeChecksum(); final FSP2LEntry entry = new FSP2LEntry(myOffset, protoFile.getPosition() - myOffset, FSP2LProtoIndex.ItemType.NODEREV, checksum, SVNRepository.INVALID_REVISION, itemIndex);