当前位置: 首页>>代码示例>>Java>>正文


Java MasterCoprocessorHost.preCloneSnapshot方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.master.MasterCoprocessorHost.preCloneSnapshot方法的典型用法代码示例。如果您正苦于以下问题:Java MasterCoprocessorHost.preCloneSnapshot方法的具体用法?Java MasterCoprocessorHost.preCloneSnapshot怎么用?Java MasterCoprocessorHost.preCloneSnapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.master.MasterCoprocessorHost的用法示例。


在下文中一共展示了MasterCoprocessorHost.preCloneSnapshot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cloneSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Clone the specified snapshot.
 * The clone will fail if the destination table has a snapshot or restore in progress.
 *
 * @param reqSnapshot Snapshot Descriptor from request
 * @param tableName table to clone
 * @param snapshot Snapshot Descriptor
 * @param snapshotTableDesc Table Descriptor
 * @param nonceKey unique identifier to prevent duplicated RPC
 * @return procId the ID of the clone snapshot procedure
 * @throws IOException
 */
private long cloneSnapshot(final SnapshotDescription reqSnapshot, final TableName tableName,
    final SnapshotDescription snapshot, final TableDescriptor snapshotTableDesc,
    final NonceKey nonceKey, final boolean restoreAcl) throws IOException {
  MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();
  TableDescriptor htd = TableDescriptorBuilder.copy(tableName, snapshotTableDesc);
  org.apache.hadoop.hbase.client.SnapshotDescription snapshotPOJO = null;
  if (cpHost != null) {
    snapshotPOJO = ProtobufUtil.createSnapshotDesc(reqSnapshot);
    cpHost.preCloneSnapshot(snapshotPOJO, htd);
  }
  long procId;
  try {
    procId = cloneSnapshot(snapshot, htd, nonceKey, restoreAcl);
  } catch (IOException e) {
    LOG.error("Exception occurred while cloning the snapshot " + snapshot.getName()
      + " as table " + tableName.getNameAsString(), e);
    throw e;
  }
  LOG.info("Clone snapshot=" + snapshot.getName() + " as table=" + tableName);

  if (cpHost != null) {
    cpHost.postCloneSnapshot(snapshotPOJO, htd);
  }
  return procId;
}
 
开发者ID:apache,项目名称:hbase,代码行数:38,代码来源:SnapshotManager.java

示例2: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  HTableDescriptor snapshotTableDesc = FSTableDescriptors.getTableDescriptor(fs, snapshotDir);
  String tableName = reqSnapshot.getTable();

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Verify snapshot validity
  SnapshotReferenceUtil.verifySnapshot(master.getConfiguration(), fs, snapshotDir, fsSnapshot);

  // Execute the restore/clone operation
  if (MetaReader.tableExists(master.getCatalogTracker(), tableName)) {
    if (master.getAssignmentManager().getZKTable().isEnabledTable(fsSnapshot.getTable())) {
      throw new UnsupportedOperationException("Table '" +
        fsSnapshot.getTable() + "' must be disabled in order to perform a restore operation.");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc,
                                                       Bytes.toBytes(tableName));
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:59,代码来源:SnapshotManager.java

示例3: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  SnapshotManifest manifest = SnapshotManifest.open(master.getConfiguration(), fs,
      snapshotDir, fsSnapshot);
  HTableDescriptor snapshotTableDesc = manifest.getTableDescriptor();
  TableName tableName = TableName.valueOf(reqSnapshot.getTable());

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Verify snapshot validity
  SnapshotReferenceUtil.verifySnapshot(master.getConfiguration(), fs, manifest);

  // Execute the restore/clone operation
  if (MetaTableAccessor.tableExists(master.getConnection(), tableName)) {
    if (master.getAssignmentManager().getTableStateManager().isTableState(
        TableName.valueOf(fsSnapshot.getTable()), ZooKeeperProtos.Table.State.ENABLED)) {
      throw new UnsupportedOperationException("Table '" +
          TableName.valueOf(fsSnapshot.getTable()) + "' must be disabled in order to " +
          "perform a restore operation" +
          ".");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc, tableName);
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:63,代码来源:SnapshotManager.java

示例4: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  HTableDescriptor snapshotTableDesc =
      FSTableDescriptors.getTableDescriptorFromFs(fs, snapshotDir);
  TableName tableName = TableName.valueOf(reqSnapshot.getTable());

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Verify snapshot validity
  SnapshotReferenceUtil.verifySnapshot(master.getConfiguration(), fs, snapshotDir, fsSnapshot);

  // Execute the restore/clone operation
  if (MetaReader.tableExists(master.getCatalogTracker(), tableName)) {
    if (master.getAssignmentManager().getZKTable().isEnabledTable(
        TableName.valueOf(fsSnapshot.getTable()))) {
      throw new UnsupportedOperationException("Table '" +
          TableName.valueOf(fsSnapshot.getTable()) + "' must be disabled in order to " +
          "perform a restore operation" +
          ".");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc, tableName);
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:62,代码来源:SnapshotManager.java

示例5: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  SnapshotManifest manifest = SnapshotManifest.open(master.getConfiguration(), fs,
      snapshotDir, fsSnapshot);
  HTableDescriptor snapshotTableDesc = manifest.getTableDescriptor();
  TableName tableName = TableName.valueOf(reqSnapshot.getTable());

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Verify snapshot validity
  SnapshotReferenceUtil.verifySnapshot(master.getConfiguration(), fs, manifest);

  // Execute the restore/clone operation
  if (MetaReader.tableExists(master.getCatalogTracker(), tableName)) {
    if (master.getAssignmentManager().getTableStateManager().isTableState(
        TableName.valueOf(fsSnapshot.getTable()), ZooKeeperProtos.Table.State.ENABLED)) {
      throw new UnsupportedOperationException("Table '" +
          TableName.valueOf(fsSnapshot.getTable()) + "' must be disabled in order to " +
          "perform a restore operation" +
          ".");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc, tableName);
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:63,代码来源:SnapshotManager.java

示例6: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  HTableDescriptor snapshotTableDesc =
      FSTableDescriptors.getTableDescriptorFromFs(fs, snapshotDir);
  TableName tableName = TableName.valueOf(reqSnapshot.getTable());

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Execute the restore/clone operation
  if (MetaReader.tableExists(master.getCatalogTracker(), tableName)) {
    if (master.getAssignmentManager().getZKTable().isEnabledTable(
        TableName.valueOf(fsSnapshot.getTable()))) {
      throw new UnsupportedOperationException("Table '" +
          TableName.valueOf(fsSnapshot.getTable()) + "' must be disabled in order to " +
          "perform a restore operation" +
          ".");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc, tableName);
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:59,代码来源:SnapshotManager.java

示例7: restoreSnapshot

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入方法依赖的package包/类
/**
 * Restore the specified snapshot
 * @param reqSnapshot
 * @throws IOException
 */
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
  FileSystem fs = master.getMasterFileSystem().getFileSystem();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(reqSnapshot, rootDir);
  MasterCoprocessorHost cpHost = master.getCoprocessorHost();

  // check if the snapshot exists
  if (!fs.exists(snapshotDir)) {
    LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
    throw new SnapshotDoesNotExistException(reqSnapshot);
  }

  // read snapshot information
  SnapshotDescription fsSnapshot = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
  HTableDescriptor snapshotTableDesc = FSTableDescriptors.getTableDescriptor(fs, snapshotDir);
  String tableName = reqSnapshot.getTable();

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  // Execute the restore/clone operation
  if (MetaReader.tableExists(master.getCatalogTracker(), tableName)) {
    if (master.getAssignmentManager().getZKTable().isEnabledTable(fsSnapshot.getTable())) {
      throw new UnsupportedOperationException("Table '" +
        fsSnapshot.getTable() + "' must be disabled in order to perform a restore operation.");
    }

    // call coproc pre hook
    if (cpHost != null) {
      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
    restoreSnapshot(fsSnapshot, snapshotTableDesc);
    LOG.info("Restore snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
    }
  } else {
    HTableDescriptor htd = RestoreSnapshotHelper.cloneTableSchema(snapshotTableDesc,
                                                       Bytes.toBytes(tableName));
    if (cpHost != null) {
      cpHost.preCloneSnapshot(reqSnapshot, htd);
    }
    cloneSnapshot(fsSnapshot, htd);
    LOG.info("Clone snapshot=" + fsSnapshot.getName() + " as table=" + tableName);

    if (cpHost != null) {
      cpHost.postCloneSnapshot(reqSnapshot, htd);
    }
  }
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:56,代码来源:SnapshotManager.java


注:本文中的org.apache.hadoop.hbase.master.MasterCoprocessorHost.preCloneSnapshot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。