hash = (53 * hash) + hashEnum(getType());
/** * Dump the {@link SnapshotDescription} */ private void printInfo() { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); System.out.println("Snapshot Info"); System.out.println("----------------------------------------"); System.out.println(" Name: " + snapshotDesc.getName()); System.out.println(" Type: " + snapshotDesc.getType()); System.out.println(" Table: " + snapshotDesc.getTable()); System.out.println(" Format: " + snapshotDesc.getVersion()); System.out.println("Created: " + df.format(new Date(snapshotDesc.getCreationTime()))); System.out.println(); }
hash = (53 * hash) + hashEnum(getType());
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription other) { if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasTable()) { bitField0_ |= 0x00000002; table_ = other.table_; onChanged(); } if (other.hasCreationTime()) { setCreationTime(other.getCreationTime()); } if (other.hasType()) { setType(other.getType()); } if (other.hasVersion()) { setVersion(other.getVersion()); } if (other.hasOwner()) { bitField0_ |= 0x00000020; owner_ = other.owner_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
hash = (53 * hash) + hashEnum(getType());
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription other) { if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasTable()) { bitField0_ |= 0x00000002; table_ = other.table_; onChanged(); } if (other.hasCreationTime()) { setCreationTime(other.getCreationTime()); } if (other.hasType()) { setType(other.getType()); } if (other.hasVersion()) { setVersion(other.getVersion()); } if (other.hasOwner()) { bitField0_ |= 0x00000020; owner_ = other.owner_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * @param snapshot descriptor of the snapshot to take * @param masterServices master services provider */ public TakeSnapshotHandler(SnapshotDescription snapshot, final MasterServices masterServices) { super(masterServices, EventType.C_M_SNAPSHOT_TABLE); assert snapshot != null : "SnapshotDescription must not be nul1"; assert masterServices != null : "MasterServices must not be nul1"; this.master = masterServices; this.snapshot = snapshot; this.snapshotTable = TableName.valueOf(snapshot.getTable()); this.conf = this.master.getConfiguration(); this.fs = this.master.getMasterFileSystem().getFileSystem(); this.rootDir = this.master.getMasterFileSystem().getRootDir(); this.snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir); this.workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(snapshot, rootDir); this.monitor = new ForeignExceptionDispatcher(snapshot.getName()); this.snapshotManifest = SnapshotManifest.create(conf, fs, workingDir, snapshot, monitor); this.tableLockManager = master.getTableLockManager(); this.tableLock = this.tableLockManager.writeLock( snapshotTable, EventType.C_M_SNAPSHOT_TABLE.toString()); // prepare the verify this.verifier = new MasterSnapshotVerifier(masterServices, snapshot, rootDir); // update the running tasks this.status = TaskMonitor.get().createStatus( "Taking " + snapshot.getType() + " snapshot on table: " + snapshotTable); }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription other) { if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasTable()) { bitField0_ |= 0x00000002; table_ = other.table_; onChanged(); } if (other.hasCreationTime()) { setCreationTime(other.getCreationTime()); } if (other.hasType()) { setType(other.getType()); } if (other.hasVersion()) { setVersion(other.getVersion()); } if (other.hasOwner()) { bitField0_ |= 0x00000020; owner_ = other.owner_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Triggers an asynchronous attempt to take a snapshot. * {@inheritDoc} */ @Override public SnapshotResponse snapshot(RpcController controller, SnapshotRequest request) throws ServiceException { try { master.checkInitialized(); master.snapshotManager.checkSnapshotSupport(); LOG.info(master.getClientIdAuditPrefix() + " snapshot request for:" + ClientSnapshotDescriptionUtils.toString(request.getSnapshot())); // get the snapshot information SnapshotDescription snapshot = SnapshotDescriptionUtils.validate( request.getSnapshot(), master.getConfiguration()); master.snapshotManager.takeSnapshot(snapshot); // send back the max amount of time the client should wait for the snapshot to complete long waitTime = SnapshotDescriptionUtils.getMaxMasterTimeout(master.getConfiguration(), snapshot.getType(), SnapshotDescriptionUtils.DEFAULT_MAX_WAIT_TIME); return SnapshotResponse.newBuilder().setExpectedTimeout(waitTime).build(); } catch (ForeignException e) { throw new ServiceException(e.getCause()); } catch (IOException e) { throw new ServiceException(e); } }
@java.lang.Override public int hashCode() { int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasTable()) { hash = (37 * hash) + TABLE_FIELD_NUMBER; hash = (53 * hash) + getTable().hashCode(); } if (hasCreationTime()) { hash = (37 * hash) + CREATIONTIME_FIELD_NUMBER; hash = (53 * hash) + hashLong(getCreationTime()); } if (hasType()) { hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getType()); } if (hasVersion()) { hash = (37 * hash) + VERSION_FIELD_NUMBER; hash = (53 * hash) + getVersion(); } hash = (29 * hash) + getUnknownFields().hashCode(); return hash; }
/** * Triggers an asynchronous attempt to take a snapshot. * {@inheritDoc} */ @Override public long snapshot(final HSnapshotDescription request) throws IOException { LOG.debug("Submitting snapshot request for:" + SnapshotDescriptionUtils.toString(request.getProto())); try { this.snapshotManager.checkSnapshotSupport(); } catch (UnsupportedOperationException e) { throw new IOException(e); } // get the snapshot information SnapshotDescription snapshot = SnapshotDescriptionUtils.validate(request.getProto(), this.conf); snapshotManager.takeSnapshot(snapshot); // send back the max amount of time the client should wait for the snapshot to complete long waitTime = SnapshotDescriptionUtils.getMaxMasterTimeout(conf, snapshot.getType(), SnapshotDescriptionUtils.DEFAULT_MAX_WAIT_TIME); return waitTime; }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription other) { if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.getDefaultInstance()) return this; if (other.hasName()) { setName(other.getName()); } if (other.hasTable()) { setTable(other.getTable()); } if (other.hasCreationTime()) { setCreationTime(other.getCreationTime()); } if (other.hasType()) { setType(other.getType()); } if (other.hasVersion()) { setVersion(other.getVersion()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Returns a single line (no \n) representation of snapshot metadata. Use this instead of * {@link SnapshotDescription#toString()}. We don't replace SnapshotDescrpition's toString * because it is auto-generated by protoc. * @param ssd * @return Single line string with a summary of the snapshot parameters */ public static String toString(SnapshotDescription ssd) { if (ssd == null) { return null; } return "{ ss=" + ssd.getName() + " table=" + ssd.getTable() + " type=" + ssd.getType() + " }"; } }
/** * Dump the {@link SnapshotDescription} */ private void printInfo() { SnapshotDescription snapshotDesc = snapshotManifest.getSnapshotDescription(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); System.out.println("Snapshot Info"); System.out.println("----------------------------------------"); System.out.println(" Name: " + snapshotDesc.getName()); System.out.println(" Type: " + snapshotDesc.getType()); System.out.println(" Table: " + snapshotDesc.getTable()); System.out.println(" Format: " + snapshotDesc.getVersion()); System.out.println("Created: " + df.format(new Date(snapshotDesc.getCreationTime()))); System.out.println(); }
/** * Returns a single line (no \n) representation of snapshot metadata. Use this instead of * {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription#toString()}. We don't replace SnapshotDescrpition's toString * because it is auto-generated by protoc. * @param ssd * @return Single line string with a summary of the snapshot parameters */ public static String toString(HBaseProtos.SnapshotDescription ssd) { if (ssd == null) { return null; } return "{ ss=" + ssd.getName() + " table=" + (ssd.hasTable()?TableName.valueOf(ssd.getTable()):"") + " type=" + ssd.getType() + " }"; } }
public SnapshotDescription.Type getType() { return this.proto.getType(); }
/** * Create a snapshot timer for the master which notifies the monitor when an error occurs * @param snapshot snapshot to monitor * @param conf configuration to use when getting the max snapshot life * @param monitor monitor to notify when the snapshot life expires * @return the timer to use update to signal the start and end of the snapshot */ public static TimeoutExceptionInjector getMasterTimerAndBindToMonitor(SnapshotDescription snapshot, Configuration conf, ForeignExceptionListener monitor) { long maxTime = SnapshotDescriptionUtils.getMaxMasterTimeout(conf, snapshot.getType(), SnapshotDescriptionUtils.DEFAULT_MAX_WAIT_TIME); return new TimeoutExceptionInjector(monitor, maxTime); }
public FlushSnapshotSubprocedure(ProcedureMember member, ForeignExceptionDispatcher errorListener, long wakeFrequency, long timeout, List<Region> regions, SnapshotDescription snapshot, SnapshotSubprocedurePool taskManager) { super(member, snapshot.getName(), errorListener, wakeFrequency, timeout); this.snapshot = snapshot; if (this.snapshot.getType() == SnapshotDescription.Type.SKIPFLUSH) { snapshotSkipFlush = true; } this.regions = regions; this.taskManager = taskManager; }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription other) { if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasTable()) { bitField0_ |= 0x00000002; table_ = other.table_; onChanged(); } if (other.hasCreationTime()) { setCreationTime(other.getCreationTime()); } if (other.hasType()) { setType(other.getType()); } if (other.hasVersion()) { setVersion(other.getVersion()); } if (other.hasOwner()) { bitField0_ |= 0x00000020; owner_ = other.owner_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; }