Skip to content

add PreLoadFreelist to support loading free pages in readonly mode#381

Merged
ahrtr merged 3 commits into
etcd-io:masterfrom
ahrtr:loadfreepage_20230111
Jan 11, 2023
Merged

add PreLoadFreelist to support loading free pages in readonly mode#381
ahrtr merged 3 commits into
etcd-io:masterfrom
ahrtr:loadfreepage_20230111

Conversation

@ahrtr
Copy link
Copy Markdown
Member

@ahrtr ahrtr commented Jan 11, 2023

Fixes #372

Signed-off-by: Benjamin Wang wachao@vmware.com

Comment thread tx.go Outdated
}

// Force loading free list if opened in ReadOnly mode.
tx.db.loadFreelist()
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ptabor for the feedback.

In that case, we need to process

bbolt/tx.go

Lines 418 to 419 in b654ce9

// Force loading free list if opened in ReadOnly mode.
tx.db.loadFreelist()
in the same way. But it might be a breaking change.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

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

ahrtr added 3 commits January 11, 2023 18:10
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Copy link
Copy Markdown
Contributor

@ptabor ptabor left a 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.

@ahrtr
Copy link
Copy Markdown
Member Author

ahrtr commented Jan 11, 2023

Thank you. Please merge when the tests are green.

Thank you for the review

@ahrtr ahrtr merged commit ad85400 into etcd-io:master Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

bbolt pages should distinguish reachable (vs. free) pages

2 participants