Skip to content

Commit 771e760

Browse files
committed
HBASE-28616 Remove/Deprecated the rs.* related configuration in TableOutputFormat (#5946)
Signed-off-by: Andrew Purtell <[email protected]> Signed-off-by: Pankaj Kumar <[email protected]> Reviewed-by: Subrat Mishra <[email protected]> (cherry picked from commit 771e1d9)
1 parent fa176a8 commit 771e760

File tree

5 files changed

+87
-30
lines changed

5 files changed

+87
-30
lines changed

hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedListWithVisibility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public int runCopier(String outputDir) throws Exception {
273273
}
274274
job.getConfiguration().setBoolean("mapreduce.map.speculative", false);
275275
job.getConfiguration().setBoolean("mapreduce.reduce.speculative", false);
276-
TableMapReduceUtil.initTableReducerJob(COMMON_TABLE_NAME, null, job, null, null, null, null);
276+
TableMapReduceUtil.initTableReducerJob(COMMON_TABLE_NAME, null, job);
277277
TableMapReduceUtil.addDependencyJars(job);
278278
TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
279279
TableMapReduceUtil.initCredentials(job);

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ public Job createSubmittableJob(String[] args) throws IOException {
180180
}
181181
} else {
182182
initCopyTableMapperReducerJob(job, scan);
183-
TableMapReduceUtil.initTableReducerJob(dstTableName, null, job, null, peerAddress, null,
184-
null);
183+
TableMapReduceUtil.initTableReducerJob(dstTableName, null, job, null, peerAddress);
185184
}
186185

187186
return job;

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/SyncTable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public Job createSubmittableJob(String[] args) throws IOException {
167167
} else {
168168
// No reducers. Just write straight to table. Call initTableReducerJob
169169
// because it sets up the TableOutputFormat.
170-
TableMapReduceUtil.initTableReducerJob(targetTableName, null, job, null, targetZkCluster,
171-
null, null);
170+
TableMapReduceUtil.initTableReducerJob(targetTableName, null, job, null, targetZkCluster);
172171

173172
// would be nice to add an option for bulk load instead
174173
}

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ public static void initTableReducerJob(String table, Class<? extends TableReduce
569569
*/
570570
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer,
571571
Job job, Class partitioner) throws IOException {
572-
initTableReducerJob(table, reducer, job, partitioner, null, null, null);
572+
initTableReducerJob(table, reducer, job, partitioner, null);
573573
}
574574

575575
/**
@@ -589,15 +589,11 @@ public static void initTableReducerJob(String table, Class<? extends TableReduce
589589
* <code> &lt;hbase.zookeeper.quorum&gt;:&lt;
590590
* hbase.zookeeper.client.port&gt;:&lt;zookeeper.znode.parent&gt;
591591
* </code> such as <code>server,server2,server3:2181:/hbase</code>.
592-
* @param serverClass redefined hbase.regionserver.class
593-
* @param serverImpl redefined hbase.regionserver.impl
594592
* @throws IOException When determining the region count fails.
595593
*/
596594
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer,
597-
Job job, Class partitioner, String quorumAddress, String serverClass, String serverImpl)
598-
throws IOException {
599-
initTableReducerJob(table, reducer, job, partitioner, quorumAddress, serverClass, serverImpl,
600-
true);
595+
Job job, Class partitioner, String quorumAddress) throws IOException {
596+
initTableReducerJob(table, reducer, job, partitioner, quorumAddress, true);
601597
}
602598

603599
/**
@@ -617,16 +613,13 @@ public static void initTableReducerJob(String table, Class<? extends TableReduce
617613
* <code> &lt;hbase.zookeeper.quorum&gt;:&lt;
618614
* hbase.zookeeper.client.port&gt;:&lt;zookeeper.znode.parent&gt;
619615
* </code> such as <code>server,server2,server3:2181:/hbase</code>.
620-
* @param serverClass redefined hbase.regionserver.class
621-
* @param serverImpl redefined hbase.regionserver.impl
622616
* @param addDependencyJars upload HBase jars and jars for any of the configured job classes via
623617
* the distributed cache (tmpjars).
624618
* @throws IOException When determining the region count fails.
625619
*/
626620
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer,
627-
Job job, Class partitioner, String quorumAddress, String serverClass, String serverImpl,
628-
boolean addDependencyJars) throws IOException {
629-
621+
Job job, Class partitioner, String quorumAddress, boolean addDependencyJars)
622+
throws IOException {
630623
Configuration conf = job.getConfiguration();
631624
HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf));
632625
job.setOutputFormatClass(TableOutputFormat.class);
@@ -640,10 +633,6 @@ public static void initTableReducerJob(String table, Class<? extends TableReduce
640633
ZKConfig.validateClusterKey(quorumAddress);
641634
conf.set(TableOutputFormat.QUORUM_ADDRESS, quorumAddress);
642635
}
643-
if (serverClass != null && serverImpl != null) {
644-
conf.set(TableOutputFormat.REGION_SERVER_CLASS, serverClass);
645-
conf.set(TableOutputFormat.REGION_SERVER_IMPL, serverImpl);
646-
}
647636
job.setOutputKeyClass(ImmutableBytesWritable.class);
648637
job.setOutputValueClass(Writable.class);
649638
if (partitioner == HRegionPartitioner.class) {
@@ -663,6 +652,72 @@ public static void initTableReducerJob(String table, Class<? extends TableReduce
663652
initCredentials(job);
664653
}
665654

655+
/**
656+
* Use this before submitting a TableReduce job. It will appropriately set up the JobConf.
657+
* @param table The output table.
658+
* @param reducer The reducer class to use.
659+
* @param job The current job to adjust. Make sure the passed job is carrying all
660+
* necessary HBase configuration.
661+
* @param partitioner Partitioner to use. Pass <code>null</code> to use default partitioner.
662+
* @param quorumAddress Distant cluster to write to; default is null for output to the cluster
663+
* that is designated in <code>hbase-site.xml</code>. Set this String to the
664+
* zookeeper ensemble of an alternate remote cluster when you would have the
665+
* reduce write a cluster that is other than the default; e.g. copying tables
666+
* between clusters, the source would be designated by
667+
* <code>hbase-site.xml</code> and this param would have the ensemble address
668+
* of the remote cluster. The format to pass is particular. Pass
669+
* <code> &lt;hbase.zookeeper.quorum&gt;:&lt;
670+
* hbase.zookeeper.client.port&gt;:&lt;zookeeper.znode.parent&gt;
671+
* </code> such as <code>server,server2,server3:2181:/hbase</code>.
672+
* @param serverClass redefined hbase.regionserver.class
673+
* @param serverImpl redefined hbase.regionserver.impl
674+
* @throws IOException When determining the region count fails.
675+
* @deprecated Since 2.5.9, 2.6.1, 2.7.0, will be removed in 4.0.0. The {@code serverClass} and
676+
* {@code serverImpl} do not take effect any more, just use
677+
* {@link #initTableReducerJob(String, Class, Job, Class, String)} instead.
678+
* @see #initTableReducerJob(String, Class, Job, Class, String)
679+
*/
680+
@Deprecated
681+
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer,
682+
Job job, Class partitioner, String quorumAddress, String serverClass, String serverImpl)
683+
throws IOException {
684+
initTableReducerJob(table, reducer, job, partitioner, quorumAddress);
685+
}
686+
687+
/**
688+
* Use this before submitting a TableReduce job. It will appropriately set up the JobConf.
689+
* @param table The output table.
690+
* @param reducer The reducer class to use.
691+
* @param job The current job to adjust. Make sure the passed job is carrying all
692+
* necessary HBase configuration.
693+
* @param partitioner Partitioner to use. Pass <code>null</code> to use default partitioner.
694+
* @param quorumAddress Distant cluster to write to; default is null for output to the cluster
695+
* that is designated in <code>hbase-site.xml</code>. Set this String to
696+
* the zookeeper ensemble of an alternate remote cluster when you would
697+
* have the reduce write a cluster that is other than the default; e.g.
698+
* copying tables between clusters, the source would be designated by
699+
* <code>hbase-site.xml</code> and this param would have the ensemble
700+
* address of the remote cluster. The format to pass is particular. Pass
701+
* <code> &lt;hbase.zookeeper.quorum&gt;:&lt;
702+
* hbase.zookeeper.client.port&gt;:&lt;zookeeper.znode.parent&gt;
703+
* </code> such as <code>server,server2,server3:2181:/hbase</code>.
704+
* @param serverClass redefined hbase.regionserver.class
705+
* @param serverImpl redefined hbase.regionserver.impl
706+
* @param addDependencyJars upload HBase jars and jars for any of the configured job classes via
707+
* the distributed cache (tmpjars).
708+
* @throws IOException When determining the region count fails.
709+
* @deprecated Since 2.5.9, 2.6.1, 2.7.0, will be removed in 4.0.0. The {@code serverClass} and
710+
* {@code serverImpl} do not take effect any more, just use
711+
* {@link #initTableReducerJob(String, Class, Job, Class, String, boolean)} instead.
712+
* @see #initTableReducerJob(String, Class, Job, Class, String, boolean)
713+
*/
714+
@Deprecated
715+
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer,
716+
Job job, Class partitioner, String quorumAddress, String serverClass, String serverImpl,
717+
boolean addDependencyJars) throws IOException {
718+
initTableReducerJob(table, reducer, job, partitioner, quorumAddress, addDependencyJars);
719+
}
720+
666721
/**
667722
* Ensures that the given number of reduce tasks for the given job configuration does not exceed
668723
* the number of regions for the given table.

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,26 @@ public class TableOutputFormat<KEY> extends OutputFormat<KEY, Mutation> implemen
6666
* Optional job parameter to specify a peer cluster. Used specifying remote cluster when copying
6767
* between hbase clusters (the source is picked up from <code>hbase-site.xml</code>).
6868
* @see TableMapReduceUtil#initTableReducerJob(String, Class, org.apache.hadoop.mapreduce.Job,
69-
* Class, String, String, String)
69+
* Class, String)
7070
*/
7171
public static final String QUORUM_ADDRESS = OUTPUT_CONF_PREFIX + "quorum";
7272

