-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mcc cdh5.10.1 #1
base: master
Are you sure you want to change the base?
Changes from 6 commits
4a80b86
73666ad
471c03a
20a85e2
1c487ef
592fcc7
6b58ad0
876e04c
be233bd
3885237
ebf7178
cb30043
03178de
a443a6c
13b3554
ee6e678
9645982
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,84 +15,87 @@ | |
|
||
<maven.compiler.target>1.7</maven.compiler.target> | ||
<maven.compiler.source>1.7</maven.compiler.source> | ||
<hadoop.version>2.6.0-cdh5.10.1</hadoop.version> | ||
<hbase.version>1.2.0-cdh5.10.1</hbase.version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
<cloudera-manager.version>5.10.1</cloudera-manager.version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this one to |
||
|
||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-common</artifactId> | ||
<version>2.6.0-cdh5.10.1</version> | ||
<version>${hadoop.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-common</artifactId> | ||
<version>2.6.0-cdh5.10.1</version> | ||
<version>${hadoop.version}</version> | ||
<type>test-jar</type> | ||
<classifier>tests</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-client</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-server</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
<type>test-jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-server</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-protocol</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop2-compat</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
<!-- <scope>runtime</scope> --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this comment. |
||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop2-compat</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
<type>test-jar</type> | ||
<classifier>tests</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-common</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-common</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
<type>test-jar</type> | ||
<classifier>tests</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop-compat</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop-compat</artifactId> | ||
<version>1.2.0-cdh5.10.1</version> | ||
<version>${hbase.version}</version> | ||
<type>test-jar</type> | ||
<classifier>tests</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.cloudera.api</groupId> | ||
<artifactId>cloudera-manager-api</artifactId> | ||
<version>5.10.1</version> | ||
<version>${cloudera-manager.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.cxf</groupId> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,7 @@ | |
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.hbase.Cell; | ||
import org.apache.hadoop.hbase.HConstants; | ||
import org.apache.hadoop.hbase.HTableDescriptor; | ||
import org.apache.hadoop.hbase.TableName; | ||
import org.apache.hadoop.hbase.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't use * imports. |
||
import org.apache.hadoop.hbase.client.coprocessor.Batch.Call; | ||
import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback; | ||
import org.apache.hadoop.hbase.filter.CompareFilter; | ||
|
@@ -106,7 +103,7 @@ public boolean exists(final Get get) throws IOException { | |
|
||
@Override | ||
public boolean[] existsAll(List<Get> list) throws IOException { | ||
return new boolean[0]; | ||
return primaryHTable.existsAll(list); | ||
} | ||
|
||
public Tuple<Boolean> multiClusterExists(final Get get) throws IOException { | ||
|
@@ -130,31 +127,37 @@ public Boolean call(Table table) throws Exception { | |
return new Tuple<Boolean>(result.isPrimary, doesExist); | ||
} | ||
|
||
// public Boolean[] exists(final List<Get> gets) throws IOException { | ||
// return multiClusterExists(gets).getOriginalReturn(); | ||
// } | ||
public Boolean[] exists(final List<Get> gets) throws IOException { | ||
return multiClusterExists(gets).getOriginalReturn(); | ||
} | ||
|
||
// public Tuple<Boolean[]> multiClusterExists(final List<Get> gets) throws IOException { | ||
// long startTime = System.currentTimeMillis(); | ||
// | ||
// HBaseTableFunction<Boolean[]> function = new HBaseTableFunction<Boolean[]>() { | ||
// @Override | ||
// public Boolean[] call(Table table) throws Exception { | ||
// return table.exists(gets); | ||
// } | ||
// }; | ||
// | ||
// SpeculativeRequester.ResultWrapper<Boolean[]> result = (new SpeculativeRequester<Boolean[]>( | ||
// waitTimeBeforeRequestingFailover, waitTimeBeforeAcceptingResults, lastPrimaryFail, | ||
// waitTimeFromLastPrimaryFail)). | ||
// request(function, primaryHTable, failoverHTables); | ||
// | ||
// stats.addGetList(result.isPrimary, System.currentTimeMillis() - startTime); | ||
// | ||
// Boolean[] doesExists = result.t; | ||
// | ||
// return new Tuple<Boolean[]>(result.isPrimary, doesExists); | ||
// } | ||
public Tuple<Boolean[]> multiClusterExists(final List<Get> gets) throws IOException { | ||
long startTime = System.currentTimeMillis(); | ||
|
||
HBaseTableFunction<Boolean[]> function = new HBaseTableFunction<Boolean[]>() { | ||
Boolean[] bool = new Boolean[gets.size()]; | ||
int i=0; | ||
@Override | ||
public Boolean[] call(Table table) throws Exception { | ||
for (Get gt: gets) { | ||
bool[i]= table.exists(gt); | ||
i++; | ||
} | ||
return bool; | ||
} | ||
}; | ||
|
||
SpeculativeRequester.ResultWrapper<Boolean[]> result = (new SpeculativeRequester<Boolean[]>( | ||
waitTimeBeforeRequestingFailover, waitTimeBeforeAcceptingResults, lastPrimaryFail, | ||
waitTimeFromLastPrimaryFail)). | ||
request(function, primaryHTable, failoverHTables); | ||
|
||
stats.addGetList(result.isPrimary, System.currentTimeMillis() - startTime); | ||
|
||
Boolean[] doesExists = result.t; | ||
|
||
return new Tuple<Boolean[]>(result.isPrimary, doesExists); | ||
} | ||
|
||
public void batch(final List<? extends Row> actions, final Object[] results) | ||
throws IOException, InterruptedException { | ||
|
@@ -241,10 +244,7 @@ public Tuple<Result> multiClusterGetRowOrBefore(final byte[] row, final byte[] f | |
HBaseTableFunction<Result> function = new HBaseTableFunction<Result>() { | ||
@Override | ||
public Result call(Table table) throws Exception { | ||
|
||
return (Result)table.getScanner(row, family); | ||
|
||
//return table.getRowOrBefore(row, family); | ||
} | ||
}; | ||
|
||
|
@@ -406,7 +406,7 @@ private Put setTimeStampOfUnsetValues(final Put put, long ts) | |
// This will protect us from a multicluster sumbission | ||
if (cell.getTimestamp() == HConstants.LATEST_TIMESTAMP) { | ||
newPut | ||
.addColumn(cell.getFamily(), cell.getQualifier(), ts, cell.getValue()); | ||
.addColumn(CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell), ts, CellUtil.cloneValue(cell)); | ||
} else { | ||
newPut.add(cell); | ||
} | ||
|
@@ -472,7 +472,7 @@ public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, | |
|
||
@Override | ||
public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { | ||
return false; | ||
return primaryHTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); | ||
} | ||
|
||
public void delete(final Delete delete) throws IOException { | ||
|
@@ -532,7 +532,7 @@ public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, | |
|
||
@Override | ||
public boolean checkAndDelete(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Delete delete) throws IOException { | ||
return false; | ||
return primaryHTable.checkAndDelete(bytes, bytes1, bytes2, compareOp, bytes3, delete); | ||
} | ||
|
||
public void mutateRow(final RowMutations rm) throws IOException { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid duplication use the variable for CDH in this one.