Skip to content
Snippets Groups Projects
Commit d2d9a3fd authored by Helen H.W. Chan's avatar Helen H.W. Chan Committed by Sean Busbey
Browse files

[core] Add options for user-specified min field length (#1177)

parent f479f154
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ import java.util.*; ...@@ -34,6 +34,7 @@ import java.util.*;
* <UL> * <UL>
* <LI><b>fieldcount</b>: the number of fields in a record (default: 10) * <LI><b>fieldcount</b>: the number of fields in a record (default: 10)
* <LI><b>fieldlength</b>: the size of each field (default: 100) * <LI><b>fieldlength</b>: the size of each field (default: 100)
* <LI><b>minfieldlength</b>: the minimum size of each field (default: 1)
* <LI><b>readallfields</b>: should reads read all fields (true) or just one (false) (default: true) * <LI><b>readallfields</b>: should reads read all fields (true) or just one (false) (default: true)
* <LI><b>writeallfields</b>: should updates and read/modify/writes update all fields (true) or just * <LI><b>writeallfields</b>: should updates and read/modify/writes update all fields (true) or just
* one (false) (default: false) * one (false) (default: false)
...@@ -45,6 +46,7 @@ import java.util.*; ...@@ -45,6 +46,7 @@ import java.util.*;
* modify it, write it back (default: 0) * modify it, write it back (default: 0)
* <LI><b>requestdistribution</b>: what distribution should be used to select the records to operate * <LI><b>requestdistribution</b>: what distribution should be used to select the records to operate
* on - uniform, zipfian, hotspot, sequential, exponential or latest (default: uniform) * on - uniform, zipfian, hotspot, sequential, exponential or latest (default: uniform)
* <LI><b>minscanlength</b>: for scans, what is the minimum number of records to scan (default: 1)
* <LI><b>maxscanlength</b>: for scans, what is the maximum number of records to scan (default: 1000) * <LI><b>maxscanlength</b>: for scans, what is the maximum number of records to scan (default: 1000)
* <LI><b>scanlengthdistribution</b>: for scans, what distribution should be used to choose the * <LI><b>scanlengthdistribution</b>: for scans, what distribution should be used to choose the
* number of records to scan, for each scan, between 1 and maxscanlength (default: uniform) * number of records to scan, for each scan, between 1 and maxscanlength (default: uniform)
...@@ -111,6 +113,16 @@ public class CoreWorkload extends Workload { ...@@ -111,6 +113,16 @@ public class CoreWorkload extends Workload {
*/ */
public static final String FIELD_LENGTH_PROPERTY_DEFAULT = "100"; public static final String FIELD_LENGTH_PROPERTY_DEFAULT = "100";
/**
* The name of the property for the minimum length of a field in bytes.
*/
public static final String MIN_FIELD_LENGTH_PROPERTY = "minfieldlength";
/**
* The default minimum length of a field in bytes.
*/
public static final String MIN_FIELD_LENGTH_PROPERTY_DEFAULT = "1";
/** /**
* The name of a property that specifies the filename containing the field length histogram (only * The name of a property that specifies the filename containing the field length histogram (only
* used if fieldlengthdistribution is "histogram"). * used if fieldlengthdistribution is "histogram").
...@@ -244,6 +256,16 @@ public class CoreWorkload extends Workload { ...@@ -244,6 +256,16 @@ public class CoreWorkload extends Workload {
public static final String ZERO_PADDING_PROPERTY_DEFAULT = "1"; public static final String ZERO_PADDING_PROPERTY_DEFAULT = "1";
/**
* The name of the property for the min scan length (number of records).
*/
public static final String MIN_SCAN_LENGTH_PROPERTY = "minscanlength";
/**
* The default min scan length.
*/
public static final String MIN_SCAN_LENGTH_PROPERTY_DEFAULT = "1";
/** /**
* The name of the property for the max scan length (number of records). * The name of the property for the max scan length (number of records).
*/ */
...@@ -328,14 +350,16 @@ public class CoreWorkload extends Workload { ...@@ -328,14 +350,16 @@ public class CoreWorkload extends Workload {
FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT); FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT);
int fieldlength = int fieldlength =
Integer.parseInt(p.getProperty(FIELD_LENGTH_PROPERTY, FIELD_LENGTH_PROPERTY_DEFAULT)); Integer.parseInt(p.getProperty(FIELD_LENGTH_PROPERTY, FIELD_LENGTH_PROPERTY_DEFAULT));
int minfieldlength =
Integer.parseInt(p.getProperty(MIN_FIELD_LENGTH_PROPERTY, MIN_FIELD_LENGTH_PROPERTY_DEFAULT));
String fieldlengthhistogram = p.getProperty( String fieldlengthhistogram = p.getProperty(
FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY, FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT); FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY, FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT);
if (fieldlengthdistribution.compareTo("constant") == 0) { if (fieldlengthdistribution.compareTo("constant") == 0) {
fieldlengthgenerator = new ConstantIntegerGenerator(fieldlength); fieldlengthgenerator = new ConstantIntegerGenerator(fieldlength);
} else if (fieldlengthdistribution.compareTo("uniform") == 0) { } else if (fieldlengthdistribution.compareTo("uniform") == 0) {
fieldlengthgenerator = new UniformLongGenerator(1, fieldlength); fieldlengthgenerator = new UniformLongGenerator(minfieldlength, fieldlength);
} else if (fieldlengthdistribution.compareTo("zipfian") == 0) { } else if (fieldlengthdistribution.compareTo("zipfian") == 0) {
fieldlengthgenerator = new ZipfianGenerator(1, fieldlength); fieldlengthgenerator = new ZipfianGenerator(minfieldlength, fieldlength);
} else if (fieldlengthdistribution.compareTo("histogram") == 0) { } else if (fieldlengthdistribution.compareTo("histogram") == 0) {
try { try {
fieldlengthgenerator = new HistogramGenerator(fieldlengthhistogram); fieldlengthgenerator = new HistogramGenerator(fieldlengthhistogram);
...@@ -373,6 +397,8 @@ public class CoreWorkload extends Workload { ...@@ -373,6 +397,8 @@ public class CoreWorkload extends Workload {
} }
String requestdistrib = String requestdistrib =
p.getProperty(REQUEST_DISTRIBUTION_PROPERTY, REQUEST_DISTRIBUTION_PROPERTY_DEFAULT); p.getProperty(REQUEST_DISTRIBUTION_PROPERTY, REQUEST_DISTRIBUTION_PROPERTY_DEFAULT);
int minscanlength =
Integer.parseInt(p.getProperty(MIN_SCAN_LENGTH_PROPERTY, MIN_SCAN_LENGTH_PROPERTY_DEFAULT));
int maxscanlength = int maxscanlength =
Integer.parseInt(p.getProperty(MAX_SCAN_LENGTH_PROPERTY, MAX_SCAN_LENGTH_PROPERTY_DEFAULT)); Integer.parseInt(p.getProperty(MAX_SCAN_LENGTH_PROPERTY, MAX_SCAN_LENGTH_PROPERTY_DEFAULT));
String scanlengthdistrib = String scanlengthdistrib =
...@@ -461,9 +487,9 @@ public class CoreWorkload extends Workload { ...@@ -461,9 +487,9 @@ public class CoreWorkload extends Workload {
fieldchooser = new UniformLongGenerator(0, fieldcount - 1); fieldchooser = new UniformLongGenerator(0, fieldcount - 1);
if (scanlengthdistrib.compareTo("uniform") == 0) { if (scanlengthdistrib.compareTo("uniform") == 0) {
scanlength = new UniformLongGenerator(1, maxscanlength); scanlength = new UniformLongGenerator(minscanlength, maxscanlength);
} else if (scanlengthdistrib.compareTo("zipfian") == 0) { } else if (scanlengthdistrib.compareTo("zipfian") == 0) {
scanlength = new ZipfianGenerator(1, maxscanlength); scanlength = new ZipfianGenerator(minscanlength, maxscanlength);
} else { } else {
throw new WorkloadException( throw new WorkloadException(
"Distribution \"" + scanlengthdistrib + "\" not allowed for scan length"); "Distribution \"" + scanlengthdistrib + "\" not allowed for scan length");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment