From e0ebb9fdc344956cce029c993a1f60034e0d9904 Mon Sep 17 00:00:00 2001 From: Liangjun He Date: Tue, 30 Jul 2024 12:29:56 +0800 Subject: [PATCH] HBASE-28389 HBase backup yarn queue parameter ignored --- .../apache/hadoop/hbase/backup/RestoreDriver.java | 4 ++-- .../hadoop/hbase/backup/impl/BackupCommands.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/RestoreDriver.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/RestoreDriver.java index cb01469c8f18..38b767ecf67e 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/RestoreDriver.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/RestoreDriver.java @@ -124,8 +124,8 @@ private int parseAndRun() throws IOException { if (cmd.hasOption(OPTION_YARN_QUEUE_NAME)) { String queueName = cmd.getOptionValue(OPTION_YARN_QUEUE_NAME); - // Set system property value for MR job - System.setProperty("mapreduce.job.queuename", queueName); + // Set MR job queuename to configuration + getConf().set("mapreduce.job.queuename", queueName); } // parse main restore command options diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java index 3bb3ed33f34d..66694f4384f4 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java @@ -142,6 +142,12 @@ public void execute() throws IOException { throw new IOException(INCORRECT_USAGE); } + if (cmdline.hasOption(OPTION_YARN_QUEUE_NAME)) { + String queueName = cmdline.getOptionValue(OPTION_YARN_QUEUE_NAME); + // Set MR job queuename to configuration + getConf().set("mapreduce.job.queuename", queueName); + } + // Create connection conn = ConnectionFactory.createConnection(getConf()); if (requiresNoActiveSession()) { @@ -333,12 +339,6 @@ public void execute() throws IOException { boolean ignoreChecksum = cmdline.hasOption(OPTION_IGNORECHECKSUM); - if (cmdline.hasOption(OPTION_YARN_QUEUE_NAME)) { - String queueName = cmdline.getOptionValue(OPTION_YARN_QUEUE_NAME); - // Set system property value for MR job - System.setProperty("mapreduce.job.queuename", queueName); - } - try (BackupAdminImpl admin = new BackupAdminImpl(conn)) { BackupRequest.Builder builder = new BackupRequest.Builder(); BackupRequest request = builder.withBackupType(BackupType.valueOf(args[1].toUpperCase()))