Copilot commented on code in PR #8942:
URL: https://github.com/apache/hbase/pull/8942#discussion_r4747680498
##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java:
##########
@@ -1219,6 +1248,10 @@ protected void processOptions(CommandLine cmd) {
@Override
public int doWork() throws IOException {
Configuration conf = getConf();
Review Comment:
When `mapreduce.framework.name=yarn` is set only in `mapred-site.xml`, this
guard rejects a valid async export because the command starts with an HBase
configuration and has not yet initialized `Job`. Hadoop loads the MapReduce
resources during [Job
initialization](https://github.com/apache/hadoop/blob/d579fbf8d0397350f986002f7ca0b536b0fc573d/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java#L113-L119)
(verified on its default branch). Load those resources before checking the
framework, and cover this with a fresh-process test using only
`mapred-site.xml`.
##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java:
##########
@@ -1243,144 +1276,179 @@ public int doWork() throws IOException {
CommonFSUtils.setRootDir(conf, inputRoot);
}
- Configuration srcConf = HBaseConfiguration.createClusterConf(conf, null,
CONF_SOURCE_PREFIX);
- FileSystem inputFs = FileSystem.get(inputRoot.toUri(), srcConf);
- Configuration destConf = HBaseConfiguration.createClusterConf(conf, null,
CONF_DEST_PREFIX);
- FileSystem outputFs = FileSystem.get(outputRoot.toUri(), destConf);
- boolean skipTmp = conf.getBoolean(CONF_SKIP_TMP, false)
- || conf.get(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR) != null;
Path snapshotDir =
SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, inputRoot);
- Path snapshotTmpDir =
- SnapshotDescriptionUtils.getWorkingSnapshotDir(targetName, outputRoot,
destConf);
- Path outputSnapshotDir =
- SnapshotDescriptionUtils.getCompletedSnapshotDir(targetName, outputRoot);
- Path initialOutputSnapshotDir = skipTmp ? outputSnapshotDir :
snapshotTmpDir;
- LOG.debug("inputFs={}, inputRoot={}", inputFs.getUri().toString(),
inputRoot);
- LOG.debug("outputFs={}, outputRoot={}, skipTmp={},
initialOutputSnapshotDir={}", outputFs,
- outputRoot.toString(), skipTmp, initialOutputSnapshotDir);
-
- // throw CorruptedSnapshotException if we can't read the snapshot info.
- SnapshotDescription sourceSnapshotDesc =
- SnapshotDescriptionUtils.readSnapshotInfo(inputFs, snapshotDir);
-
- // Verify snapshot source before copying files
- if (verifySource) {
- LOG.info("Verify the source snapshot's expiration status and
integrity.");
- verifySnapshot(sourceSnapshotDesc, srcConf, inputFs, inputRoot,
snapshotDir);
+ if (async) {
+ try {
+ runCopyJob(inputRoot, outputRoot, snapshotName, snapshotDir,
verifyChecksum, filesUser,
+ filesGroup, filesMode, mappers, bandwidthMB, storagePolicy,
customFileGrouper,
+ fileLocationResolver);
Review Comment:
On a fresh, non-Kerberized client, `--async` can fail submission when the
source needs `exportsnapshot.from.*` filesystem settings, because
`ExportSnapshotInputFormat.getSplits()` opens it with the unmodified job
configuration. [Token acquisition skips filesystem initialization when security
is
disabled](https://github.com/apache/hadoop/blob/d579fbf8d0397350f986002f7ca0b536b0fc573d/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java#L75-L81)
(verified on Hadoop's default branch). In `getSplits()` at line 863, pass
`HBaseConfiguration.createClusterConf(conf, null, CONF_SOURCE_PREFIX)` to
`FileSystem.get()` and add coverage for source-only filesystem overrides.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]