/**
   * @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);
  }
Exemple #2
0
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    FServer fs = (FServer) getServletContext().getAttribute(FServer.FSERVER);
    assert fs != null : "No FS in context!";

    Configuration hrsconf = (Configuration) getServletContext().getAttribute(FServer.FSERVER_CONF);
    assert hrsconf != null : "No FS conf in context";

    response.setContentType("text/plain");
    OutputStream os = response.getOutputStream();
    PrintWriter out = new PrintWriter(os);

    out.println("Master status for " + fs.getServerName() + " as of " + new Date());

    out.println("\n\nVersion Info:");
    out.println(LINE);
    dumpVersionInfo(out);

    out.println("\n\nTasks:");
    out.println(LINE);
    TaskMonitor.get().dumpAsText(out);

    out.println("\n\nExecutors:");
    out.println(LINE);
    dumpExecutors(fs.getExecutorService(), out);

    out.println("\n\nStacks:");
    out.println(LINE);
    ReflectionUtils.printThreadInfo(out, "");

    out.println("\n\nFS Configuration:");
    out.println(LINE);
    Configuration conf = fs.getConfiguration();
    out.flush();
    conf.writeXml(os);
    os.flush();

    out.println("\n\nLogs");
    out.println(LINE);
    long tailKb = getTailKbParam(request);
    LogMonitoring.dumpTailOfLogs(out, tailKb);

    out.println("\n\nFS Queue:");
    out.println(LINE);
    if (isShowQueueDump(hrsconf)) {
      dumpQueue(fs, out);
    }

    out.flush();
  }