void restoreSnapshot(Configuration conf, String snapshotName, Path rootDir, Path restoreDir, FileSystem fs) throws IOException { RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); }
private void openWithRestoringSnapshot() throws IOException { final RestoreSnapshotHelper.RestoreMetaChanges meta = RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); final List<RegionInfo> restoredRegions = meta.getRegionsToAdd(); htd = meta.getTableDescriptor(); regions = new ArrayList<>(restoredRegions.size()); restoredRegions.stream().filter(this::isValidRegion).sorted().forEach(r -> regions.add(r)); }
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);
private void restoreSnapshotForPeerCluster(Configuration conf, String peerQuorumAddress) throws IOException { Configuration peerConf = HBaseConfiguration.createClusterConf(conf, peerQuorumAddress, PEER_CONFIG_PREFIX); FileSystem.setDefaultUri(peerConf, peerFSAddress); FSUtils.setRootDir(peerConf, new Path(peerFSAddress, peerHBaseRootAddress)); FileSystem fs = FileSystem.get(peerConf); RestoreSnapshotHelper.copySnapshotForScanner(peerConf, fs, FSUtils.getRootDir(peerConf), new Path(peerFSAddress, peerSnapshotTmpDir), peerSnapshotName); }
@Test public void testNoHFileLinkInRootDir() throws IOException { rootDir = TEST_UTIL.getDefaultRootDirPath(); FSUtils.setRootDir(conf, rootDir); fs = rootDir.getFileSystem(conf); TableName tableName = TableName.valueOf("testNoHFileLinkInRootDir"); String snapshotName = tableName.getNameAsString() + "-snapshot"; createTableAndSnapshot(tableName, snapshotName); Path restoreDir = new Path("/hbase/.tmp-restore"); RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); checkNoHFileLinkInTableDir(tableName); }
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);
private void init() throws IOException { RestoreSnapshotHelper.RestoreMetaChanges meta = RestoreSnapshotHelper.copySnapshotForScanner(this.configuration, this.fs, this.rootDir, this.restoreDir, this.snapshotName); List<RegionInfo> restoredRegions = meta.getRegionsToAdd(); this.htd = meta.getTableDescriptor(); this.regions = new ArrayList<RegionInfo>(restoredRegions.size()); for (RegionInfo restoredRegion : restoredRegions) { if (isValidRegion(restoredRegion)) { this.regions.add(restoredRegion); } } this.regions.sort(RegionInfo.COMPARATOR); LOG.info("Initialization complete with " + regions.size() + " valid regions"); }
void restoreSnapshot(Configuration conf, String snapshotName, Path rootDir, Path restoreDir, FileSystem fs) throws IOException { RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); }
void restoreSnapshot(Configuration conf, String snapshotName, Path rootDir, Path restoreDir, FileSystem fs) throws IOException { RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); }
void restoreSnapshot(Configuration conf, String snapshotName, Path rootDir, Path restoreDir, FileSystem fs) throws IOException { RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); }
/** * Configures the job to use TableSnapshotInputFormat to read from a snapshot. * @param conf the job to configure * @param snapshotName the name of the snapshot to read from * @param restoreDir a temporary directory to restore the snapshot into. Current user should * have write permissions to this directory, and this should not be a subdirectory of rootdir. * After the job is finished, restoreDir can be deleted. * @throws IOException if an error occurs */ public static void setInput(Configuration conf, String snapshotName, Path restoreDir) throws IOException { conf.set(SNAPSHOT_NAME_KEY, snapshotName); Path rootDir = FSUtils.getRootDir(conf); FileSystem fs = rootDir.getFileSystem(conf); restoreDir = new Path(restoreDir, UUID.randomUUID().toString()); // TODO: restore from record readers to parallelize. RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); conf.set(RESTORE_DIR_KEY, restoreDir.toString()); } }
private void init() throws IOException { RestoreSnapshotHelper.RestoreMetaChanges meta = RestoreSnapshotHelper.copySnapshotForScanner(this.configuration, this.fs, this.rootDir, this.restoreDir, this.snapshotName); List<RegionInfo> restoredRegions = meta.getRegionsToAdd(); this.htd = meta.getTableDescriptor(); this.regions = new ArrayList<>(restoredRegions.size()); for (RegionInfo restoredRegion : restoredRegions) { if (isValidRegion(restoredRegion)) { this.regions.add(restoredRegion); } } this.regions.sort(RegionInfo.COMPARATOR); }
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);
private void restoreSnapshotForPeerCluster(Configuration conf, String peerQuorumAddress) throws IOException { Configuration peerConf = HBaseConfiguration.createClusterConf(conf, peerQuorumAddress, PEER_CONFIG_PREFIX); FileSystem.setDefaultUri(peerConf, peerFSAddress); FSUtils.setRootDir(peerConf, new Path(peerFSAddress, peerHBaseRootAddress)); FileSystem fs = FileSystem.get(peerConf); RestoreSnapshotHelper.copySnapshotForScanner(peerConf, fs, FSUtils.getRootDir(peerConf), new Path(peerFSAddress, peerSnapshotTmpDir), peerSnapshotName); }
private void restoreSnapshotForPeerCluster(Configuration conf, String peerQuorumAddress) throws IOException { Configuration peerConf = HBaseConfiguration.createClusterConf(conf, peerQuorumAddress, PEER_CONFIG_PREFIX); FileSystem.setDefaultUri(peerConf, peerFSAddress); FSUtils.setRootDir(peerConf, new Path(peerFSAddress, peerHBaseRootAddress)); FileSystem fs = FileSystem.get(peerConf); RestoreSnapshotHelper.copySnapshotForScanner(peerConf, fs, FSUtils.getRootDir(peerConf), new Path(peerFSAddress, peerSnapshotTmpDir), peerSnapshotName); }
private void init() throws IOException { RestoreSnapshotHelper.RestoreMetaChanges meta = RestoreSnapshotHelper.copySnapshotForScanner(this.configuration, this.fs, this.rootDir, this.restoreDir, this.snapshotName); List restoredRegions = meta.getRegionsToAdd(); this.htd = meta.getTableDescriptor(); this.regions = new ArrayList(restoredRegions.size()); Iterator i$ = restoredRegions.iterator(); while(i$.hasNext()) { RegionInfo hri = (RegionInfo)i$.next(); if(CellUtil.overlappingKeys(this.scan.getStartRow(), this.scan.getStopRow(), hri.getStartKey(), hri.getEndKey())) { this.regions.add(hri); } } Collections.sort(this.regions,RegionInfo.COMPARATOR); }
private void init() throws IOException { final RestoreSnapshotHelper.RestoreMetaChanges meta = RestoreSnapshotHelper.copySnapshotForScanner( conf, fs, rootDir, restoreDir, snapshotName); final List<HRegionInfo> restoredRegions = meta.getRegionsToAdd(); htd = meta.getTableDescriptor(); regions = new ArrayList<HRegionInfo>(restoredRegions.size()); for (HRegionInfo hri: restoredRegions) { if (CellUtil.overlappingKeys(scan.getStartRow(), scan.getStopRow(), hri.getStartKey(), hri.getEndKey())) { regions.add(hri); } } // sort for regions according to startKey. Collections.sort(regions); initScanMetrics(scan); }
@Test public void testNoHFileLinkInRootDir() throws IOException { rootDir = TEST_UTIL.getDefaultRootDirPath(); FSUtils.setRootDir(conf, rootDir); fs = rootDir.getFileSystem(conf); TableName tableName = TableName.valueOf("testNoHFileLinkInRootDir"); String snapshotName = tableName.getNameAsString() + "-snapshot"; createTableAndSnapshot(tableName, snapshotName); Path restoreDir = new Path("/hbase/.tmp-restore"); RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); checkNoHFileLinkInTableDir(tableName); }
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);