/** * @return the current state of the given segment, or null if the * segment does not exist. */ @VisibleForTesting SegmentStateProto getSegmentInfo(long segmentTxId) throws IOException { EditLogFile elf = fjm.getLogFile(segmentTxId); if (elf == null) { return null; } if (elf.isInProgress()) { elf.scanLog(Long.MAX_VALUE, false); } if (elf.getLastTxId() == HdfsServerConstants.INVALID_TXID) { LOG.info("Edit log file " + elf + " appears to be empty. " + "Moving it aside..." + " ; journal id: " + journalId); elf.moveAsideEmptyFile(); return null; } SegmentStateProto ret = SegmentStateProto.newBuilder() .setStartTxId(segmentTxId) .setEndTxId(elf.getLastTxId()) .setIsInProgress(elf.isInProgress()) .build(); LOG.info("getSegmentInfo(" + segmentTxId + "): " + elf + " -> " + TextFormat.shortDebugString(ret) + " ; journal id: " + journalId); return ret; }
/** * @return the current state of the given segment, or null if the * segment does not exist. */ @VisibleForTesting SegmentStateProto getSegmentInfo(long segmentTxId) throws IOException { EditLogFile elf = fjm.getLogFile(segmentTxId); if (elf == null) { return null; } if (elf.isInProgress()) { elf.scanLog(); } if (elf.getLastTxId() == HdfsConstants.INVALID_TXID) { LOG.info("Edit log file " + elf + " appears to be empty. " + "Moving it aside..."); elf.moveAsideEmptyFile(); return null; } SegmentStateProto ret = SegmentStateProto.newBuilder() .setStartTxId(segmentTxId) .setEndTxId(elf.getLastTxId()) .setIsInProgress(elf.isInProgress()) .build(); LOG.info("getSegmentInfo(" + segmentTxId + "): " + elf + " -> " + TextFormat.shortDebugString(ret)); return ret; }
.setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(3L) .setIsInProgress(true)) .setLastWriterEpoch(0L) .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(4L) .setIsInProgress(true)) .setLastWriterEpoch(0L) .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(4L) .setIsInProgress(true)) .setLastWriterEpoch(0L) .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(3L) .setIsInProgress(false)) .setLastWriterEpoch(0L)
/** * @return the current state of the given segment, or null if the * segment does not exist. */ @VisibleForTesting SegmentStateProto getSegmentInfo(long segmentTxId) throws IOException { EditLogFile elf = fjm.getLogFile(segmentTxId); if (elf == null) { return null; } if (elf.isInProgress()) { elf.scanLog(); } if (elf.getLastTxId() == HdfsConstants.INVALID_TXID) { LOG.info("Edit log file " + elf + " appears to be empty. " + "Moving it aside..."); elf.moveAsideEmptyFile(); return null; } SegmentStateProto ret = SegmentStateProto.newBuilder() .setStartTxId(segmentTxId) .setEndTxId(elf.getLastTxId()) .setIsInProgress(elf.isInProgress()) .build(); LOG.info("getSegmentInfo(" + segmentTxId + "): " + elf + " -> " + TextFormat.shortDebugString(ret)); return ret; }
public Builder mergeFrom(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto other) { if (other == org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto.getDefaultInstance()) return this; if (other.hasStartTxId()) { setStartTxId(other.getStartTxId()); } if (other.hasEndTxId()) { setEndTxId(other.getEndTxId()); } if (other.hasIsInProgress()) { setIsInProgress(other.getIsInProgress()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto other) { if (other == org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto.getDefaultInstance()) return this; if (other.hasStartTxId()) { setStartTxId(other.getStartTxId()); } if (other.hasEndTxId()) { setEndTxId(other.getEndTxId()); } if (other.hasIsInProgress()) { setIsInProgress(other.getIsInProgress()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto other) { if (other == org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.SegmentStateProto.getDefaultInstance()) return this; if (other.hasStartTxId()) { setStartTxId(other.getStartTxId()); } if (other.hasEndTxId()) { setEndTxId(other.getEndTxId()); } if (other.hasIsInProgress()) { setIsInProgress(other.getIsInProgress()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }