Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated leaves start at the size of the tree #147

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hammer/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (r *LeafReader) Run(ctx context.Context) {
klog.V(2).Infof("LeafReader getting %d", i)
_, err := r.getLeaf(ctx, i, size)
if err != nil {
r.errchan <- fmt.Errorf("failed to get leaf: %v", err)
r.errchan <- fmt.Errorf("failed to get leaf %d: %v", i, err)
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions hammer/hammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
MaxIdleConnsPerHost: 256,
DisableKeepAlives: false,
},
Timeout: 5 * time.Second,
}
)

Expand Down Expand Up @@ -129,7 +130,7 @@ func NewHammer(tracker *client.LogStateTracker, f client.Fetcher, addURL *url.UR
for i := 0; i < *numReadersFull; i++ {
fullReaders[i] = NewLeafReader(tracker, f, MonotonicallyIncreasingNextLeaf(), *leafBundleSize, readThrottle.tokenChan, errChan)
}
gen := newLeafGenerator()
gen := newLeafGenerator(tracker.LatestConsistent.Size)
for i := 0; i < *numWriters; i++ {
writers[i] = NewLogWriter(hc, addURL, gen, writeThrottle.tokenChan, errChan)
}
Expand Down Expand Up @@ -207,11 +208,11 @@ func (h *Hammer) Run(ctx context.Context) {
}()
}

func newLeafGenerator() func() []byte {
func newLeafGenerator(start uint64) func() []byte {
const dupChance = 0.1
var g int64
var g uint64 = start
return func() []byte {
var r int64
var r uint64
if rand.Float64() <= dupChance {
// This one will actually be unique, but the next iteration will
// duplicate it. In future, this duplication could be randomly
Expand Down
Loading