-
Notifications
You must be signed in to change notification settings - Fork 107
Conversation
since ~1/3 of the time, we add ranges which typically have a length of tens of chunks, and ~1/3 of the time we add single chunks, the ~1/3 of the time single chunk deletes can't make much impact and i imagine the cache would quickly fill up and we don't exercise the delete path very well. This balances out the average deletions vs the average additions and should thus exercise all different code paths more evenly. Also, update stats so we can compare both number of operations but also number of total chunk adds/deletes, instead of having those masked via the range operations.
Mauro that's a really interesting approach. I think one thing we should add to this is track exactly which chunks we should have at each point in time |
mdata/cache/ccache_metric_test.go
Outdated
// end >= start and both numbers drawn from [min, max) | ||
func getRandomRange(min, max int) (int, int) { | ||
start := getRandomNumber(min, max) | ||
end := getRandomNumber(start, max) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i just realized that this randomness is skewed to the end of the range because, assuming the distribution of start
across min - max
is even, and considering that end
always must be >= start
, then the middle of the resulting range returned from getRandomRange()
at average will above the middle of the range min-max
.
that's not really a problem, just a note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could keep a counter, and every other time, draw an end
first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, we could also just get two random numbers and return the lower one as start
and the higher as end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's elegant I like that.
mdata/cache/ccache_metric_test.go
Outdated
|
||
for i := 0; i < iterations; i++ { | ||
// 0 = Add | ||
// 1 = AddRange | ||
// 2 = Del | ||
action := getRandomNumber(0, 3) | ||
// 2 = Del range (via multi del cals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 3
your changes LGTM @Dieterbe |
@replay how does the latest commit look ? I think it's good to merge now |
that's nice @Dieterbe , makes sense |
Not for merging
Just wanted to show you that I believe that there are probably no ways left to corrupt the cache, as long as the first parameter of
Add()
/AddRange()
(the previous ts) is not above0
and wrong.This randomly adds/deletes stuff from the cache and then keeps checking if it can find a corruption.
I've run that a bunch of times, that's just from one run: