@Override void readFields(DataInputStream in, int logVersion) throws IOException { if (!NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.length = in.readInt(); if (this.length != 2) { throw new IOException("Incorrect data format. " + "delete operation."); } } this.path = FSImageSerialization.readString(in); if (NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.timestamp = FSImageSerialization.readLong(in); } else { this.timestamp = readLong(in); } // read RPC ids if necessary readRpcIds(in, logVersion); }
@Override void fromXml(Stanza st) throws InvalidXmlException { this.length = Integer.parseInt(st.getValue("LENGTH")); this.path = st.getValue("PATH"); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP")); readRpcIdsFromXml(st); } }
inst.put(OP_CONCAT_DELETE, new ConcatDeleteOp()); inst.put(OP_RENAME_OLD, new RenameOldOp()); inst.put(OP_DELETE, new DeleteOp()); inst.put(OP_MKDIR, new MkdirOp()); inst.put(OP_SET_GENSTAMP_V1, new SetGenstampV1Op());
inst.put(OP_CONCAT_DELETE, new ConcatDeleteOp()); inst.put(OP_RENAME_OLD, new RenameOldOp()); inst.put(OP_DELETE, new DeleteOp()); inst.put(OP_MKDIR, new MkdirOp()); inst.put(OP_SET_GENSTAMP_V1, new SetGenstampV1Op());
@Override protected EnumMap<FSEditLogOpCodes, FSEditLogOp> initialValue() { EnumMap<FSEditLogOpCodes, FSEditLogOp> instances = new EnumMap<FSEditLogOpCodes, FSEditLogOp>(FSEditLogOpCodes.class); instances.put(OP_INVALID, new InvalidOp()); instances.put(OP_ADD, new AddOp()); instances.put(OP_CLOSE, new CloseOp()); instances.put(OP_SET_REPLICATION, new SetReplicationOp()); instances.put(OP_CONCAT_DELETE, new ConcatDeleteOp()); instances.put(OP_RENAME, new RenameOp()); instances.put(OP_DELETE, new DeleteOp()); instances.put(OP_MKDIR, new MkdirOp()); instances.put(OP_SET_GENSTAMP, new SetGenstampOp()); instances.put(OP_DATANODE_ADD, new DatanodeAddOp()); instances.put(OP_DATANODE_REMOVE, new DatanodeRemoveOp()); instances.put(OP_SET_PERMISSIONS, new SetPermissionsOp()); instances.put(OP_SET_OWNER, new SetOwnerOp()); instances.put(OP_SET_NS_QUOTA, new SetNSQuotaOp()); instances.put(OP_CLEAR_NS_QUOTA, new ClearNSQuotaOp()); instances.put(OP_SET_QUOTA, new SetQuotaOp()); instances.put(OP_TIMES, new TimesOp()); instances.put(OP_START_LOG_SEGMENT, new LogSegmentOp(OP_START_LOG_SEGMENT)); instances.put(OP_END_LOG_SEGMENT, new LogSegmentOp(OP_END_LOG_SEGMENT)); return instances; } };
@Override void readFields(DataInputStream in, int logVersion) throws IOException { if (!NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.length = in.readInt(); if (this.length != 2) { throw new IOException("Incorrect data format. " + "delete operation."); } } this.path = FSImageSerialization.readString(in); if (NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.timestamp = FSImageSerialization.readLong(in); } else { this.timestamp = readLong(in); } // read RPC ids if necessary readRpcIds(in, logVersion); }
@Override void readFields(DataInputStream in, int logVersion) throws IOException { if (!NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.length = in.readInt(); if (this.length != 2) { throw new IOException("Incorrect data format. " + "delete operation."); } } this.path = FSImageSerialization.readString(in); if (NameNodeLayoutVersion.supports( LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) { this.timestamp = FSImageSerialization.readLong(in); } else { this.timestamp = readLong(in); } // read RPC ids if necessary readRpcIds(in, logVersion); }
@Override public void addTransactionsToLog(EditLogOutputStream elos, OpInstanceCache cache) throws IOException { for (long txid = 1; txid <= MAX_TXID; txid++) { if (txid == BAD_TXID) { byte garbage[] = { 0x1, 0x2, 0x3 }; elos.writeRaw(garbage, 0, garbage.length); } else { DeleteOp op; op = DeleteOp.getInstance(cache); op.setTransactionId(txid); op.setPath("/foo." + txid); op.setTimestamp(txid); elos.write(op); } } }
/** * Add delete file record to edit log */ void logDelete(String src, long timestamp, boolean toLogRpcIds) { DeleteOp op = DeleteOp.getInstance(cache.get()) .setPath(src) .setTimestamp(timestamp); logRpcIds(op, toLogRpcIds); logEdit(op); }
/** * Add delete file record to edit log */ public void logDelete(String src, long timestamp) { DeleteOp op = DeleteOp.getInstance(); op.set(src, timestamp); logEdit(op); }
@Override void fromXml(Stanza st) throws InvalidXmlException { this.length = Integer.parseInt(st.getValue("LENGTH")); this.path = st.getValue("PATH"); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP")); readRpcIdsFromXml(st); } }
/** * Add delete file record to edit log */ void logDelete(String src, long timestamp, boolean toLogRpcIds) { DeleteOp op = DeleteOp.getInstance(cache.get()) .setPath(src) .setTimestamp(timestamp); logRpcIds(op, toLogRpcIds); logEdit(op); }
static void addDeleteOpcode(EditLogOutputStream elos, OpInstanceCache cache, long txId, String path) throws IOException { DeleteOp op = DeleteOp.getInstance(cache); op.setTransactionId(txId); op.setPath(path); op.setTimestamp(0); elos.write(op); }
@Override void fromXml(Stanza st) throws InvalidXmlException { this.length = Integer.parseInt(st.getValue("LENGTH")); this.path = st.getValue("PATH"); this.timestamp = Long.parseLong(st.getValue("TIMESTAMP")); readRpcIdsFromXml(st); } }
/** * Add delete file record to edit log */ void logDelete(String src, long timestamp, boolean toLogRpcIds) { DeleteOp op = DeleteOp.getInstance(cache.get()) .setPath(src) .setTimestamp(timestamp); logRpcIds(op, toLogRpcIds); logEdit(op); }