Skip to content

Commit a87231c

Browse files
author
Rajesh Sarkar
committed
HIVE-29667: [hiveACIDRepl] User is unable to assign yarn queue name to acid policies effectively via UI
1 parent 4c4a618 commit a87231c

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public class Hadoop23Shims extends HadoopShimsSecure {
119119

120120
HadoopShims.MiniDFSShim cluster = null;
121121
final boolean storagePolicy;
122+
private final String DEFAULT = "default";
123+
private final String MAPRED_JOB_QUEUE_NAME = "mapred.job.queue.name";
122124

123125
public Hadoop23Shims() {
124126
// in-memory HDFS
@@ -1238,6 +1240,13 @@ protected int runDistCpInternal(DistCp distcp, List<String> params) {
12381240
* of these details.
12391241
*/
12401242
protected void ensureMapReduceQueue(Configuration conf) {
1243+
String mapredQueue = conf.getRaw(MAPRED_JOB_QUEUE_NAME);
1244+
if (StringUtils.isNotEmpty(mapredQueue) && !DEFAULT.equals(mapredQueue)) {
1245+
LOG.info("DistCp: setting mapreduce.job.queuename to '{}' from mapred.job.queue.name", mapredQueue);
1246+
conf.set(MRJobConfig.QUEUE_NAME, mapredQueue);
1247+
return;
1248+
}
1249+
12411250
String queueName = conf.get(TezConfiguration.TEZ_QUEUE_NAME);
12421251
boolean isTez = "tez".equalsIgnoreCase(conf.get("hive.execution.engine"));
12431252
boolean shouldMapredJobsFollowTezQueue = conf.getBoolean("hive.mapred.job.follow.tez.queue", false);

shims/0.23/src/main/test/org/apache/hadoop/hive/shims/TestHadoop23Shims.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,22 @@ public void testGetFileIdForNonexistingPath() throws Exception {
196196
@Test
197197
public void testMapReduceQueueIsSetToTezQueue() throws Exception {
198198
Configuration conf = new Configuration();
199+
// mapred.job.queue.name set by replication policy
200+
conf = new Configuration();
201+
conf.set("mapred.job.queue.name", "testqueue");
202+
conf.set("hive.execution.engine", "tez");
203+
DistCp distCp = runMockDistCp(conf);
204+
assertEquals("testqueue", distCp.getConf().get(MRJobConfig.QUEUE_NAME));
205+
199206
// there is a tez.queue.name, but hive.mapred.job.follow.tez.queue is not allowed
207+
conf = new Configuration();
200208
conf.set(TezConfiguration.TEZ_QUEUE_NAME, "helloQ");
201209
conf.set("hive.execution.engine", "tez");
202-
DistCp distCp = runMockDistCp(conf);
210+
distCp = runMockDistCp(conf);
203211
assertEquals("default", distCp.getConf().get(MRJobConfig.QUEUE_NAME));
204212

205213
// there is a tez.queue.name, and hive.mapred.job.follow.tez.queue is allowed
214+
conf = new Configuration();
206215
conf.set(TezConfiguration.TEZ_QUEUE_NAME, "helloQ");
207216
conf.setBoolean("hive.mapred.job.follow.tez.queue", true);
208217
conf.set("hive.execution.engine", "tez");

0 commit comments

Comments
 (0)