@Override public void process(LogRecordWithDLSN record) { if (null == this.firstRecord && (includeControl || !record.isControl())) { this.firstRecord = record; } }
@Override public String toString() { return "LogRecordWithDLSN{" + "dlsn=" + dlsn + ", txid=" + getTransactionId() + ", position=" + getPositionWithinLogSegment() + ", isControl=" + isControl() + ", isEndOfStream=" + isEndOfStream() + '}'; } }
public LogRecordWithDLSN getLastLogRecord(boolean recover, boolean includeEndOfStream) throws IOException { checkLogStreamExists(); List<LogSegmentMetadata> ledgerList = getFullLedgerListDesc(true, true); for (LogSegmentMetadata metadata: ledgerList) { LogRecordWithDLSN record = recoverLastRecordInLedger(metadata, recover, false, includeEndOfStream); if (null != record) { assert(!record.isControl()); LOG.debug("{} getLastLogRecord Returned {}", getFullyQualifiedName(), record); return record; } } throw new LogEmptyException("Log " + getFullyQualifiedName() + " has no records"); }
} while (null != record && (record.isControl() || (record.getDlsn().compareTo(getStartDLSN()) < 0))); if (null == record) { break;
@Override public void onSuccess(LogRecordWithDLSN value) { try { assertTrue(value.getDlsn().compareTo(nextDLSN) >= 0); LOG.info("Received record {} from log {} for reader {}", new Object[] { value.getDlsn(), dlm.getStreamName(), readerName }); assertFalse(value.isControl()); assertEquals(0, value.getDlsn().getSlotId()); DLMTestUtil.verifyLargeLogRecord(value); } catch (Exception exc) { LOG.error("Exception encountered when verifying received log record {} for reader {} :", new Object[] { value.getDlsn(), exc, readerName }); errorsFound.set(true); completionLatch.countDown(); return; } readCount.incrementAndGet(); countLatch.countDown(); if (countLatch.getCount() <= 0) { LOG.info("Reader {} is completed", readerName); closeReader(); completionLatch.countDown(); } else { LOG.info("Reader {} : read count becomes {}, latch = {}", new Object[] { readerName, readCount.get(), countLatch.getCount() }); nextDLSN = value.getDlsn().getNextDLSN(); readNext(); } }
nextRecordInStream.readPayload(in); if (LOG.isTraceEnabled()) { if (nextRecordInStream.isControl()) { LOG.trace("Reading {} Control DLSN {}", recordStream.getName(), nextRecordInStream.getDlsn()); } else {
if (record.isControl()) { continue;
nextRecord = reader.nextRecord(); context.numRecordsScanned.incrementAndGet(); if (!context.includeControl && record.isControl()) { continue;
assertTrue(!value.isControl()); assertTrue(value.getDlsn().getSlotId() == 0); assertTrue(value.getDlsn().compareTo(startPosition) >= 0);
@Override public String toString() { return "LogRecordWithDLSN{" + "dlsn=" + dlsn + ", txid=" + getTransactionId() + ", position=" + getPositionWithinLogSegment() + ", isControl=" + isControl() + ", isEndOfStream=" + isEndOfStream() + '}'; } }
nextRecordInStream.readPayload(in); if (LOG.isTraceEnabled()) { if (nextRecordInStream.isControl()) { LOG.trace("Reading {} Control DLSN {}", recordStream.getName(), nextRecordInStream.getDlsn()); } else {