-
Notifications
You must be signed in to change notification settings - Fork 652
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
Dedupe Reload/NoSyncReload, prefer empty instead of nil init #804
Conversation
internal/freelist/freelist.go
Outdated
@@ -65,7 +66,7 @@ type Interface interface { | |||
// NoSyncReload reads the freelist from Pgids and filters out pending items. | |||
NoSyncReload(pgIds common.Pgids) | |||
|
|||
// freePageIds returns the IDs of all free pages. | |||
// freePageIds returns the IDs of all free pages. No free pages returns an empty slice. |
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.
// freePageIds returns the IDs of all free pages. No free pages returns an empty slice. | |
// freePageIds returns the IDs of all free pages. Returns an empty slice if no free pages are available. |
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.
applied
internal/freelist/freelist.go
Outdated
Free(txId common.Txid, p *common.Page) | ||
|
||
// Freed returns whether a given page is in the free list. | ||
Freed(pgId common.Pgid) bool | ||
|
||
// Rollback removes the pages from a given pending tx. | ||
// Should always be followed by Reload or NoSyncReload from last freelist state. |
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.
Such restriction isn't friendly to users. We should consider to get rid of such restriction in following PRs. We can discuss this separately.
// Should always be followed by Reload or NoSyncReload from last freelist state. |
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.
applied
Reload and NoSyncReload have duplicated code, this unifies both for later refactoring. This PR is split from etcd-io#786, where the tests found differences on reloading and nil/empty initializations. Added some more clarifications in godocs for certain panic behavior and expected returns on the interface. Signed-off-by: Thomas Jungblut <[email protected]>
4061583
to
33b71a5
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
Thanks
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, tjungblu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Reload and NoSyncReload have duplicated code, this unifies both for later refactoring.
This PR is split from #786, where the tests found differences on reloading and nil/empty initializations. Added some more clarifications in godocs for certain panic behavior and expected returns on the interface.