HBASE-876 There are a large number of Java warnings in HBase
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@736569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d6f7713582
commit
b634e6a3cb
|
@ -18,7 +18,8 @@ Release 0.20.0 - Unreleased
|
||||||
HBASE-1130 PrefixRowFilter (Michael Gottesman via Stack)
|
HBASE-1130 PrefixRowFilter (Michael Gottesman via Stack)
|
||||||
HBASE-1139 Update Clover in build.xml
|
HBASE-1139 Update Clover in build.xml
|
||||||
HBASE-876 There are a large number of Java warnings in HBase; part 1,
|
HBASE-876 There are a large number of Java warnings in HBase; part 1,
|
||||||
part 2, and part 3 (Evgeny Ryabitskiy via Stack)
|
part 2, part 3, part 4, part 5, part 6, part 7 and part 8
|
||||||
|
(Evgeny Ryabitskiy via Stack)
|
||||||
HBASE-896 Update jruby from 1.1.2 to 1.1.6
|
HBASE-896 Update jruby from 1.1.2 to 1.1.6
|
||||||
HBASE-1031 Add the Zookeeper jar
|
HBASE-1031 Add the Zookeeper jar
|
||||||
HBASE-1142 Cleanup thrift server; remove Text and profuse DEBUG messaging
|
HBASE-1142 Cleanup thrift server; remove Text and profuse DEBUG messaging
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.ipc.Server;
|
|
||||||
import org.apache.hadoop.metrics.MetricsContext;
|
import org.apache.hadoop.metrics.MetricsContext;
|
||||||
import org.apache.hadoop.metrics.MetricsRecord;
|
import org.apache.hadoop.metrics.MetricsRecord;
|
||||||
import org.apache.hadoop.metrics.MetricsUtil;
|
import org.apache.hadoop.metrics.MetricsUtil;
|
||||||
|
@ -83,9 +82,9 @@ public class HBaseRpcMetrics implements Updater {
|
||||||
|
|
||||||
synchronized (metricsList) {
|
synchronized (metricsList) {
|
||||||
// Iterate through the rpcMetrics hashmap to propogate the different rpc metrics.
|
// Iterate through the rpcMetrics hashmap to propogate the different rpc metrics.
|
||||||
Set keys = metricsList.keySet();
|
Set<String> keys = metricsList.keySet();
|
||||||
|
|
||||||
Iterator keyIter = keys.iterator();
|
Iterator<String> keyIter = keys.iterator();
|
||||||
|
|
||||||
while (keyIter.hasNext()) {
|
while (keyIter.hasNext()) {
|
||||||
Object key = keyIter.next();
|
Object key = keyIter.next();
|
||||||
|
|
|
@ -87,9 +87,9 @@ implements TableMap<ImmutableBytesWritable,RowResult> {
|
||||||
* Pass the new key and value to reduce.
|
* Pass the new key and value to reduce.
|
||||||
* If any of the grouping columns are not found in the value, the record is skipped.
|
* If any of the grouping columns are not found in the value, the record is skipped.
|
||||||
*/
|
*/
|
||||||
public void map(@SuppressWarnings("unused") ImmutableBytesWritable key,
|
public void map(ImmutableBytesWritable key, RowResult value,
|
||||||
RowResult value, OutputCollector<ImmutableBytesWritable,RowResult> output,
|
OutputCollector<ImmutableBytesWritable,RowResult> output,
|
||||||
@SuppressWarnings("unused") Reporter reporter) throws IOException {
|
Reporter reporter) throws IOException {
|
||||||
|
|
||||||
byte[][] keyVals = extractKeyValues(value);
|
byte[][] keyVals = extractKeyValues(value);
|
||||||
if(keyVals != null) {
|
if(keyVals != null) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ implements Partitioner<ImmutableBytesWritable, V2> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPartition(ImmutableBytesWritable key,
|
public int getPartition(ImmutableBytesWritable key,
|
||||||
@SuppressWarnings("unused") V2 value, int numPartitions) {
|
V2 value, int numPartitions) {
|
||||||
byte[] region = null;
|
byte[] region = null;
|
||||||
// Only one region return 0
|
// Only one region return 0
|
||||||
if (this.startKeys.length == 1){
|
if (this.startKeys.length == 1){
|
||||||
|
|
|
@ -62,7 +62,7 @@ implements TableMap<ImmutableBytesWritable, RowResult> {
|
||||||
*/
|
*/
|
||||||
public void map(ImmutableBytesWritable key, RowResult value,
|
public void map(ImmutableBytesWritable key, RowResult value,
|
||||||
OutputCollector<ImmutableBytesWritable,RowResult> output,
|
OutputCollector<ImmutableBytesWritable,RowResult> output,
|
||||||
@SuppressWarnings("unused") Reporter reporter) throws IOException {
|
Reporter reporter) throws IOException {
|
||||||
|
|
||||||
// convert
|
// convert
|
||||||
output.collect(key, value);
|
output.collect(key, value);
|
||||||
|
|
|
@ -45,7 +45,7 @@ implements TableReduce<ImmutableBytesWritable, BatchUpdate> {
|
||||||
*/
|
*/
|
||||||
public void reduce(ImmutableBytesWritable key, Iterator<BatchUpdate> values,
|
public void reduce(ImmutableBytesWritable key, Iterator<BatchUpdate> values,
|
||||||
OutputCollector<ImmutableBytesWritable, BatchUpdate> output,
|
OutputCollector<ImmutableBytesWritable, BatchUpdate> output,
|
||||||
@SuppressWarnings("unused") Reporter reporter)
|
Reporter reporter)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
while(values.hasNext()) {
|
while(values.hasNext()) {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.apache.hadoop.hbase.mapred;
|
package org.apache.hadoop.hbase.mapred;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -75,6 +74,9 @@ public class IndexConfiguration extends Configuration {
|
||||||
static final String HBASE_INDEX_OPTIMIZE = "hbase.index.optimize";
|
static final String HBASE_INDEX_OPTIMIZE = "hbase.index.optimize";
|
||||||
|
|
||||||
public static class ColumnConf extends Properties {
|
public static class ColumnConf extends Properties {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7419012290580607821L;
|
||||||
|
|
||||||
boolean getBoolean(String name, boolean defaultValue) {
|
boolean getBoolean(String name, boolean defaultValue) {
|
||||||
String valueString = getProperty(name);
|
String valueString = getProperty(name);
|
||||||
if ("true".equals(valueString))
|
if ("true".equals(valueString))
|
||||||
|
@ -330,7 +332,7 @@ public class IndexConfiguration extends Configuration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(OutputStream out) throws IOException {
|
public void write(OutputStream out) {
|
||||||
try {
|
try {
|
||||||
Document doc = writeDocument();
|
Document doc = writeDocument();
|
||||||
DOMSource source = new DOMSource(doc);
|
DOMSource source = new DOMSource(doc);
|
||||||
|
@ -402,6 +404,7 @@ public class IndexConfiguration extends Configuration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class IndexOutputFormat extends
|
||||||
boolean closed;
|
boolean closed;
|
||||||
private long docCount = 0;
|
private long docCount = 0;
|
||||||
|
|
||||||
public void write(@SuppressWarnings("unused") ImmutableBytesWritable key,
|
public void write(ImmutableBytesWritable key,
|
||||||
LuceneDocumentWrapper value)
|
LuceneDocumentWrapper value)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// unwrap and index doc
|
// unwrap and index doc
|
||||||
Document doc = value.get();
|
Document doc = value.get();
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class IndexTableReduce extends MapReduceBase implements
|
||||||
|
|
||||||
public void reduce(ImmutableBytesWritable key, Iterator<RowResult> values,
|
public void reduce(ImmutableBytesWritable key, Iterator<RowResult> values,
|
||||||
OutputCollector<ImmutableBytesWritable, LuceneDocumentWrapper> output,
|
OutputCollector<ImmutableBytesWritable, LuceneDocumentWrapper> output,
|
||||||
@SuppressWarnings("unused") Reporter reporter)
|
Reporter reporter)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (!values.hasNext()) {
|
if (!values.hasNext()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.mapred;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException; //TODO: remove
|
|
||||||
|
|
||||||
import org.apache.hadoop.io.Writable;
|
import org.apache.hadoop.io.Writable;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
|
|
||||||
|
@ -47,11 +45,11 @@ class LuceneDocumentWrapper implements Writable {
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFields(@SuppressWarnings("unused") DataInput in) {
|
public void readFields(DataInput in) {
|
||||||
// intentionally left blank
|
// intentionally left blank
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(@SuppressWarnings("unused") DataOutput out) {
|
public void write(DataOutput out) {
|
||||||
// intentionally left blank
|
// intentionally left blank
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ implements TableMap<ImmutableBytesWritable, RowResult>, Tool {
|
||||||
|
|
||||||
public void map(ImmutableBytesWritable row, RowResult value,
|
public void map(ImmutableBytesWritable row, RowResult value,
|
||||||
OutputCollector<ImmutableBytesWritable, RowResult> output,
|
OutputCollector<ImmutableBytesWritable, RowResult> output,
|
||||||
@SuppressWarnings("unused") Reporter reporter)
|
Reporter reporter)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean content = false;
|
boolean content = false;
|
||||||
for (Map.Entry<byte [], Cell> e: value.entrySet()) {
|
for (Map.Entry<byte [], Cell> e: value.entrySet()) {
|
||||||
|
@ -82,7 +82,7 @@ implements TableMap<ImmutableBytesWritable, RowResult>, Tool {
|
||||||
* @return the JobConf
|
* @return the JobConf
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused", "deprecation" })
|
@SuppressWarnings("unused")
|
||||||
public JobConf createSubmittableJob(String[] args) throws IOException {
|
public JobConf createSubmittableJob(String[] args) throws IOException {
|
||||||
JobConf c = new JobConf(getConf(), RowCounter.class);
|
JobConf c = new JobConf(getConf(), RowCounter.class);
|
||||||
c.setJobName(NAME);
|
c.setJobName(NAME);
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.hadoop.mapred.JobConfigurable;
|
||||||
*/
|
*/
|
||||||
public class TableInputFormat extends TableInputFormatBase implements
|
public class TableInputFormat extends TableInputFormatBase implements
|
||||||
JobConfigurable {
|
JobConfigurable {
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
private final Log LOG = LogFactory.getLog(TableInputFormat.class);
|
private final Log LOG = LogFactory.getLog(TableInputFormat.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +63,6 @@ public class TableInputFormat extends TableInputFormatBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void validateInput(JobConf job) throws IOException {
|
public void validateInput(JobConf job) throws IOException {
|
||||||
// expecting exactly one path
|
// expecting exactly one path
|
||||||
Path [] tableNames = FileInputFormat.getInputPaths(job);
|
Path [] tableNames = FileInputFormat.getInputPaths(job);
|
||||||
|
|
|
@ -34,9 +34,7 @@ import org.apache.hadoop.hbase.filter.RowFilterSet;
|
||||||
import org.apache.hadoop.hbase.filter.StopRowFilter;
|
import org.apache.hadoop.hbase.filter.StopRowFilter;
|
||||||
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
||||||
import org.apache.hadoop.hbase.io.RowResult;
|
import org.apache.hadoop.hbase.io.RowResult;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegion;
|
|
||||||
import org.apache.hadoop.hbase.util.Writables;
|
import org.apache.hadoop.hbase.util.Writables;
|
||||||
import org.apache.hadoop.io.Text;
|
|
||||||
import org.apache.hadoop.mapred.InputFormat;
|
import org.apache.hadoop.mapred.InputFormat;
|
||||||
import org.apache.hadoop.mapred.InputSplit;
|
import org.apache.hadoop.mapred.InputSplit;
|
||||||
import org.apache.hadoop.mapred.JobConf;
|
import org.apache.hadoop.mapred.JobConf;
|
||||||
|
@ -74,7 +72,7 @@ import org.apache.hadoop.util.StringUtils;
|
||||||
*/
|
*/
|
||||||
public abstract class TableInputFormatBase
|
public abstract class TableInputFormatBase
|
||||||
implements InputFormat<ImmutableBytesWritable, RowResult> {
|
implements InputFormat<ImmutableBytesWritable, RowResult> {
|
||||||
private final Log LOG = LogFactory.getLog(TableInputFormatBase.class);
|
final Log LOG = LogFactory.getLog(TableInputFormatBase.class);
|
||||||
private byte [][] inputColumns;
|
private byte [][] inputColumns;
|
||||||
private HTable table;
|
private HTable table;
|
||||||
private TableRecordReader tableRecordReader;
|
private TableRecordReader tableRecordReader;
|
||||||
|
@ -203,7 +201,6 @@ implements InputFormat<ImmutableBytesWritable, RowResult> {
|
||||||
* @return true if there was more data
|
* @return true if there was more data
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public boolean next(ImmutableBytesWritable key, RowResult value)
|
public boolean next(ImmutableBytesWritable key, RowResult value)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
RowResult result;
|
RowResult result;
|
||||||
|
@ -215,13 +212,14 @@ implements InputFormat<ImmutableBytesWritable, RowResult> {
|
||||||
this.scanner.next(); // skip presumed already mapped row
|
this.scanner.next(); // skip presumed already mapped row
|
||||||
result = this.scanner.next();
|
result = this.scanner.next();
|
||||||
}
|
}
|
||||||
boolean hasMore = result != null && result.size() > 0;
|
|
||||||
if (hasMore) {
|
if (result != null && result.size() > 0) {
|
||||||
key.set(result.getRow());
|
key.set(result.getRow());
|
||||||
lastRow = key.get();
|
lastRow = key.get();
|
||||||
Writables.copyWritable(result, value);
|
Writables.copyWritable(result, value);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return hasMore;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,10 +230,8 @@ implements InputFormat<ImmutableBytesWritable, RowResult> {
|
||||||
* @see org.apache.hadoop.mapred.InputFormat#getRecordReader(InputSplit,
|
* @see org.apache.hadoop.mapred.InputFormat#getRecordReader(InputSplit,
|
||||||
* JobConf, Reporter)
|
* JobConf, Reporter)
|
||||||
*/
|
*/
|
||||||
public RecordReader<ImmutableBytesWritable, RowResult> getRecordReader(InputSplit split,
|
public RecordReader<ImmutableBytesWritable, RowResult> getRecordReader(
|
||||||
@SuppressWarnings("unused")
|
InputSplit split, JobConf job, Reporter reporter)
|
||||||
JobConf job, @SuppressWarnings("unused")
|
|
||||||
Reporter reporter)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
TableSplit tSplit = (TableSplit) split;
|
TableSplit tSplit = (TableSplit) split;
|
||||||
TableRecordReader trr = this.tableRecordReader;
|
TableRecordReader trr = this.tableRecordReader;
|
||||||
|
|
|
@ -32,8 +32,7 @@ import org.apache.hadoop.mapred.Mapper;
|
||||||
* @param <K> WritableComparable key class
|
* @param <K> WritableComparable key class
|
||||||
* @param <V> Writable value class
|
* @param <V> Writable value class
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
public interface TableMap<K extends WritableComparable<K>, V extends Writable>
|
||||||
public interface TableMap<K extends WritableComparable, V extends Writable>
|
|
||||||
extends Mapper<ImmutableBytesWritable, RowResult, K, V> {
|
extends Mapper<ImmutableBytesWritable, RowResult, K, V> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,12 +63,12 @@ FileOutputFormat<ImmutableBytesWritable, BatchUpdate> {
|
||||||
m_table = table;
|
m_table = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(@SuppressWarnings("unused") Reporter reporter)
|
public void close(Reporter reporter)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
m_table.flushCommits();
|
m_table.flushCommits();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(@SuppressWarnings("unused") ImmutableBytesWritable key,
|
public void write(ImmutableBytesWritable key,
|
||||||
BatchUpdate value) throws IOException {
|
BatchUpdate value) throws IOException {
|
||||||
m_table.commit(new BatchUpdate(value));
|
m_table.commit(new BatchUpdate(value));
|
||||||
}
|
}
|
||||||
|
@ -76,11 +76,8 @@ FileOutputFormat<ImmutableBytesWritable, BatchUpdate> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public RecordWriter getRecordWriter(
|
public RecordWriter getRecordWriter(FileSystem ignored,
|
||||||
@SuppressWarnings("unused") FileSystem ignored,
|
JobConf job, String name, Progressable progress) throws IOException {
|
||||||
JobConf job,
|
|
||||||
@SuppressWarnings("unused") String name,
|
|
||||||
@SuppressWarnings("unused") Progressable progress) throws IOException {
|
|
||||||
|
|
||||||
// expecting exactly one path
|
// expecting exactly one path
|
||||||
|
|
||||||
|
@ -97,7 +94,6 @@ FileOutputFormat<ImmutableBytesWritable, BatchUpdate> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void checkOutputSpecs(FileSystem ignored, JobConf job)
|
public void checkOutputSpecs(FileSystem ignored, JobConf job)
|
||||||
throws FileAlreadyExistsException, InvalidJobConfException, IOException {
|
throws FileAlreadyExistsException, InvalidJobConfException, IOException {
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.hadoop.mapred.InputSplit;
|
||||||
/**
|
/**
|
||||||
* A table split corresponds to a key range [low, high)
|
* A table split corresponds to a key range [low, high)
|
||||||
*/
|
*/
|
||||||
public class TableSplit implements InputSplit, Comparable {
|
public class TableSplit implements InputSplit, Comparable<TableSplit> {
|
||||||
private byte [] m_tableName;
|
private byte [] m_tableName;
|
||||||
private byte [] m_startRow;
|
private byte [] m_startRow;
|
||||||
private byte [] m_endRow;
|
private byte [] m_endRow;
|
||||||
|
@ -106,8 +106,7 @@ public class TableSplit implements InputSplit, Comparable {
|
||||||
Bytes.toString(m_startRow) + "," + Bytes.toString(m_endRow);
|
Bytes.toString(m_startRow) + "," + Bytes.toString(m_endRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Object arg) {
|
public int compareTo(TableSplit o) {
|
||||||
TableSplit other = (TableSplit)arg;
|
return Bytes.compareTo(getStartRow(), o.getStartRow());
|
||||||
return Bytes.compareTo(getStartRow(), other.getStartRow());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,18 +38,15 @@ abstract class ColumnOperation extends TableOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processScanItem(
|
protected void processScanItem(String serverName, long startCode,
|
||||||
@SuppressWarnings("unused") String serverName,
|
final HRegionInfo info) throws IOException {
|
||||||
@SuppressWarnings("unused") long startCode, final HRegionInfo info)
|
|
||||||
throws IOException {
|
|
||||||
if (isEnabled(info)) {
|
if (isEnabled(info)) {
|
||||||
throw new TableNotDisabledException(tableName);
|
throw new TableNotDisabledException(tableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateRegionInfo(HRegionInterface server, byte [] regionName,
|
protected void updateRegionInfo(HRegionInterface server, byte [] regionName,
|
||||||
HRegionInfo i)
|
HRegionInfo i) throws IOException {
|
||||||
throws IOException {
|
|
||||||
BatchUpdate b = new BatchUpdate(i.getRegionName());
|
BatchUpdate b = new BatchUpdate(i.getRegionName());
|
||||||
b.put(COL_REGIONINFO, Writables.getBytes(i));
|
b.put(COL_REGIONINFO, Writables.getBytes(i));
|
||||||
server.batchUpdate(regionName, b, -1L);
|
server.batchUpdate(regionName, b, -1L);
|
||||||
|
|
|
@ -94,8 +94,8 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
||||||
|
|
||||||
static final Log LOG = LogFactory.getLog(HMaster.class.getName());
|
static final Log LOG = LogFactory.getLog(HMaster.class.getName());
|
||||||
|
|
||||||
public long getProtocolVersion(@SuppressWarnings("unused") String protocol,
|
public long getProtocolVersion(String protocol,
|
||||||
@SuppressWarnings("unused") long clientVersion) {
|
long clientVersion) {
|
||||||
return HBaseRPCProtocolVersion.versionID;
|
return HBaseRPCProtocolVersion.versionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,8 @@ class ModifyTableMeta extends TableOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processScanItem(
|
protected void processScanItem(String serverName, long startCode,
|
||||||
@SuppressWarnings("unused") String serverName,
|
final HRegionInfo info) throws IOException {
|
||||||
@SuppressWarnings("unused") long startCode, final HRegionInfo info)
|
|
||||||
throws IOException {
|
|
||||||
if (isEnabled(info)) {
|
if (isEnabled(info)) {
|
||||||
throw new TableNotDisabledException(tableName.toString());
|
throw new TableNotDisabledException(tableName.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,9 @@ import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
/**
|
/**
|
||||||
* Thrown when an operation requires the root and all meta regions to be online
|
* Thrown when an operation requires the root and all meta regions to be online
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class NotAllMetaRegionsOnlineException extends DoNotRetryIOException {
|
public class NotAllMetaRegionsOnlineException extends DoNotRetryIOException {
|
||||||
|
private static final long serialVersionUID = 6439786157874827523L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor
|
* default constructor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,14 +28,13 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||||
class RootScanner extends BaseScanner {
|
class RootScanner extends BaseScanner {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
|
||||||
* @param master
|
* @param master
|
||||||
*/
|
*/
|
||||||
public RootScanner(HMaster master) {
|
public RootScanner(HMaster master) {
|
||||||
super(master, true, master.metaRescanInterval, master.closed);
|
super(master, true, master.metaRescanInterval, master.closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Don't retry if we get an error while scanning. Errors are most often
|
* Don't retry if we get an error while scanning. Errors are most often
|
||||||
*
|
*
|
||||||
* caused by the server going away. Wait until next rescan interval when
|
* caused by the server going away. Wait until next rescan interval when
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.hadoop.hbase.HRegionLocation;
|
||||||
* load numbers, dying servers, etc.
|
* load numbers, dying servers, etc.
|
||||||
*/
|
*/
|
||||||
class ServerManager implements HConstants {
|
class ServerManager implements HConstants {
|
||||||
private static final Log LOG =
|
static final Log LOG =
|
||||||
LogFactory.getLog(ServerManager.class.getName());
|
LogFactory.getLog(ServerManager.class.getName());
|
||||||
|
|
||||||
private final AtomicInteger quiescedServers = new AtomicInteger(0);
|
private final AtomicInteger quiescedServers = new AtomicInteger(0);
|
||||||
|
@ -101,7 +101,7 @@ class ServerManager implements HConstants {
|
||||||
getInt("hbase.regions.nobalancing.count", 4);
|
getInt("hbase.regions.nobalancing.count", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Look to see if we have ghost references to this regionserver such as
|
* Look to see if we have ghost references to this regionserver such as
|
||||||
* still-existing leases or if regionserver is on the dead servers list
|
* still-existing leases or if regionserver is on the dead servers list
|
||||||
* getting its logs processed.
|
* getting its logs processed.
|
||||||
|
@ -337,7 +337,8 @@ class ServerManager implements HConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RegionServer is checking in, no exceptional circumstances
|
/**
|
||||||
|
* RegionServer is checking in, no exceptional circumstances
|
||||||
* @param serverName
|
* @param serverName
|
||||||
* @param serverInfo
|
* @param serverInfo
|
||||||
* @param mostLoadedRegions
|
* @param mostLoadedRegions
|
||||||
|
@ -739,7 +740,6 @@ class ServerManager implements HConstants {
|
||||||
|
|
||||||
/** Instantiated to monitor the health of a region server */
|
/** Instantiated to monitor the health of a region server */
|
||||||
private class ServerExpirer implements LeaseListener {
|
private class ServerExpirer implements LeaseListener {
|
||||||
@SuppressWarnings("hiding")
|
|
||||||
private String server;
|
private String server;
|
||||||
|
|
||||||
ServerExpirer(String server) {
|
ServerExpirer(String server) {
|
||||||
|
|
|
@ -41,10 +41,8 @@ class TableDelete extends TableOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void processScanItem(
|
protected void processScanItem(String serverName,
|
||||||
@SuppressWarnings("unused") String serverName,
|
long startCode, final HRegionInfo info) throws IOException {
|
||||||
@SuppressWarnings("unused") long startCode,
|
|
||||||
final HRegionInfo info) throws IOException {
|
|
||||||
|
|
||||||
if (isEnabled(info)) {
|
if (isEnabled(info)) {
|
||||||
throw new TableNotDisabledException(tableName);
|
throw new TableNotDisabledException(tableName);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MasterMetrics implements Updater {
|
||||||
* Since this object is a registered updater, this method will be called
|
* Since this object is a registered updater, this method will be called
|
||||||
* periodically, e.g. every 5 seconds.
|
* periodically, e.g. every 5 seconds.
|
||||||
*/
|
*/
|
||||||
public void doUpdates(@SuppressWarnings("unused") MetricsContext unused) {
|
public void doUpdates(MetricsContext unused) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
synchronized(this.cluster_requests) {
|
synchronized(this.cluster_requests) {
|
||||||
this.cluster_requests.pushMetric(metricsRecord);
|
this.cluster_requests.pushMetric(metricsRecord);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class TimeStampingFileContext extends FileContext {
|
||||||
this.sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
this.sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init(String contextName, ContextFactory factory) {
|
public void init(String contextName, ContextFactory factory) {
|
||||||
super.init(contextName, factory);
|
super.init(contextName, factory);
|
||||||
String fileName = getAttribute(FILE_NAME_PROPERTY);
|
String fileName = getAttribute(FILE_NAME_PROPERTY);
|
||||||
|
@ -54,6 +55,7 @@ public class TimeStampingFileContext extends FileContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startMonitoring() throws IOException {
|
public void startMonitoring() throws IOException {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
writer = new PrintWriter(new BufferedOutputStream(System.out));
|
writer = new PrintWriter(new BufferedOutputStream(System.out));
|
||||||
|
@ -63,6 +65,7 @@ public class TimeStampingFileContext extends FileContext {
|
||||||
super.startMonitoring();
|
super.startMonitoring();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stopMonitoring() {
|
public void stopMonitoring() {
|
||||||
super.stopMonitoring();
|
super.stopMonitoring();
|
||||||
if (writer != null) {
|
if (writer != null) {
|
||||||
|
@ -75,6 +78,7 @@ public class TimeStampingFileContext extends FileContext {
|
||||||
return this.sdf.format(new Date());
|
return this.sdf.format(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void emitRecord(String contextName, String recordName,
|
public void emitRecord(String contextName, String recordName,
|
||||||
OutputRecord outRec) {
|
OutputRecord outRec) {
|
||||||
writer.print(iso8601());
|
writer.print(iso8601());
|
||||||
|
@ -100,6 +104,7 @@ public class TimeStampingFileContext extends FileContext {
|
||||||
writer.println();
|
writer.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void flush() {
|
public void flush() {
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.util.FSUtils;
|
import org.apache.hadoop.hbase.util.FSUtils;
|
||||||
import org.apache.hadoop.io.SequenceFile;
|
import org.apache.hadoop.io.SequenceFile;
|
||||||
import org.apache.hadoop.io.Text;
|
|
||||||
import org.apache.hadoop.io.SequenceFile.CompressionType;
|
import org.apache.hadoop.io.SequenceFile.CompressionType;
|
||||||
import org.apache.hadoop.io.SequenceFile.Metadata;
|
import org.apache.hadoop.io.SequenceFile.Metadata;
|
||||||
import org.apache.hadoop.io.SequenceFile.Reader;
|
import org.apache.hadoop.io.SequenceFile.Reader;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.io.*;
|
||||||
*
|
*
|
||||||
* Some Transactional edits (START, COMMIT, ABORT) will not have an associated row.
|
* Some Transactional edits (START, COMMIT, ABORT) will not have an associated row.
|
||||||
*/
|
*/
|
||||||
public class HLogKey implements WritableComparable {
|
public class HLogKey implements WritableComparable<HLogKey> {
|
||||||
private byte [] regionName;
|
private byte [] regionName;
|
||||||
private byte [] tablename;
|
private byte [] tablename;
|
||||||
private byte [] row;
|
private byte [] row;
|
||||||
|
@ -94,7 +94,7 @@ public class HLogKey implements WritableComparable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return compareTo(obj) == 0;
|
return compareTo((HLogKey)obj) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,19 +109,18 @@ public class HLogKey implements WritableComparable {
|
||||||
// Comparable
|
// Comparable
|
||||||
//
|
//
|
||||||
|
|
||||||
public int compareTo(Object o) {
|
public int compareTo(HLogKey o) {
|
||||||
HLogKey other = (HLogKey) o;
|
int result = Bytes.compareTo(this.regionName, o.regionName);
|
||||||
int result = Bytes.compareTo(this.regionName, other.regionName);
|
|
||||||
|
|
||||||
if(result == 0) {
|
if(result == 0) {
|
||||||
result = Bytes.compareTo(this.row, other.row);
|
result = Bytes.compareTo(this.row, o.row);
|
||||||
|
|
||||||
if(result == 0) {
|
if(result == 0) {
|
||||||
|
|
||||||
if (this.logSeqNum < other.logSeqNum) {
|
if (this.logSeqNum < o.logSeqNum) {
|
||||||
result = -1;
|
result = -1;
|
||||||
|
|
||||||
} else if (this.logSeqNum > other.logSeqNum) {
|
} else if (this.logSeqNum > o.logSeqNum) {
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1588,8 +1588,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchUpdate(final byte [] regionName, BatchUpdate b,
|
public void batchUpdate(final byte [] regionName, BatchUpdate b,
|
||||||
@SuppressWarnings("unused") long lockId)
|
long lockId) throws IOException {
|
||||||
throws IOException {
|
|
||||||
if (b.getRow() == null)
|
if (b.getRow() == null)
|
||||||
throw new IllegalArgumentException("update has null row");
|
throw new IllegalArgumentException("update has null row");
|
||||||
|
|
||||||
|
@ -2132,7 +2131,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getProtocolVersion(final String protocol,
|
public long getProtocolVersion(final String protocol,
|
||||||
@SuppressWarnings("unused") final long clientVersion)
|
final long clientVersion)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (protocol.equals(HRegionInterface.class.getName())) {
|
if (protocol.equals(HRegionInterface.class.getName())) {
|
||||||
return HBaseRPCProtocolVersion.versionID;
|
return HBaseRPCProtocolVersion.versionID;
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class LogFlusher extends Chore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void chore() {
|
protected void chore() {
|
||||||
synchronized (log) {
|
synchronized (log) {
|
||||||
HLog hlog = log.get();
|
HLog hlog = log.get();
|
||||||
|
|
|
@ -258,7 +258,6 @@ class Memcache {
|
||||||
* @param b
|
* @param b
|
||||||
* @return Return lowest of a or b or null if both a and b are null
|
* @return Return lowest of a or b or null if both a and b are null
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private byte [] getLowest(final byte [] a,
|
private byte [] getLowest(final byte [] a,
|
||||||
final byte [] b) {
|
final byte [] b) {
|
||||||
if (a == null) {
|
if (a == null) {
|
||||||
|
|
|
@ -24,8 +24,9 @@ import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
/**
|
/**
|
||||||
* Thrown if request for nonexistent column family.
|
* Thrown if request for nonexistent column family.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class NoSuchColumnFamilyException extends DoNotRetryIOException {
|
public class NoSuchColumnFamilyException extends DoNotRetryIOException {
|
||||||
|
private static final long serialVersionUID = -6569952730832331274L;
|
||||||
|
|
||||||
/** default constructor */
|
/** default constructor */
|
||||||
public NoSuchColumnFamilyException() {
|
public NoSuchColumnFamilyException() {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package org.apache.hadoop.hbase.regionserver.metrics;
|
package org.apache.hadoop.hbase.regionserver.metrics;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.MemoryMXBean;
|
|
||||||
import java.lang.management.MemoryUsage;
|
import java.lang.management.MemoryUsage;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -96,7 +95,7 @@ public class RegionServerMetrics implements Updater {
|
||||||
* Since this object is a registered updater, this method will be called
|
* Since this object is a registered updater, this method will be called
|
||||||
* periodically, e.g. every 5 seconds.
|
* periodically, e.g. every 5 seconds.
|
||||||
*/
|
*/
|
||||||
public void doUpdates(@SuppressWarnings("unused") MetricsContext unused) {
|
public void doUpdates(MetricsContext unused) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
this.stores.pushMetric(this.metricsRecord);
|
this.stores.pushMetric(this.metricsRecord);
|
||||||
this.storefiles.pushMetric(this.metricsRecord);
|
this.storefiles.pushMetric(this.metricsRecord);
|
||||||
|
|
|
@ -27,8 +27,6 @@ import org.apache.hadoop.hbase.HServerAddress;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.ipc.IndexedRegionInterface;
|
import org.apache.hadoop.hbase.ipc.IndexedRegionInterface;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegion;
|
import org.apache.hadoop.hbase.regionserver.HRegion;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
|
||||||
import org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion;
|
|
||||||
import org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegionServer;
|
import org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegionServer;
|
||||||
import org.apache.hadoop.util.Progressable;
|
import org.apache.hadoop.util.Progressable;
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@ import org.apache.hadoop.util.Progressable;
|
||||||
/**
|
/**
|
||||||
* Responsible for writing and reading (recovering) transactional information
|
* Responsible for writing and reading (recovering) transactional information
|
||||||
* to/from the HLog.
|
* to/from the HLog.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class TransactionalHLogManager {
|
class TransactionalHLogManager {
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class TransactionalRegion extends HRegion {
|
||||||
private static final int DEFAULT_OLD_TRANSACTION_FLUSH = 100; // Do a flush if we have this many old transactions..
|
private static final int DEFAULT_OLD_TRANSACTION_FLUSH = 100; // Do a flush if we have this many old transactions..
|
||||||
|
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(TransactionalRegion.class);
|
static final Log LOG = LogFactory.getLog(TransactionalRegion.class);
|
||||||
|
|
||||||
// Collection of active transactions (PENDING) keyed by id.
|
// Collection of active transactions (PENDING) keyed by id.
|
||||||
private Map<String, TransactionState> transactionsById = new HashMap<String, TransactionState>();
|
private Map<String, TransactionState> transactionsById = new HashMap<String, TransactionState>();
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.nio.ByteBuffer;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
|
||||||
import org.apache.hadoop.io.WritableComparator;
|
import org.apache.hadoop.io.WritableComparator;
|
||||||
import org.apache.hadoop.io.WritableUtils;
|
import org.apache.hadoop.io.WritableUtils;
|
||||||
|
|
||||||
|
@ -239,9 +238,7 @@ public class Bytes {
|
||||||
*/
|
*/
|
||||||
public static boolean equals(final byte [] left, final byte [] right) {
|
public static boolean equals(final byte [] left, final byte [] right) {
|
||||||
return left == null && right == null? true:
|
return left == null && right == null? true:
|
||||||
left == null && right != null? false:
|
(left == null || right == null || (left.length != right.length))? false:
|
||||||
left != null && right == null? false:
|
|
||||||
left.length != right.length? false:
|
|
||||||
compareTo(left, right) == 0;
|
compareTo(left, right) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class JenkinsHash extends Hash {
|
||||||
* <p>Use for hash table lookup, or anything where one collision in 2^^32 is
|
* <p>Use for hash table lookup, or anything where one collision in 2^^32 is
|
||||||
* acceptable. Do NOT use for cryptographic purposes.
|
* acceptable. Do NOT use for cryptographic purposes.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SuppressWarnings("fallthrough")
|
@SuppressWarnings("fallthrough")
|
||||||
public int hash(byte[] key, int nbytes, int initval) {
|
public int hash(byte[] key, int nbytes, int initval) {
|
||||||
int length = nbytes;
|
int length = nbytes;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
package org.apache.hadoop.hbase.util;
|
package org.apache.hadoop.hbase.util;
|
||||||
|
|
||||||
import java.io.FileNotFoundException; //TODO: remove
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -430,7 +429,6 @@ public class MetaUtils {
|
||||||
scanRootRegion(new ScannerListener() {
|
scanRootRegion(new ScannerListener() {
|
||||||
private final Log SL_LOG = LogFactory.getLog(this.getClass());
|
private final Log SL_LOG = LogFactory.getLog(this.getClass());
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public boolean processRow(HRegionInfo info) throws IOException {
|
public boolean processRow(HRegionInfo info) throws IOException {
|
||||||
SL_LOG.debug("Testing " + info);
|
SL_LOG.debug("Testing " + info);
|
||||||
if (Bytes.equals(info.getTableDesc().getName(),
|
if (Bytes.equals(info.getTableDesc().getName(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class MurmurHash extends Hash {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hash(byte[] data, int length, int seed) {
|
public int hash(byte[] data, int length, int seed) {
|
||||||
int m = 0x5bd1e995;
|
int m = 0x5bd1e995;
|
||||||
int r = 24;
|
int r = 24;
|
||||||
|
@ -62,13 +63,13 @@ public class MurmurHash extends Hash {
|
||||||
|
|
||||||
if (left != 0) {
|
if (left != 0) {
|
||||||
if (left >= 3) {
|
if (left >= 3) {
|
||||||
h ^= (int) data[length - 3] << 16;
|
h ^= data[length - 3] << 16;
|
||||||
}
|
}
|
||||||
if (left >= 2) {
|
if (left >= 2) {
|
||||||
h ^= (int) data[length - 2] << 8;
|
h ^= data[length - 2] << 8;
|
||||||
}
|
}
|
||||||
if (left >= 1) {
|
if (left >= 1) {
|
||||||
h ^= (int) data[length - 1];
|
h ^= data[length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
h *= m;
|
h *= m;
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class Pair<T1, T2> implements Serializable
|
||||||
return (x == null && y == null) || (x != null && x.equals(y));
|
return (x == null && y == null) || (x != null && x.equals(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public boolean equals(Object other)
|
public boolean equals(Object other)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +76,7 @@ public class Pair<T1, T2> implements Serializable
|
||||||
equals(second, ((Pair)other).second);
|
equals(second, ((Pair)other).second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
if (first == null)
|
if (first == null)
|
||||||
|
@ -85,6 +87,7 @@ public class Pair<T1, T2> implements Serializable
|
||||||
return first.hashCode() * 17 + second.hashCode();
|
return first.hashCode() * 17 + second.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "{" + getFirst() + "," + getSecond() + "}";
|
return "{" + getFirst() + "," + getSecond() + "}";
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SoftValue<K, V> extends SoftReference<V> implements Map.Entry<K, V> {
|
||||||
return get();
|
return get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public V setValue(@SuppressWarnings("unused") V value) {
|
public V setValue(V value) {
|
||||||
throw new RuntimeException("Not implemented");
|
throw new RuntimeException("Not implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,7 +68,7 @@ public class SoftValueMap<K,V> implements Map<K,V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void putAll(@SuppressWarnings("unused") Map map) {
|
public void putAll(Map map) {
|
||||||
throw new RuntimeException("Not implemented");
|
throw new RuntimeException("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class SoftValueMap<K,V> implements Map<K,V> {
|
||||||
return this.internalMap.containsKey(key);
|
return this.internalMap.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsValue(@SuppressWarnings("unused") Object value) {
|
public boolean containsValue(Object value) {
|
||||||
/* checkReferences();
|
/* checkReferences();
|
||||||
return internalMap.containsValue(value);*/
|
return internalMap.containsValue(value);*/
|
||||||
throw new UnsupportedOperationException("Don't support containsValue!");
|
throw new UnsupportedOperationException("Don't support containsValue!");
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void putAll(@SuppressWarnings("unused") Map map) {
|
public void putAll(Map map) {
|
||||||
throw new RuntimeException("Not implemented");
|
throw new RuntimeException("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
||||||
return this.internalMap.containsKey(key);
|
return this.internalMap.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsValue(@SuppressWarnings("unused") Object value) {
|
public boolean containsValue(Object value) {
|
||||||
/* checkReferences();
|
/* checkReferences();
|
||||||
return internalMap.containsValue(value);*/
|
return internalMap.containsValue(value);*/
|
||||||
throw new UnsupportedOperationException("Don't support containsValue!");
|
throw new UnsupportedOperationException("Don't support containsValue!");
|
||||||
|
|
|
@ -50,10 +50,8 @@ package org.onelab.filter;
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.util.Hash;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a <i>Bloom filter</i>, as defined by Bloom in 1970.
|
* Implements a <i>Bloom filter</i>, as defined by Bloom in 1970.
|
||||||
|
|
|
@ -50,9 +50,6 @@ package org.onelab.filter;
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays; //TODO: remove
|
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.util.Hash;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a <i>counting Bloom filter</i>, as defined by Fan et al. in a ToN
|
* Implements a <i>counting Bloom filter</i>, as defined by Fan et al. in a ToN
|
||||||
|
@ -228,9 +225,8 @@ public final class CountingBloomFilter extends Filter {
|
||||||
}
|
}
|
||||||
if (res != Integer.MAX_VALUE) {
|
if (res != Integer.MAX_VALUE) {
|
||||||
return res;
|
return res;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -257,7 +253,6 @@ public final class CountingBloomFilter extends Filter {
|
||||||
}//end or()
|
}//end or()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void xor(Filter filter){
|
public void xor(Filter filter){
|
||||||
throw new UnsupportedOperationException("xor() is undefined for "
|
throw new UnsupportedOperationException("xor() is undefined for "
|
||||||
+ this.getClass().getName());
|
+ this.getClass().getName());
|
||||||
|
@ -289,7 +284,7 @@ public final class CountingBloomFilter extends Filter {
|
||||||
CountingBloomFilter cbf = new CountingBloomFilter(vectorSize, nbHash, hashType);
|
CountingBloomFilter cbf = new CountingBloomFilter(vectorSize, nbHash, hashType);
|
||||||
cbf.buckets = this.buckets.clone();
|
cbf.buckets = this.buckets.clone();
|
||||||
return cbf;
|
return cbf;
|
||||||
}//end clone()
|
}
|
||||||
|
|
||||||
// Writable
|
// Writable
|
||||||
|
|
||||||
|
@ -311,4 +306,4 @@ public final class CountingBloomFilter extends Filter {
|
||||||
buckets[i] = in.readLong();
|
buckets[i] = in.readLong();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end class
|
}
|
|
@ -51,8 +51,6 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.util.Hash;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a <i>dynamic Bloom filter</i>, as defined in the INFOCOM 2006 paper.
|
* Implements a <i>dynamic Bloom filter</i>, as defined in the INFOCOM 2006 paper.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.apache.hadoop.io.WritableComparable;
|
||||||
*
|
*
|
||||||
* @see org.onelab.filter.Filter The general behavior of a filter
|
* @see org.onelab.filter.Filter The general behavior of a filter
|
||||||
*/
|
*/
|
||||||
public class Key implements WritableComparable {
|
public class Key implements WritableComparable<Key> {
|
||||||
/** Byte value of key */
|
/** Byte value of key */
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public class Key implements WritableComparable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
return this.compareTo(o) == 0;
|
return this.compareTo((Key)o) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -160,16 +160,14 @@ public class Key implements WritableComparable {
|
||||||
|
|
||||||
// Comparable
|
// Comparable
|
||||||
|
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Key o) {
|
||||||
Key other = (Key)o;
|
int result = this.bytes.length - o.getBytes().length;
|
||||||
|
|
||||||
int result = this.bytes.length - other.getBytes().length;
|
|
||||||
for(int i = 0; result == 0 && i < bytes.length; i++) {
|
for(int i = 0; result == 0 && i < bytes.length; i++) {
|
||||||
result = this.bytes[i] - other.bytes[i];
|
result = this.bytes[i] - o.bytes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result == 0) {
|
if(result == 0) {
|
||||||
result = Double.valueOf(this.weight - other.weight).intValue();
|
result = Double.valueOf(this.weight - o.weight).intValue();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.util.Hash;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a <i>retouched Bloom filter</i>, as defined in the CoNEXT 2006 paper.
|
* Implements a <i>retouched Bloom filter</i>, as defined in the CoNEXT 2006 paper.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
Loading…
Reference in New Issue