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
New spanner db structure #6061
New spanner db structure #6061
Conversation
go.mod
Outdated
@@ -28,7 +28,6 @@ require ( | |||
github.com/go-yaml/yaml v2.1.0+incompatible | |||
github.com/gogo/protobuf v1.3.1 | |||
github.com/golang/gddo v0.0.0-20200528160355-8d077c1d8f4c | |||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 // indirect |
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.
Any idea what this is? Maybe @prestonvanloon knows?
@0xKiwi added the benchmark results |
slasher/db/iface/interface.go
Outdated
type EpochSpans interface { | ||
SetValidatorSpan(ctx context.Context, idx uint64, newSpan detectionTypes.Span) error | ||
GetValidatorSpan(ctx context.Context, idx uint64) (detectionTypes.Span, error) | ||
} |
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.
Maybe this should go in slasher/types
?
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.
i think its good here. maybe another db impl will need to move it to db somehow
Tests are failing, I've tried to fix but I have to move to other tasks. |
slasher/db/kv/spanner_new.go
Outdated
// SetValidatorSpan marshal a validator span into an encoded, flattened array. | ||
func (es EpochStore) SetValidatorSpan(ctx context.Context, idx uint64, newSpan types.Span) error { | ||
if len(es)%spannerEncodedLength != 0 { | ||
return errors.New("wrong data length for min max span byte array") |
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.
Maybe this can be moved into a NewEpochStore([]byte)
function? Seems weird to have the function return an error for something that should be checked on creation.
Would be great to make an epoch_store.go
with these functions as well.
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.
added NewEpochStore. kept error in place for extra safety
…new_spanner_db # Conflicts: # slasher/db/kv/spanner_new_test.go
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
In order to be able to remove the look-back value there is a need to reduce the complexity of the spanner db(less indices)
This pr replaces the index per validator per epoch with one record per epoch
Which issues(s) does this PR fix?
Part Of #5854