-
Notifications
You must be signed in to change notification settings - Fork 324
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
[db] panic when writing db returns no space #3664
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Codecov Report
@@ Coverage Diff @@
## master #3664 +/- ##
==========================================
- Coverage 74.95% 74.78% -0.18%
==========================================
Files 269 266 -3
Lines 23819 23769 -50
==========================================
- Hits 17854 17775 -79
- Misses 5039 5069 +30
+ Partials 926 925 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -86,6 +88,9 @@ func (b *BoltDB) Put(namespace string, key, value []byte) (err error) { | |||
} | |||
} | |||
if err != nil { | |||
if errors.Is(err, syscall.ENOSPC) { |
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.
or should we use errors.Cause(err) == syscall.ENOSPC
? can you look at bolt db source code to verify?
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.
errors.Cause(err)
returns write /run/data/chain.db: no space left on device
syscall.ENOSPC
is no space left on device
errors.Is
means syscall.ENOSPC
matches err
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.
errors.Is(ENOSPC, erros.Cause(err))
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.
// An error is considered to match a target if it is equal to that target or if
// it implements a method Is(error) bool such that Is(target) returns true.
func Is(err, target error) bool { return stderrors.Is(err, target) }
i think better to use errors.Cause() == xxx
if possible? this is how error is decided in the codebase, try to be consistent
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.
// An error is considered to match a target if it is equal to that target or if
// it implements a method Is(error) bool such that Is(target) returns true.
func Is(err, target error) bool { return stderrors.Is(err, target) }
can you verify (or write a test case) this is the case?
@@ -86,6 +88,9 @@ func (b *BoltDB) Put(namespace string, key, value []byte) (err error) { | |||
} | |||
} | |||
if err != nil { | |||
if errors.Is(err, syscall.ENOSPC) { |
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.
// An error is considered to match a target if it is equal to that target or if
// it implements a method Is(error) bool such that Is(target) returns true.
func Is(err, target error) bool { return stderrors.Is(err, target) }
can you verify (or write a test case) this is the case?
log.L().Panic("Failed to stop monitor disk space.", zap.Error(err)) | ||
} | ||
}() | ||
|
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.
looks like you are reverting an earlier commit? can you open another PR to just revert that commit?
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.
Description
User can define different partition path for chaindb/indexdb/triedb... in config.yaml. Monitor chaindb is not enough.
These dbs are almost all large after a long time, so check writing db can be accurate.
Fixes #3629
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: