Skip to content
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

Open db file in readonly mode for commands which shouldn't update db file #365

Merged
merged 2 commits into from
Dec 28, 2022
Merged

Open db file in readonly mode for commands which shouldn't update db file #365

merged 2 commits into from
Dec 28, 2022

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Dec 27, 2022

Almost all commands shouldn't update the db at all, so we should open the db file in readonly mode.

…file

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr ahrtr added this to the 1.3.7 milestone Dec 27, 2022
@ahrtr
Copy link
Member Author

ahrtr commented Dec 28, 2022

thx @ptabor

@ahrtr ahrtr merged commit 9830ab2 into etcd-io:master Dec 28, 2022
ptabor added a commit to ptabor/bbolt that referenced this pull request Dec 30, 2022
I discoved that after change etcd-io#365 the
'bbolt pages' command stopped working.

The problem is this check:
https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/tx.go#L663
that assumes that freepages has been loaded.

We can either preload the freepages when opening a RO file:
  https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/db.go#L280-L284
but this would slow-down opening RO files.

Thus for now I disable checking whether page is free...

Signed-off-by: Piotr Tabor <ptab@google.com>
ptabor added a commit to ptabor/bbolt that referenced this pull request Jan 3, 2023
I discoved that after change etcd-io#365 the
'bbolt pages' command stopped working.

The problem is this check:
https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/tx.go#L663
that assumes that freepages has been loaded.

We can either preload the freepages when opening a RO file:
  https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/db.go#L280-L284
but this would slow-down opening RO files.

Thus for now I disable checking whether page is free...

Signed-off-by: Piotr Tabor <ptab@google.com>
ptabor added a commit to ptabor/bbolt that referenced this pull request Jan 3, 2023
I discoved that after change etcd-io#365 the
'bbolt pages' command stopped working.

The problem is this check:
https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/tx.go#L663
that assumes that freepages has been loaded.

We can either preload the freepages when opening a RO file:
  https://github.com/etcd-io/bbolt/blob/b654ce922133ff49bb385297f30835ca357bac5f/db.go#L280-L284
but this would slow-down opening RO files.

Thus for now I disable checking whether page is free...

Signed-off-by: Piotr Tabor <ptab@google.com>
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.

2 participants