-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Verification of persisted data #12901
Conversation
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.
Looks correct. Commented on a couple minor things.
if index > hardstate.Commit { | ||
return fmt.Errorf("backend.ConsistentIndex (%v) must be < WAL.HardState.commit (%v)", index, hardstate.Commit) | ||
} | ||
if cfg.ExactIndex && index != hardstate.Commit { |
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.
Move this check above if index > hardstate.Commit
check?
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.
Done (but not sure about the motivation)
Logger *zap.Logger | ||
} | ||
|
||
func Verify(cfg Config) 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.
Do we need to document any non-obvious expectations this function has? E.g. Since it opens a backend, is it required that the backend not already be open?
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.
Done
9310f85
to
e14a9fe
Compare
e14a9fe
to
9598517
Compare
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.
LGTM
For now verifies whete Backend.cindex is consistent with WAL log, but should get expanded to cover memberships & revisions.
Verification framework is integrated with: - integration tests (by default) - `ETCD_VERIFY=all etcdctl snapshot restore` command - etcd shutdown when running with `ETCD_VERIFY=all` env.
9598517
to
c4b13a5
Compare
Thank you for review. |
Introducing a package that contains encoded invariants about etcd data model.
This package is used by tests and (opt-in) in business logic.
The purpose is:
For now its seeded with 2 checks:
Verification framework is integrated with:
ETCD_VERIFY=all etcdctl snapshot restore
commandETCD_VERIFY=all
env.