Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adnan Ahmad
YCSB
Commits
d2d9a3fd
Commit
d2d9a3fd
authored
6 years ago
by
Helen H.W. Chan
Committed by
Sean Busbey
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[core] Add options for user-specified min field length (#1177)
parent
f479f154
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java
+30
-4
30 additions, 4 deletions
.../src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java
with
30 additions
and
4 deletions
core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java
+
30
−
4
View file @
d2d9a3fd
...
...
@@ -34,6 +34,7 @@ import java.util.*;
* <UL>
* <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>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>writeallfields</b>: should updates and read/modify/writes update all fields (true) or just
* one (false) (default: false)
...
...
@@ -45,6 +46,7 @@ import java.util.*;
* modify it, write it back (default: 0)
* <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)
* <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>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)
...
...
@@ -111,6 +113,16 @@ public class CoreWorkload extends Workload {
*/
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
* used if fieldlengthdistribution is "histogram").
...
...
@@ -244,6 +256,16 @@ public class CoreWorkload extends Workload {
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).
*/
...
...
@@ -328,14 +350,16 @@ public class CoreWorkload extends Workload {
FIELD_LENGTH_DISTRIBUTION_PROPERTY
,
FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT
);
int
fieldlength
=
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
(
FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY
,
FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT
);
if
(
fieldlengthdistribution
.
compareTo
(
"constant"
)
==
0
)
{
fieldlengthgenerator
=
new
ConstantIntegerGenerator
(
fieldlength
);
}
else
if
(
fieldlengthdistribution
.
compareTo
(
"uniform"
)
==
0
)
{
fieldlengthgenerator
=
new
UniformLongGenerator
(
1
,
fieldlength
);
fieldlengthgenerator
=
new
UniformLongGenerator
(
minfieldlength
,
fieldlength
);
}
else
if
(
fieldlengthdistribution
.
compareTo
(
"zipfian"
)
==
0
)
{
fieldlengthgenerator
=
new
ZipfianGenerator
(
1
,
fieldlength
);
fieldlengthgenerator
=
new
ZipfianGenerator
(
minfieldlength
,
fieldlength
);
}
else
if
(
fieldlengthdistribution
.
compareTo
(
"histogram"
)
==
0
)
{
try
{
fieldlengthgenerator
=
new
HistogramGenerator
(
fieldlengthhistogram
);
...
...
@@ -373,6 +397,8 @@ public class CoreWorkload extends Workload {
}
String
requestdistrib
=
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
=
Integer
.
parseInt
(
p
.
getProperty
(
MAX_SCAN_LENGTH_PROPERTY
,
MAX_SCAN_LENGTH_PROPERTY_DEFAULT
));
String
scanlengthdistrib
=
...
...
@@ -461,9 +487,9 @@ public class CoreWorkload extends Workload {
fieldchooser
=
new
UniformLongGenerator
(
0
,
fieldcount
-
1
);
if
(
scanlengthdistrib
.
compareTo
(
"uniform"
)
==
0
)
{
scanlength
=
new
UniformLongGenerator
(
1
,
maxscanlength
);
scanlength
=
new
UniformLongGenerator
(
minscanlength
,
maxscanlength
);
}
else
if
(
scanlengthdistrib
.
compareTo
(
"zipfian"
)
==
0
)
{
scanlength
=
new
ZipfianGenerator
(
1
,
maxscanlength
);
scanlength
=
new
ZipfianGenerator
(
minscanlength
,
maxscanlength
);
}
else
{
throw
new
WorkloadException
(
"Distribution \""
+
scanlengthdistrib
+
"\" not allowed for scan length"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment