MockMetadata(LedgerMetadata toCopy) { ensembleSize = toCopy.getEnsembleSize(); writeQuorumSize = toCopy.getWriteQuorumSize(); ackQuorumSize = toCopy.getAckQuorumSize(); lastEntryId = toCopy.getLastEntryId(); length = toCopy.getLength(); digestType = toCopy.getDigestType(); ctime = toCopy.getCtime(); isClosed = toCopy.isClosed(); customMetadata = ImmutableMap.copyOf(toCopy.getCustomMetadata()); }
writer.append(String.valueOf(V1_IN_RECOVERY_ENTRY_ID)).append(FIELD_SPLITTER).append(V1_CLOSED_TAG); } else if (metadata.getState() == State.CLOSED) { writer.append(String.valueOf(metadata.getLastEntryId())) .append(FIELD_SPLITTER).append(V1_CLOSED_TAG); } else {
boolean setLedgerMetadata(Versioned<LedgerMetadata> expected, Versioned<LedgerMetadata> newMetadata) { synchronized (this) { // ensure that we only update the metadata if it is the object we expect it to be if (versionedMetadata == expected) { versionedMetadata = newMetadata; LedgerMetadata metadata = versionedMetadata.getValue(); if (metadata.isClosed()) { lastAddConfirmed = lastAddPushed = metadata.getLastEntryId(); length = metadata.getLength(); } return true; } else { return false; } } }
if (lastSegment && isLedgerClosed && (ledgerMetadata.getLastEntryId() < segments.get(segmentNo).getKey())) { return false; int thisBookieIndexInCurrentEnsemble = currentSegmentEnsemble.indexOf(bookieAddress); long firstEntryId = segments.get(segmentNo).getKey(); long lastEntryId = lastSegment ? ledgerMetadata.getLastEntryId() : segments.get(segmentNo + 1).getKey() - 1; long firstStoredEntryId = LedgerHandle.INVALID_ENTRY_ID; long firstEntryIter = firstEntryId;
public static LedgerMetadataBuilder from(LedgerMetadata other) { LedgerMetadataBuilder builder = new LedgerMetadataBuilder(); builder.metadataFormatVersion = other.getMetadataFormatVersion(); builder.ensembleSize = other.getEnsembleSize(); builder.writeQuorumSize = other.getWriteQuorumSize(); builder.ackQuorumSize = other.getAckQuorumSize(); builder.state = other.getState(); if (builder.state == State.CLOSED) { builder.lastEntryId = Optional.of(other.getLastEntryId()); builder.length = Optional.of(other.getLength()); } builder.ensembles.putAll(other.getAllEnsembles()); if (other.hasPassword()) { builder.password = Optional.of(other.getPassword()); builder.digestType = Optional.of(other.getDigestType()); } builder.ctime = other.getCtime(); /** Hack to get around fact that ctime was never versioned correctly */ builder.storeCtime = LedgerMetadataUtils.shouldStoreCtime(other); builder.customMetadata = ImmutableMap.copyOf(other.getCustomMetadata()); return builder; }
.setEnsembleSize(metadata.getEnsembleSize()) .setLength(metadata.getLength()) .setLastEntryId(metadata.getLastEntryId());
LedgerMetadata metadata = getLedgerMetadata(); isClosed = metadata.isClosed(); lastEntryId = metadata.getLastEntryId();
if (lastEntry == metadata.getLastEntryId() && finalLength == metadata.getLength()) { return false; + " (metadata lastEntry:{} length:{})", getId(), lastEntry, finalLength, metadata.getLastEntryId(), metadata.getLength()); throw new BKException.BKMetadataVersionException();
.setEnsembleSize(metadata.getEnsembleSize()) .setLength(metadata.getLength()) .setLastEntryId(metadata.getLastEntryId());
LedgerMetadata metadata = getLedgerMetadata(); isClosed = metadata.isClosed(); lastEntryId = metadata.getLastEntryId();
LedgerMetadata metadata = getLedgerMetadata(); isClosed = metadata.isClosed(); lac = metadata.getLastEntryId();
isClosed = metadata.isClosed(); if (isClosed) { lastAddConfirmed = metadata.getLastEntryId(); length = metadata.getLength();
lastAddConfirmed = lastAddPushed = metadata.getLastEntryId(); length = metadata.getLength(); } else {