Skip to content
Merged
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 @@ -49,4 +49,6 @@
<suppress checks="LineLength" files="org.apache.hadoop.hbase.util.ZKDataMigrator.java"/>
<suppress checks="InnerAssignment" files="org.apache.hadoop.hbase.Waiter"/>
<suppress checks="EmptyBlock" files="org.apache.hadoop.hbase.TestTimeout"/>
<suppress checks="InnerAssignment" files="org.apache.hadoop.hbase.rest.PerformanceEvaluation"/>
<suppress checks="EmptyBlock" files="org.apache.hadoop.hbase.rest.PerformanceEvaluation"/>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.slf4j.LoggerFactory;

public class HBaseRESTTestingUtility {

private static final Logger LOG = LoggerFactory.getLogger(HBaseRESTTestingUtility.class);

private RESTServer server;
Expand All @@ -52,12 +51,14 @@ public void startServletContainer(Configuration conf) throws Exception {
}

public void shutdownServletContainer() {
if (server != null) try {
server.stop();
server = null;
RESTServlet.stop();
} catch (Exception e) {
LOG.warn(StringUtils.stringifyException(e));
if (server != null) {
try {
server.stop();
server = null;
RESTServlet.stop();
} catch (Exception e) {
LOG.warn(StringUtils.stringifyException(e));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.apache.hadoop.hbase.util.Hash;
import org.apache.hadoop.hbase.util.MurmurHash;
import org.apache.hadoop.hbase.util.Pair;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
Expand All @@ -91,6 +92,7 @@
import org.apache.hadoop.util.LineReader;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -204,8 +206,7 @@ public PerformanceEvaluation(final Configuration c) {

protected void addCommandDescriptor(Class<? extends Test> cmdClass,
String name, String description) {
CmdDescriptor cmdDescriptor =
new CmdDescriptor(cmdClass, name, description);
CmdDescriptor cmdDescriptor = new CmdDescriptor(cmdClass, name, description);
commands.put(name, cmdDescriptor);
}

Expand Down Expand Up @@ -335,7 +336,7 @@ public List<InputSplit> getSplits(JobContext job) throws IOException {
// generate splits
List<InputSplit> splitList = new ArrayList<>();

for (FileStatus file: listStatus(job)) {
for (FileStatus file : listStatus(job)) {
if (file.isDirectory()) {
continue;
}
Expand All @@ -344,10 +345,10 @@ public List<InputSplit> getSplits(JobContext job) throws IOException {
FSDataInputStream fileIn = fs.open(path);
LineReader in = new LineReader(fileIn, job.getConfiguration());
int lineLen;
while(true) {
while (true) {
Text lineText = new Text();
lineLen = in.readLine(lineText);
if(lineLen <= 0) {
if (lineLen <= 0) {
break;
}
Matcher m = LINE_PATTERN.matcher(lineText.toString());
Expand Down Expand Up @@ -406,7 +407,7 @@ public void initialize(InputSplit split, TaskAttemptContext context) {

@Override
public boolean nextKeyValue() {
if(readOver) {
if (readOver) {
return false;
}

Expand All @@ -429,7 +430,7 @@ public PeInputSplit getCurrentValue() {

@Override
public float getProgress() {
if(readOver) {
if (readOver) {
return 1.0f;
} else {
return 0.0f;
Expand Down Expand Up @@ -562,7 +563,7 @@ protected byte[][] getSplits() {
int numSplitPoints = presplitRegions - 1;
byte[][] splits = new byte[numSplitPoints][];
int jump = this.R / this.presplitRegions;
for (int i=0; i < numSplitPoints; i++) {
for (int i = 0; i < numSplitPoints; i++) {
int rowkey = jump * (1 + i);
splits[i] = format(rowkey);
}
Expand Down Expand Up @@ -635,11 +636,11 @@ public void run() {
};
threads.add(t);
}
for (Thread t: threads) {
for (Thread t : threads) {
t.start();
}
for (Thread t: threads) {
while(t.isAlive()) {
for (Thread t : threads) {
while (t.isAlive()) {
try {
t.join();
} catch (InterruptedException e) {
Expand Down Expand Up @@ -708,33 +709,32 @@ private Path writeInputFile(final Configuration c) throws IOException {
FileSystem fs = FileSystem.get(c);
fs.mkdirs(inputDir);
Path inputFile = new Path(inputDir, "input.txt");
PrintStream out = new PrintStream(fs.create(inputFile));
// Make input random.
Map<Integer, String> m = new TreeMap<>();
Hash h = MurmurHash.getInstance();
int perClientRows = (this.R / this.N);
try {
try (PrintStream out = new PrintStream(fs.create(inputFile))) {
Map<Integer, String> m = new TreeMap<>();
Hash h = MurmurHash.getInstance();
int perClientRows = (this.R / this.N);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < N; j++) {
String s = "tableName=" + this.tableName +
", startRow=" + ((j * perClientRows) + (i * (perClientRows/10))) +
", perClientRunRows=" + (perClientRows / 10) +
", totalRows=" + this.R +
", clients=" + this.N +
", flushCommits=" + this.flushCommits +
", writeToWAL=" + this.writeToWAL +
", useTags=" + this.useTags +
", noOfTags=" + this.noOfTags;
byte[] b = Bytes.toBytes(s);
StringBuilder s = new StringBuilder();
s.append("tableName=").append(tableName);
s.append(", startRow=").append((j * perClientRows) + (i * (perClientRows / 10)));
s.append(", perClientRunRows=").append(perClientRows / 10);
s.append(", totalRows=").append(R);
s.append(", clients=").append(N);
s.append(", flushCommits=").append(flushCommits);
s.append(", writeToWAL=").append(writeToWAL);
s.append(", useTags=").append(useTags);
s.append(", noOfTags=").append(noOfTags);

byte[] b = Bytes.toBytes(s.toString());
int hash = h.hash(new ByteArrayHashKey(b, 0, b.length), -1);
m.put(hash, s);
m.put(hash, s.toString());
}
}
for (Map.Entry<Integer, String> e: m.entrySet()) {
for (Map.Entry<Integer, String> e : m.entrySet()) {
out.println(e.getValue());
}
} finally {
out.close();
}
return inputDir;
}
Expand Down Expand Up @@ -1198,15 +1198,9 @@ static class FilteredScanTest extends TableTest {
void testRow(int i) throws IOException {
byte[] value = generateValue(this.rand);
Scan scan = constructScan(value);
ResultScanner scanner = null;
try {
scanner = this.table.getScanner(scan);
try (ResultScanner scanner = this.table.getScanner(scan)) {
while (scanner.next() != null) {
}
} finally {
if (scanner != null) {
scanner.close();
}
}
}

Expand Down
Loading