-
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
mvcc:add ut for Revisions/CountRevisions and remove RangeSince as it … #14124
Conversation
server/storage/mvcc/index.go
Outdated
@@ -107,6 +105,9 @@ func (ti *treeIndex) unsafeVisit(key, end []byte, f func(ki *keyIndex) bool) { | |||
}) | |||
} | |||
|
|||
// Revisions returns limited number of revisions from key(including) to end(excluding) | |||
// at the given rev. The returned slice is sorted in the order of key. | |||
// There is no limit if limit <= 0. |
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.
It seems also important that 'total' is not capped by the limit and reflects all the revisions.
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.
Comments:
including
toincluded
, andexcluding
toexcluded
? This applies to the comment for methodCountRevisions
as well.- adding comment something like "The second return parameter
total
isn't capped by thelimit
, and reflects all the expected revisions".
I'd defer to @spzala to correct the syntax of the comment.
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.
Thanks for review, update as you commented.
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.
Thank you for the improvements and expanding the tests.
Overall looks good to me. Thank you. Leave @spzala to final decision. |
server/storage/mvcc/index.go
Outdated
@@ -107,6 +105,9 @@ func (ti *treeIndex) unsafeVisit(key, end []byte, f func(ki *keyIndex) bool) { | |||
}) | |||
} | |||
|
|||
// Revisions returns limited number of revisions from key(included) to end(excluded) | |||
// at the given rev. The returned slice is sorted in the order of key. There is no limit if limit <= 0. | |||
// The second return parameter total isn't capped by the limit, and reflects all the expected revisions. |
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.
Minor comment: replace total with total
.
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.
Yes, minor but it would be good to make change considering how the parameter name. May be it will be more consistent with readability by changing the sentence to The second return parameter isn't capped by the limit and reflects the total number of revisions.
Also, this way no need to markdown any variable?. cc @ahrtr
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.
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.
Updated. Thanks a lot
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.
One comment in-line but otherwise looks good. Thanks @wayblink
server/storage/mvcc/index.go
Outdated
@@ -107,6 +105,9 @@ func (ti *treeIndex) unsafeVisit(key, end []byte, f func(ki *keyIndex) bool) { | |||
}) | |||
} | |||
|
|||
// Revisions returns limited number of revisions from key(included) to end(excluded) | |||
// at the given rev. The returned slice is sorted in the order of key. There is no limit if limit <= 0. | |||
// The second return parameter total isn't capped by the limit, and reflects all the expected revisions. |
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.
Yes, minor but it would be good to make change considering how the parameter name. May be it will be more consistent with readability by changing the sentence to The second return parameter isn't capped by the limit and reflects the total number of revisions.
Also, this way no need to markdown any variable?. cc @ahrtr
…is not used Signed-off-by: wayblink <wayasxxx@gmail.com>
It is kind of backport from etcd-io#14124. Signed-off-by: Wei Fu <fuweid89@gmail.com>
It is kind of backport from etcd-io#14124. Signed-off-by: Wei Fu <fuweid89@gmail.com>
…is not used
Signed-off-by: wayblink wayasxxx@gmail.com