@Override public TransactionEdit next() throws IOException { return next(new TransactionEdit()); }
/** * Creates a new instance in the {@link State#INPROGRESS} state. */ public static TransactionEdit createStarted(long writePointer, long visibilityUpperBound, long expirationDate, TransactionType type) { return new TransactionEdit(writePointer, visibilityUpperBound, State.INPROGRESS, expirationDate, null, 0L, false, type, null, 0L, 0L, null); }
/** * Initializes the log file, opening a file writer. Clients calling {@code init()} should ensure that they * also call {@link HDFSTransactionLog#close()}. * @throws java.io.IOException If an error is encountered initializing the file writer. */ public synchronized void init() throws IOException { if (initialized) { return; } this.writer = createWriter(); this.initialized = true; }
@Override public TransactionEdit next() throws IOException { Entry entry = new Entry(); try { entry.readFields(in); } catch (EOFException eofe) { // signal end of file by returning null return null; } return entry.getEdit(); }
@Override public void write(DataOutput out) throws IOException { TransactionEditCodecs.encode(this, out, new TransactionEditCodecs.TransactionEditCodecV2()); } }
@Override public long deleteOldSnapshots(int numberToKeep) throws IOException { // always only keep the last snapshot return lastSnapshot.getTimestamp(); }
/** * Recover the lease from HDFS, retrying multiple times. */ public void recoverFileLease(final FileSystem fs, final Path p, Configuration conf) throws IOException { // lease recovery not needed for local file system case. if (!(fs instanceof DistributedFileSystem)) { return; } recoverDFSFileLease((DistributedFileSystem) fs, p, conf); }
private void reset() { this.storage.stop(); this.lastRefresh = 0; this.initialized = false; }
/** * Creates a new instance in the {@link State#COMMITTING} state. */ public static TransactionEdit createCommitting(long writePointer, Set<ChangeId> changes) { return new TransactionEdit(writePointer, 0L, State.COMMITTING, 0L, changes, 0L, false, null, null, 0L, 0L, null); }
@Override public TransactionEdit next() throws IOException { return next(new TransactionEdit()); }
/** * Creates a new instance in the {@link State#COMMITTED} state. */ public static TransactionEdit createCommitted(long writePointer, Set<ChangeId> changes, long nextWritePointer, boolean canCommit) { return new TransactionEdit(writePointer, 0L, State.COMMITTED, 0L, changes, nextWritePointer, canCommit, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#ABORTED} state. */ public static TransactionEdit createAborted(long writePointer, TransactionType type, long[] checkpointPointers) { return new TransactionEdit(writePointer, 0L, State.ABORTED, 0L, null, 0L, false, type, null, 0L, 0L, checkpointPointers); }
/** * Creates a new instance in the {@link State#INPROGRESS} state. */ public static TransactionEdit createStarted(long writePointer, long visibilityUpperBound, long expirationDate, TransactionType type) { return new TransactionEdit(writePointer, visibilityUpperBound, State.INPROGRESS, expirationDate, null, 0L, false, type, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#MOVE_WATERMARK} state. */ public static TransactionEdit createMoveWatermark(long writePointer) { return new TransactionEdit(writePointer, 0L, State.MOVE_WATERMARK, 0L, null, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTx(Set<Long> truncateInvalidTx) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, truncateInvalidTx, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#CHECKPOINT} state. */ public static TransactionEdit createCheckpoint(long writePointer, long parentWritePointer) { return new TransactionEdit(writePointer, 0L, State.CHECKPOINT, 0L, null, 0L, false, null, null, 0L, parentWritePointer, null); }
/** * Creates a new instance in the {@link State#MOVE_WATERMARK} state. */ public static TransactionEdit createMoveWatermark(long writePointer) { return new TransactionEdit(writePointer, 0L, State.MOVE_WATERMARK, 0L, null, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#ABORTED} state. */ public static TransactionEdit createAborted(long writePointer, TransactionType type, long[] checkpointPointers) { return new TransactionEdit(writePointer, 0L, State.ABORTED, 0L, null, 0L, false, type, null, 0L, 0L, checkpointPointers); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTx(Set<Long> truncateInvalidTx) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, truncateInvalidTx, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#INVALID} state. */ public static TransactionEdit createInvalid(long writePointer) { return new TransactionEdit(writePointer, 0L, State.INVALID, 0L, null, 0L, false, null, null, 0L, 0L, null); }