diff --git a/asynchbase/src/main/java/com/yahoo/ycsb/db/AsyncHBaseClient.java b/asynchbase/src/main/java/com/yahoo/ycsb/db/AsyncHBaseClient.java index fddd1a7aef..eecbee36f9 100644 --- a/asynchbase/src/main/java/com/yahoo/ycsb/db/AsyncHBaseClient.java +++ b/asynchbase/src/main/java/com/yahoo/ycsb/db/AsyncHBaseClient.java @@ -39,6 +39,9 @@ import com.yahoo.ycsb.DBException; import com.yahoo.ycsb.Status; +import static com.yahoo.ycsb.workloads.CoreWorkload.TABLENAME_PROPERTY; +import static com.yahoo.ycsb.workloads.CoreWorkload.TABLENAME_PROPERTY_DEFAULT; + /** * Alternative Java client for Apache HBase. * @@ -140,7 +143,7 @@ public void init() throws DBException { // Terminate right now if table does not exist, since the client // will not propagate this error upstream once the workload // starts. - String table = com.yahoo.ycsb.workloads.CoreWorkload.table; + String table = getProperties().getProperty(TABLENAME_PROPERTY, TABLENAME_PROPERTY_DEFAULT); try { client.ensureTableExists(table).join(joinTimeout); } catch (InterruptedException e1) { diff --git a/core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java b/core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java index 422dc05475..f84ddb30de 100644 --- a/core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java +++ b/core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java @@ -1,12 +1,12 @@ /** * Copyright (c) 2010 Yahoo! Inc., Copyright (c) 2016 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 @@ -17,39 +17,18 @@ package com.yahoo.ycsb.workloads; -import java.util.Properties; - import com.yahoo.ycsb.*; -import com.yahoo.ycsb.generator.AcknowledgedCounterGenerator; -import com.yahoo.ycsb.generator.ConstantIntegerGenerator; -import com.yahoo.ycsb.generator.CounterGenerator; -import com.yahoo.ycsb.generator.DiscreteGenerator; -import com.yahoo.ycsb.generator.ExponentialGenerator; -import com.yahoo.ycsb.generator.HistogramGenerator; -import com.yahoo.ycsb.generator.HotspotIntegerGenerator; -import com.yahoo.ycsb.generator.NumberGenerator; -import com.yahoo.ycsb.generator.ScrambledZipfianGenerator; -import com.yahoo.ycsb.generator.SequentialGenerator; -import com.yahoo.ycsb.generator.SkewedLatestGenerator; -import com.yahoo.ycsb.generator.UniformIntegerGenerator; -import com.yahoo.ycsb.generator.ZipfianGenerator; +import com.yahoo.ycsb.generator.*; import com.yahoo.ycsb.measurements.Measurements; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Vector; - +import java.util.*; /** * The core benchmark scenario. Represents a set of clients doing simple CRUD operations. The * relative proportion of different kinds of operations, and other properties of the workload, * are controlled by parameters specified at runtime. - * + *
* Properties to control the client: *
* If "uniform", "zipfian" or "constant", the maximum field length will be that specified by the
* fieldlength property. If "histogram", then the histogram will be read from the filename
* specified in the "fieldlengthhistogram" property.
@@ -149,7 +127,7 @@ public class CoreWorkload extends Workload {
* Generator object that produces field lengths. The value of this depends on the properties that
* start with "FIELD_LENGTH_".
*/
- NumberGenerator fieldlengthgenerator;
+ private NumberGenerator fieldlengthgenerator;
/**
* The name of the property for deciding whether to read one field (false) or all fields (true) of
@@ -162,7 +140,7 @@ public class CoreWorkload extends Workload {
*/
public static final String READ_ALL_FIELDS_PROPERTY_DEFAULT = "true";
- boolean readallfields;
+ private boolean readallfields;
/**
* The name of the property for deciding whether to write one field (false) or all fields (true)
@@ -175,8 +153,7 @@ public class CoreWorkload extends Workload {
*/
public static final String WRITE_ALL_FIELDS_PROPERTY_DEFAULT = "false";
- boolean writeallfields;
-
+ private boolean writeallfields;
/**
* The name of the property for deciding whether to check all returned
@@ -256,7 +233,7 @@ public class CoreWorkload extends Workload {
*/
public static final String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT = "uniform";
- /**
+ /**
* The name of the property for adding zero padding to record numbers in order to match
* string sort order. Controls the number of 0s to left pad with.
*/
@@ -267,7 +244,7 @@ public class CoreWorkload extends Workload {
*/
public static final String ZERO_PADDING_PROPERTY_DEFAULT = "1";
-
+
/**
* The name of the property for the max scan length (number of records).
*/
@@ -331,29 +308,29 @@ public class CoreWorkload extends Workload {
public static final String INSERTION_RETRY_INTERVAL = "core_workload_insertion_retry_interval";
public static final String INSERTION_RETRY_INTERVAL_DEFAULT = "3";
- NumberGenerator keysequence;
+ private NumberGenerator keysequence;
- DiscreteGenerator operationchooser;
+ private DiscreteGenerator operationchooser;
- NumberGenerator keychooser;
+ private NumberGenerator keychooser;
- NumberGenerator fieldchooser;
+ private NumberGenerator fieldchooser;
- AcknowledgedCounterGenerator transactioninsertkeysequence;
+ private AcknowledgedCounterGenerator transactioninsertkeysequence;
- NumberGenerator scanlength;
+ private NumberGenerator scanlength;
- boolean orderedinserts;
+ private boolean orderedinserts;
- int recordcount;
- int zeropadding;
+ private int recordcount;
+ private int zeropadding;
- int insertionRetryLimit;
- int insertionRetryInterval;
+ private int insertionRetryLimit;
+ private int insertionRetryInterval;
- private Measurements _measurements = Measurements.getMeasurements();
+ private Measurements measurements = Measurements.getMeasurements();
- protected static NumberGenerator getFieldLengthGenerator(Properties p) throws WorkloadException {
+ static NumberGenerator getFieldLengthGenerator(Properties p) throws WorkloadException {
NumberGenerator fieldlengthgenerator;
String fieldlengthdistribution = p.getProperty(
FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT);
@@ -391,12 +368,12 @@ public void init(Properties p) throws WorkloadException {
fieldcount =
Integer.parseInt(p.getProperty(FIELD_COUNT_PROPERTY, FIELD_COUNT_PROPERTY_DEFAULT));
- fieldnames = new ArrayList