Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

[EAGLE-985] Upgrade hbase dependency to 1.2.5 #902

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -117,7 +118,7 @@ public void shutdown() {

public void createTable(String tableName, String cf) {
try {
util.createTable(tableName, cf);
util.createTable(TableName.valueOf(tableName), cf);
} catch (IOException ex) {
LOG.warn("Create table failed, probably table already existed, table name: " + tableName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import org.junit.Test;

import java.io.IOException;
import org.apache.hadoop.hbase.TableName;

public class EmbeddedHbaseTest extends TestHBaseBase {
@Test
public void testHBaseCreateTable() throws IOException {
hbase.createTable("test_hbase_table","f");
hbase.createTable(TableName.valueOf("test_hbase_table"),"f");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.filter.Filter.ReturnCode;
import org.apache.hadoop.io.WritableComparable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -119,9 +122,15 @@ public boolean hasFilterRow(){
}

@Override
public void filterRow(List<KeyValue> row) {
filterOutRow = (this.comparator.compareTo(row) == 0);
public void filterRowCells(List<Cell> lst) {
filterOutRow = (this.comparator.compareTo(KeyValueUtil.ensureKeyValues(lst)) == 0);
}
@Override
public ReturnCode filterKeyValue(Cell v) {
if (filterOutRow) return ReturnCode.NEXT_ROW;
return ReturnCode.INCLUDE;
}


@Override
public void reset() {
Expand All @@ -141,4 +150,4 @@ public String toString() {
// public List<byte[]> getQualifiers() {
// return qualifiers;
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.eagle.log.entity.test.TestLogAPIEntity;
import org.apache.eagle.query.parser.EagleQueryParser;
import org.apache.eagle.service.hbase.TestHBaseBase;
import org.apache.hadoop.hbase.TableName;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -39,7 +40,7 @@ public class TestGenericEntityIndexStreamReader extends TestHBaseBase {
@BeforeClass
public static void createTable() throws IOException, IllegalAccessException, InstantiationException {
EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
import org.apache.eagle.log.entity.test.TestLogAPIEntity;
import org.apache.eagle.service.hbase.TestHBaseBase;
import org.apache.hadoop.hbase.TableName;
import org.junit.*;
import org.apache.commons.lang.time.StopWatch;
import org.slf4j.Logger;
Expand All @@ -39,7 +40,7 @@ public class TestHBaseWriteEntitiesPerformance extends TestHBaseBase {
@Before
public void setUp() throws IllegalAccessException, InstantiationException, IOException {
EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());

EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
try {
Expand Down Expand Up @@ -127,4 +128,4 @@ public void testWrite1MLogAPIEntities() {
LOG.info("End time: " + endTime);
LOG.info("Totally take " + watch.getTime() * 1.0 / 1000 + " s");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.eagle.log.entity.old.GenericDeleter;
import org.apache.eagle.log.entity.test.TestLogAPIEntity;
import org.apache.eagle.service.hbase.TestHBaseBase;
import org.apache.hadoop.hbase.TableName;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand All @@ -41,7 +42,7 @@ public class TestTestLogAPIEntity extends TestHBaseBase {
@BeforeClass
public static void createTable() throws IllegalAccessException, InstantiationException, IOException {
EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
hbase.createTable(ed.getTable(), ed.getColumnFamily());
hbase.createTable(TableName.valueOf(ed.getTable()), ed.getColumnFamily());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.eagle.common.DateTimeUtil;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.TableName;
import org.junit.*;

import java.io.IOException;
Expand All @@ -52,10 +53,10 @@ public class TestListQueryResource extends TestHBaseBase {
@Before
public void setUp() throws IllegalAccessException, InstantiationException, IOException {
entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(GenericMetricEntity.class);
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());

entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());

table = EagleConfigFactory.load().getHTable("unittest");
startTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.hadoop.hbase.protobuf.ResponseConverter;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void stop(CoprocessorEnvironment env) throws IOException {
// do nothing
}

protected HRegion getCurrentRegion() {
protected Region getCurrentRegion() {
return this.env.getRegion();
}

Expand All @@ -97,9 +98,9 @@ protected HRegion getCurrentRegion() {
* </pre>
*/
protected String getLogHeader() {
HRegion region = this.getCurrentRegion();
return LOG.isDebugEnabled() ? String.format("Region-%s", region.getRegionNameAsString()) :
String.format("Region-%s,%d", region.getTableDesc().getNameAsString(), region.getRegionId());
Region region = this.getCurrentRegion();
return LOG.isDebugEnabled() ? String.format("Region-%s", region.getRegionInfo().getRegionNameAsString()) :
String.format("Region-%s,%d", region.getTableDesc().getNameAsString(), region.getRegionInfo().getRegionId());
}

protected class InternalReadReport {
Expand Down Expand Up @@ -420,4 +421,4 @@ public AggregateResult aggregate(EntityDefinition entityDefinition, Scan scan, L

return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.eagle.storage.operation.RawQuery;
import org.apache.eagle.storage.result.ModifyResult;
import org.apache.eagle.storage.result.QueryResult;
import org.apache.hadoop.hbase.TableName;
import org.junit.*;

import java.io.IOException;
Expand All @@ -42,7 +43,7 @@ public class TestHBaseStatement extends TestHBaseBase {
@BeforeClass
public static void setUp() throws IOException, IllegalAccessException, InstantiationException, IllegalDataStorageTypeException {
entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestTimeSeriesAPIEntity.class);
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());
}

@Test
Expand Down Expand Up @@ -88,4 +89,4 @@ public void testQuery() throws IllegalDataStorageTypeException, IOException {
QueryResult<?> entityResult = queryStatement.execute(DataStorageManager.newDataStorage("hbase"));
assert entityResult != null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
package org.apache.eagle.storage.hbase;

import org.apache.eagle.storage.hbase.query.coprocessor.AggregateProtocolEndPoint;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.junit.AfterClass;
import org.junit.Assert;
Expand Down Expand Up @@ -69,7 +71,7 @@ public static void setUpHBase() throws IOException {

Assert.assertTrue("Failed to start mini cluster in " + attempts + " attempts", successToStart);

HTable table = hbase.createTable(String.valueOf("unittest"),"f");
Table table = hbase.createTable(TableName.valueOf("unittest"),"f");
HTableDescriptor descriptor = new HTableDescriptor(table.getTableDescriptor());
descriptor.addCoprocessor(AggregateProtocolEndPoint.class.getName());
hbase.getHBaseAdmin().modifyTable("unittest",descriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.eagle.storage.operation.RawQuery;
import org.apache.eagle.storage.result.ModifyResult;
import org.apache.eagle.storage.result.QueryResult;
import org.apache.hadoop.hbase.TableName;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -70,7 +71,7 @@ private TestTimeSeriesAPIEntity newInstance() {
public static void initialize() throws IllegalAccessException, InstantiationException, IOException, IllegalDataStorageTypeException {
entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestTimeSeriesAPIEntity.class);
entityDefinition.setTags(new String[] {"cluster", "datacenter", "random"});;
hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
hbase.createTable(TableName.valueOf(entityDefinition.getTable()), entityDefinition.getColumnFamily());
storage = DataStorageManager.getDataStorageByEagleConfig();
storage.init();
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<thrift.version>0.9.2</thrift.version>
<hadoop.version>2.6.0.2.2.5.1-3</hadoop.version>
<hadoop.2.7.version>2.7.1.2.4.2.0-258</hadoop.2.7.version>
<hbase.version>0.98.4.2.2.5.1-3-hadoop2</hbase.version>
<hbase.version>1.2.5</hbase.version>
<hive.version>1.2.1</hive.version>

<mapr-hive.version>1.2.0-mapr-1510</mapr-hive.version>
Expand Down Expand Up @@ -1376,4 +1376,4 @@
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
</project>
</project>