7373
/** Optional job parameter to specify peer cluster's ZK client port */
7474
public static final String QUORUM_PORT = OUTPUT_CONF_PREFIX + "quorum.port";
7575

76-
/** Optional specification of the rs class name of the peer cluster */
76+
/**
77+
* Optional specification of the rs class name of the peer cluster.
78+
* @deprecated Since 2.5.9, 2.6.1 and 2.7.0, will be removed in 4.0.0. Does not take effect from
79+
* long ago, see HBASE-6044.
80+
*/
81+
@Deprecated
7782
public static final String REGION_SERVER_CLASS = OUTPUT_CONF_PREFIX + "rs.class";
78-
/** Optional specification of the rs impl name of the peer cluster */
83+
/**
84+
* Optional specification of the rs impl name of the peer cluster
85+
* @deprecated Since 2.5.9, 2.6.1 and 2.7.0, will be removed in 4.0.0. Does not take effect from
86+
* long ago, see HBASE-6044.
87+
*/
88+
@Deprecated
7989
public static final String REGION_SERVER_IMPL = OUTPUT_CONF_PREFIX + "rs.impl";
8090

8191
/** The configuration. */
@@ -208,15 +218,9 @@ public void setConf(Configuration otherConf) {
208218

209219
String address = otherConf.get(QUORUM_ADDRESS);
210220
int zkClientPort = otherConf.getInt(QUORUM_PORT, 0);
211-
String serverClass = otherConf.get(REGION_SERVER_CLASS);
212-
String serverImpl = otherConf.get(REGION_SERVER_IMPL);
213221

214222
try {
215223
this.conf = HBaseConfiguration.createClusterConf(otherConf, address, OUTPUT_CONF_PREFIX);
216-
217-
if (serverClass != null) {
218-
this.conf.set(HConstants.REGION_SERVER_IMPL, serverImpl);
219-
}
220224
if (zkClientPort != 0) {
221225
this.conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, zkClientPort);
222226
}

0 commit comments

Comments
 (0)