HBASE-19376 Fix more binary compatibility problems with branch-1.4 / branch-1

This commit is contained in:
Andrew Purtell 2017-11-29 11:43:07 -08:00
parent 36a7029961
commit 4c413e0c50
6 changed files with 120 additions and 11 deletions

View File

@ -20,12 +20,15 @@
package org.apache.hadoop.hbase;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -41,7 +44,6 @@ import org.apache.hadoop.hbase.protobuf.generated.FSProtos.HBaseVersionFileConte
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.VersionedWritable;
@ -100,6 +102,26 @@ public class ClusterStatus extends VersionedWritable {
super();
}
@Deprecated
public ClusterStatus(String hbaseVersion, String clusterid, List<ServerName> deadServers,
ServerName master) {
this(hbaseVersion, clusterid, new HashMap<ServerName,ServerLoad>(), deadServers, master,
new ArrayList<ServerName>(), new HashSet<RegionState>(), new String[0], null);
}
@Deprecated
public ClusterStatus(final String hbaseVersion, final String clusterid,
final Map<ServerName,ServerLoad> servers,
final Collection<ServerName> deadServers,
final ServerName master,
final Collection<ServerName> backupMasters,
final Map<String,RegionState> rit,
final String[ ] masterCoprocessors,
final Boolean balancerOn) {
this(hbaseVersion, clusterid, servers, deadServers, master, backupMasters, Sets.newHashSet(rit.values()),
masterCoprocessors, balancerOn);
}
public ClusterStatus(final String hbaseVersion, final String clusterid,
final Map<ServerName, ServerLoad> servers,
final Collection<ServerName> deadServers,
@ -109,7 +131,6 @@ public class ClusterStatus extends VersionedWritable {
final String[] masterCoprocessors,
final Boolean balancerOn) {
this.hbaseVersion = hbaseVersion;
this.liveServers = servers;
this.deadServers = deadServers;
this.master = master;

View File

@ -869,6 +869,21 @@ public class Result implements CellScannable, CellScanner {
* @return The complete result that is formed by combining all of the partial results together
* @throws IOException A complete result cannot be formed because the results in the partial list
* come from different rows
* @deprecated
*/
@Deprecated
public static Result createCompleteResult(List<Result> partialResults)
throws IOException {
return createCompleteResult((Iterable<Result>)partialResults);
}
/**
* Forms a single result from the partial results in the partialResults list. This method is
* useful for reconstructing partial results on the client side.
* @param partialResults iterable of partial results
* @return The complete result that is formed by combining all of the partial results together
* @throws IOException A complete result cannot be formed because the results in the partial list
* come from different rows
*/
public static Result createCompleteResult(Iterable<Result> partialResults)
throws IOException {

View File

@ -301,6 +301,15 @@ final public class FilterList extends Filter {
return this.reversed;
}
/**
* @param maxFilters ignored
* @deprecated
*/
@Deprecated
public String toString(int maxFilters) {
return this.filterListBase.toString();
}
@Override
public String toString() {
return this.filterListBase.toString();

View File

@ -24,7 +24,6 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -32,7 +31,6 @@ import javax.naming.NamingException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.HConstants;
@ -437,6 +435,28 @@ extends InputFormat<ImmutableBytesWritable, Result> {
}
return res;
}
/**
* Calculates the number of MapReduce input splits for the map tasks. The number of
* MapReduce input splits depends on the average region size.
* Make it 'public' for testing
* <p>
* Deprecated. Former functionality has been replaced by calculateAutoBalancedSplits and
* will function differently. Do not use.
* <p>
* @param list The list of input splits before balance.
* @param context The current job context.
* @param average The average size of all regions .
* @return The list of input splits.
* @throws IOException
* @deprecated
*/
@Deprecated
public List<InputSplit> calculateRebalancedSplits(List<InputSplit> list, JobContext context,
long average) throws IOException {
return calculateAutoBalancedSplits(list, average);
}
/**
* Calculates the number of MapReduce input splits for the map tasks. The number of
* MapReduce input splits depends on the average region size.
@ -515,6 +535,44 @@ extends InputFormat<ImmutableBytesWritable, Result> {
return resultList;
}
/**
* Deprecated. Do not use.
* @param start Start key of the region
* @param end End key of the region
* @param isText It determines to use text key mode or binary key mode
* @return The split point in the region.
*/
@Deprecated
public static byte[] getSplitKey(byte[] start, byte[] end, boolean isText) {
byte upperLimitByte;
byte lowerLimitByte;
//Use text mode or binary mode.
if (isText) {
//The range of text char set in ASCII is [32,126], the lower limit is space and the upper
// limit is '~'.
upperLimitByte = '~';
lowerLimitByte = ' ';
} else {
upperLimitByte = -1;
lowerLimitByte = 0;
}
// For special case
// Example 1 : startkey=null, endkey="hhhqqqwww", splitKey="h"
// Example 2 (text key mode): startKey="ffffaaa", endKey=null, splitkey="f~~~~~~"
if (start.length == 0 && end.length == 0){
return new byte[]{(byte) ((lowerLimitByte + upperLimitByte) / 2)};
}
if (start.length == 0 && end.length != 0){
return new byte[]{ end[0] };
}
if (start.length != 0 && end.length == 0){
byte[] result =new byte[start.length];
result[0]=start[0];
return result;
}
return Bytes.split(start, end, false, 1)[1];
}
/**
* @deprecated mistakenly made public in 0.98.7. scope will change to package-private
*/

View File

@ -161,13 +161,8 @@ public class ClusterStatusPublisher extends ScheduledChore {
// hbase:meta server name.
ClusterStatus cs = new ClusterStatus(VersionInfo.getVersion(),
master.getMasterFileSystem().getClusterId().toString(),
null,
sns,
master.getServerName(),
null,
null,
null,
null);
master.getServerName());
publisher.publish(cs);

View File

@ -683,7 +683,18 @@ public class SnapshotManager extends MasterProcedureManager implements Stoppable
/**
* Restore the specified snapshot
* @param reqSnapshot
* @param reqSnapshot the snapshot to restore
* @throws IOException
*/
@Deprecated
public void restoreSnapshot(SnapshotDescription reqSnapshot) throws IOException {
restoreSnapshot(reqSnapshot, false);
}
/**
* Restore the specified snapshot
* @param reqSnapshot the snapshot to restore
* @param restoreAcl whether or not to restore ACLs on the snapshot
* @throws IOException
*/
public void restoreSnapshot(SnapshotDescription reqSnapshot, boolean restoreAcl)