-
Notifications
You must be signed in to change notification settings - Fork 634
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
add PreLoadFreelist to support loading free pages in readonly mode #381
Conversation
tx.go
Outdated
@@ -652,6 +652,9 @@ func (tx *Tx) Page(id int) (*PageInfo, error) { | |||
return nil, nil | |||
} | |||
|
|||
// Force loading free list if opened in ReadOnly mode. | |||
tx.db.loadFreelist() |
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 PR.
Everything looks good to me apart this line. As we discussed in #371 , I find it a risk and indeterminism if within a blocking (exclusive lock) transaction we perform lazy initialization with cost of O(db) size.
I would prefer the call to exit with error that Page(is) is not supported in RO transaction without pre-loaded free pages.
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.
I think it (db.loadFreelist()
) can stay in check:
- it's already O(all pages) operation to perform check
- it's goal it's explicitly to fail in case of any problems is the storage-layer.
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. Please take a look at the third commit d2fae80
thx
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
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. Please merge when the tests are green.
Thank you for the review |
Fixes #372
Signed-off-by: Benjamin Wang wachao@vmware.com