Skip to content

Commit

Permalink
Merge pull request #291 from lilinghai/support-minscanlength-corework…
Browse files Browse the repository at this point in the history
…load

pkg: support core workload minscanlength parameter
  • Loading branch information
dbsid committed Nov 7, 2023
2 parents 55daeec + 10b76cf commit 1906500
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/prop/prop.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const (
RequestDistributionDefault = "uniform"
ZeroPadding = "zeropadding"
ZeroPaddingDefault = int64(1)
MinScanLength = "minscanlength"
MinScanLengthDefault = int64(1)
MaxScanLength = "maxscanlength"
MaxScanLengthDefault = int64(1000)
// "uniform", "zipfian"
Expand Down
5 changes: 3 additions & 2 deletions pkg/workload/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ func (coreCreator) Create(p *properties.Properties) (ycsb.Workload, error) {
}

requestDistrib := p.GetString(prop.RequestDistribution, prop.RequestDistributionDefault)
minScanLength := p.GetInt64(prop.MinScanLength, prop.MinScanLengthDefault)
maxScanLength := p.GetInt64(prop.MaxScanLength, prop.MaxScanLengthDefault)
scanLengthDistrib := p.GetString(prop.ScanLengthDistribution, prop.ScanLengthDistributionDefault)

Expand Down Expand Up @@ -680,9 +681,9 @@ func (coreCreator) Create(p *properties.Properties) (ycsb.Workload, error) {
c.fieldChooser = generator.NewUniform(0, c.fieldCount-1)
switch scanLengthDistrib {
case "uniform":
c.scanLength = generator.NewUniform(1, maxScanLength)
c.scanLength = generator.NewUniform(minScanLength, maxScanLength)
case "zipfian":
c.scanLength = generator.NewZipfianWithRange(1, maxScanLength, generator.ZipfianConstant)
c.scanLength = generator.NewZipfianWithRange(minScanLength, maxScanLength, generator.ZipfianConstant)
default:
util.Fatalf("distribution %s not allowed for scan length", scanLengthDistrib)
}
Expand Down

0 comments on commit 1906500

Please sign in to comment.