diff --git a/bin/ycsb b/bin/ycsb index 3f32ea9ad8404691c246c387250d0f2be8aeeafa..d18de33c4d39bb83f99ded03138f7e7a6339ce88 100755 --- a/bin/ycsb +++ b/bin/ycsb @@ -55,8 +55,9 @@ DATABASES = { "dynamodb" : "com.yahoo.ycsb.db.DynamoDBClient", "elasticsearch": "com.yahoo.ycsb.db.ElasticSearchClient", "gemfire" : "com.yahoo.ycsb.db.GemFireClient", - "hbase" : "com.yahoo.ycsb.db.HBaseClient", - "hbase-10" : "com.yahoo.ycsb.db.HBaseClient10", + "hbase094" : "com.yahoo.ycsb.db.HBaseClient", + "hbase098" : "com.yahoo.ycsb.db.HBaseClient", + "hbase10" : "com.yahoo.ycsb.db.HBaseClient10", "hypertable" : "com.yahoo.ycsb.db.HypertableClient", "infinispan-cs": "com.yahoo.ycsb.db.InfinispanRemoteClient", "infinispan" : "com.yahoo.ycsb.db.InfinispanClient", diff --git a/distribution/pom.xml b/distribution/pom.xml index 2dd32d0cdccee8617716807ceeb7aae2aa8d91b0..82592028d90141a9769cb8a377e1503e00aceb38 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -76,7 +76,17 @@ LICENSE file. </dependency> <dependency> <groupId>com.yahoo.ycsb</groupId> - <artifactId>hbase-binding</artifactId> + <artifactId>hbase094-binding</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>hbase098-binding</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>hbase10-binding</artifactId> <version>${project.version}</version> </dependency> <dependency> diff --git a/hbase094/README.md b/hbase094/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3df8264cfd89acc63bf07b929a5c4683d534f596 --- /dev/null +++ b/hbase094/README.md @@ -0,0 +1,23 @@ +<!-- +Copyright (c) 2015 YCSB contributors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You +may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing +permissions and limitations under the License. See accompanying +LICENSE file. +--> + +# HBase (0.94.x) Driver for YCSB +This driver is a binding for the YCSB facilities to operate against a HBase 0.94.x Server cluster. It may also work against 0.92.x +To run against an HBase 0.98.x cluster, use the `hbase098` binding. +To run against an HBase >= 1.0 cluster, use the `hbase10` binding. + +See `hbase098/README.md` for configuration details. diff --git a/hbase094/pom.xml b/hbase094/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..3a3ea06e1a4edba8b608a4ea9ebc60aeb6405aac --- /dev/null +++ b/hbase094/pom.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright (c) 2012 - 2015 YCSB contributors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You +may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing +permissions and limitations under the License. See accompanying +LICENSE file. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>binding-parent</artifactId> + <version>0.4.0-SNAPSHOT</version> + <relativePath>../binding-parent/</relativePath> + </parent> + + <artifactId>hbase094-binding</artifactId> + <name>HBase 0.94.x DB Binding</name> + + <dependencies> + <!-- This binding is identical to the HBase 0.98, other than dependencies. --> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase</artifactId> + <version>${hbase094.version}</version> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-core</artifactId> + <version>1.0.4</version> + </dependency> + <dependency> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>hbase098-binding</artifactId> + <version>${project.version}</version> + <exclusions> + <!-- HBase 0.98.0 depends on hbase-client, HBase 0.94.0 on hbase. + Override all dependencies. --> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.7.12</version> + </dependency> + <dependency> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>core</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/hbase/README.md b/hbase098/README.md similarity index 91% rename from hbase/README.md rename to hbase098/README.md index 7316c6206e9bcef5801efaf113a32d15f6cfa912..fc75c626c50720b95fbb23410b4aac6459e480a5 100644 --- a/hbase/README.md +++ b/hbase098/README.md @@ -15,8 +15,10 @@ permissions and limitations under the License. See accompanying LICENSE file. --> -# HBase Driver for YCSB -This driver is a binding for the YCSB facilities to operate against a HBase Server cluster. +# HBase (0.98.x) Driver for YCSB +This driver is a binding for the YCSB facilities to operate against a HBase 0.98.x Server cluster. +To run against an HBase 0.94.x cluster, use the `hbase094` binding. +To run against an HBase >= 1.0 cluster, use the `hbase10` binding. ## Quickstart @@ -68,6 +70,4 @@ bin/ycsb run hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=user Following options can be configurable using `-p`. * `columnfamily`: The HBase column family to target. -* `clientbuffering` : If true, buffer mutations on the client. The default is false. -* `writebuffersize` : Buffer size to be used when `clientbuffering` is activated. The default is 12MB. * `debug` : If true, debugging logs are activated. The default is false. diff --git a/hbase098/pom.xml b/hbase098/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..627f31e8f15b6f0ad9525cfe1a945141a9e9d98e --- /dev/null +++ b/hbase098/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright (c) 2012 - 2015 YCSB contributors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You +may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing +permissions and limitations under the License. See accompanying +LICENSE file. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>binding-parent</artifactId> + <version>0.4.0-SNAPSHOT</version> + <relativePath>../binding-parent/</relativePath> + </parent> + + <artifactId>hbase098-binding</artifactId> + <name>HBase 0.98.x DB Binding</name> + + <dependencies> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-client</artifactId> + <version>${hbase098.version}</version> + </dependency> + <dependency> + <groupId>com.yahoo.ycsb</groupId> + <artifactId>core</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient.java b/hbase098/src/main/java/com/yahoo/ycsb/db/HBaseClient.java similarity index 100% rename from hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient.java rename to hbase098/src/main/java/com/yahoo/ycsb/db/HBaseClient.java diff --git a/hbase10/README.md b/hbase10/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1da5bc4369aa552e2ae158c217fc11b044e8cff8 --- /dev/null +++ b/hbase10/README.md @@ -0,0 +1,23 @@ +<!-- +Copyright (c) 2015 YCSB contributors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You +may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing +permissions and limitations under the License. See accompanying +LICENSE file. +--> + +# HBase (1.0.x) Driver for YCSB +This driver is a binding for the YCSB facilities to operate against a HBase 1.0.x Server cluster. +To run against an HBase 0.94.x cluster, use the `hbase094` binding. +To run against an HBase 0.98.x cluster, use the `hbase098` binding. + +See `hbase098/README.md` for configuration details. diff --git a/hbase/pom.xml b/hbase10/pom.xml similarity index 91% rename from hbase/pom.xml rename to hbase10/pom.xml index a5241798a5573ba8488d554d03c44e6b5a9e6284..77693b16d0fecf9fbc977cde87b51df09d851f05 100644 --- a/hbase/pom.xml +++ b/hbase10/pom.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- +<!-- Copyright (c) 2012 - 2015 YCSB contributors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you @@ -25,14 +25,14 @@ LICENSE file. <relativePath>../binding-parent/</relativePath> </parent> - <artifactId>hbase-binding</artifactId> - <name>HBase DB Binding</name> + <artifactId>hbase10-binding</artifactId> + <name>HBase 1.0 DB Binding</name> <dependencies> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> - <version>${hbase.version}</version> + <version>${hbase10.version}</version> </dependency> <dependency> <groupId>com.yahoo.ycsb</groupId> diff --git a/hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java b/hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java similarity index 97% rename from hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java rename to hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java index b4e949873f5797920b9e4005c3f183a33b5c2486..4caaf93551bfcfac0efdffbf181daabc5cd1acab 100644 --- a/hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java +++ b/hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java @@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.BufferedMutator; import org.apache.hadoop.hbase.client.BufferedMutatorParams; @@ -250,7 +249,9 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB if (r.isEmpty()) { return NoMatchingRecord; } - for (Cell c : r.listCells()) { + + while (r.advance()) { + final Cell c = r.current(); result.put(Bytes.toString(CellUtil.cloneQualifier(c)), new ByteArrayByteIterator(CellUtil.cloneValue(c))); if (_debug) { @@ -316,6 +317,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB { //get row key String key = Bytes.toString(rr.getRow()); + if (_debug) { System.out.println("Got scan result for key: "+key); @@ -323,11 +325,13 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB HashMap<String,ByteIterator> rowResult = new HashMap<String, ByteIterator>(); - for (KeyValue kv : rr.raw()) { + while (rr.advance()) { + final Cell cell = rr.current(); rowResult.put( - Bytes.toString(kv.getQualifier()), - new ByteArrayByteIterator(kv.getValue())); + Bytes.toString(CellUtil.cloneQualifier(cell)), + new ByteArrayByteIterator(CellUtil.cloneValue(cell))); } + //add rowResult to result vector result.add(rowResult); numResults++; @@ -397,7 +401,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB System.out.println("Adding field/value " + entry.getKey() + "/"+ Bytes.toStringBinary(value) + " to put request"); } - p.add(_columnFamilyBytes,Bytes.toBytes(entry.getKey()), value); + p.addColumn(_columnFamilyBytes,Bytes.toBytes(entry.getKey()), value); } try diff --git a/pom.xml b/pom.xml index ed2b9b3fe989f960242d525dabb8bca7bfbeffcf..383ce6d1bd5b38830b2bd9278d88ea2b5faf7cbe 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,9 @@ LICENSE file. <properties> <maven.assembly.version>2.5.5</maven.assembly.version> <maven.dependency.version>2.10</maven.dependency.version> - <hbase.version>1.0.0</hbase.version> + <hbase094.version>0.94.27</hbase094.version> + <hbase098.version>0.98.14-hadoop2</hbase098.version> + <hbase10.version>1.0.2</hbase10.version> <accumulo.version>1.6.0</accumulo.version> <cassandra.version>1.2.9</cassandra.version> <cassandra.cql.version>1.0.3</cassandra.cql.version> @@ -103,7 +105,9 @@ LICENSE file. <module>dynamodb</module> <module>elasticsearch</module> <module>gemfire</module> - <module>hbase</module> + <module>hbase094</module> + <module>hbase098</module> + <module>hbase10</module> <module>hypertable</module> <module>infinispan</module> <module>jdbc</module>