@Override public void cancel(String why) { if (finished) return; this.finished = true; LOG.info("Stop taking snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " because: " + why); CancellationException ce = new CancellationException(why); monitor.receive(new ForeignException(master.getServerName().toString(), ce)); }
/** * Checks if the specified snapshot is done. * @return true if the snapshot is in file system ready to use, * false if the snapshot is in the process of completing * @throws ServiceException wrapping UnknownSnapshotException if invalid snapshot, or * a wrapped HBaseSnapshotException with progress failure reason. */ @Override public boolean isSnapshotDone(final HSnapshotDescription request) throws IOException { LOG.debug("Checking to see if snapshot from request:" + SnapshotDescriptionUtils.toString(request.getProto()) + " is done"); return snapshotManager.isSnapshotDone(request.getProto()); }
@Override public void cancel(String why) { if (this.stopped) return; this.stopped = true; String msg = "Stopping restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " because: " + why; LOG.info(msg); CancellationException ce = new CancellationException(why); this.monitor.receive(new ForeignException(masterServices.getServerName().toString(), ce)); }
@Override public Void call() throws Exception { LOG.debug("Running table info copy."); this.rethrowException(); LOG.debug("Attempting to copy table info for snapshot:" + SnapshotDescriptionUtils.toString(this.snapshot)); // get the HTable descriptor HTableDescriptor orig = FSTableDescriptors.getTableDescriptor(fs, rootDir, Bytes.toBytes(this.snapshot.getTable())); this.rethrowException(); // write a copy of descriptor to the snapshot directory Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(snapshot, rootDir); FSTableDescriptors.createTableDescriptorForTableDirectory(fs, snapshotDir, orig, false); LOG.debug("Finished copying tableinfo."); return null; } }
+ SnapshotDescriptionUtils.toString(snapshot) + " because we are already running another snapshot " + SnapshotDescriptionUtils.toString(this.handler.getSnapshot()), snapshot); + SnapshotDescriptionUtils.toString(snapshot) + " because we are already have a restore in progress on the same snapshot " + SnapshotDescriptionUtils.toString(this.handler.getSnapshot()), snapshot);
private void flushSnapshot() throws ForeignException { if (regions.isEmpty()) { // No regions on this RS, we are basically done. return; } monitor.rethrowException(); // assert that the taskManager is empty. if (taskManager.hasTasks()) { throw new IllegalStateException("Attempting to take snapshot " + SnapshotDescriptionUtils.toString(snapshot) + " but we currently have outstanding tasks"); } // Add all hfiles already existing in region. for (HRegion region : regions) { // submit one task per region for parallelize by region. taskManager.submitTask(new RegionSnapshotTask(region)); monitor.rethrowException(); } // wait for everything to complete. LOG.debug("Flush Snapshot Tasks submitted for " + regions.size() + " regions"); try { taskManager.waitForOutstandingTasks(); } catch (InterruptedException e) { throw new ForeignException(getMemberName(), e); } }
/** * 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; }
int tries = 0; LOG.debug("Waiting a max of " + max + " ms for snapshot '" + SnapshotDescriptionUtils.toString(snapshot) + "' to complete. (max " + maxPauseTime + " ms per retry)"); while (tries == 0 || (EnvironmentEdgeManager.currentTimeMillis() - start) < max && !done) {
+ SnapshotDescriptionUtils.toString(snapshot)); for (HRegionInfo regionInfo : regions) { SnapshotDescriptionUtils.toString(snapshot)); TableInfoCopyTask tableInfoCopyTask = new TableInfoCopyTask(this.monitor, snapshot, fs, FSUtils.getRootDir(conf)); } catch (Exception e) { String reason = "Failed snapshot " + SnapshotDescriptionUtils.toString(snapshot) + " due to exception:" + e.getMessage(); ForeignException ee = new ForeignException(reason, e); monitor.receive(ee); } finally { LOG.debug("Marking snapshot" + SnapshotDescriptionUtils.toString(snapshot) + " as finished.");
String msg = "clone snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " failed"; LOG.error(msg, e); IOException rse = new RestoreSnapshotException(msg, e, snapshot);
restoreHandlers.put(tableName, handler); } catch (Exception e) { String msg = "Couldn't clone the snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " on table=" + tableName; LOG.error(msg, e);
LOG.debug("Starting restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot)); Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir); RestoreSnapshotHelper restoreHelper = new RestoreSnapshotHelper( LOG.info("Restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " on table=" + Bytes.toString(tableName) + " completed!"); } catch (IOException e) { String msg = "restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " failed. Try re-running the restore command."; LOG.error(msg, e);
restoreHandlers.put(hTableDescriptor.getNameAsString(), handler); } catch (Exception e) { String msg = "Couldn't restore the snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " on table=" + tableName; LOG.error(msg, e);
String ssString = SnapshotDescriptionUtils.toString(expected);
LOG.debug("Table enabled, starting distributed snapshot."); snapshotEnabledTable(snapshot); LOG.debug("Started snapshot: " + SnapshotDescriptionUtils.toString(snapshot)); LOG.debug("Table is disabled, running snapshot entirely on master."); snapshotDisabledTable(snapshot); LOG.debug("Started snapshot: " + SnapshotDescriptionUtils.toString(snapshot)); } else { LOG.error("Can't snapshot table '" + snapshot.getTable()