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

[dbnode] Cleanup error -> warning log level for partial/corrupt snapshot/commit log files #1592

Merged
merged 3 commits into from
Apr 29, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/dbnode/storage/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ func (m *cleanupManager) cleanupExpiredNamespaceDataFiles(earliestToRetain time.
//
// This process is also modeled formally in TLA+ in the file `SnapshotsSpec.tla`.
func (m *cleanupManager) cleanupSnapshotsAndCommitlogs() (finalErr error) {
logger := m.opts.InstrumentOptions().Logger().With(
zap.String("comment",
"partial/corrupt files are expected as result of a restart (this is ok)"),
)

namespaces, err := m.database.GetOwnedNamespaces()
if err != nil {
return err
Expand Down Expand Up @@ -374,11 +379,10 @@ func (m *cleanupManager) cleanupSnapshotsAndCommitlogs() (finalErr error) {
// have no impact on correctness as the snapshot files from previous (successful) snapshot will still be
// retained.
m.metrics.corruptSnapshotFile.Inc(1)
m.opts.InstrumentOptions().Logger().With(
logger.With(
zap.Error(err),
zap.Strings("files", snapshot.AbsoluteFilepaths),
).Error(
"encountered corrupt snapshot file during cleanup, marking files for deletion")
).Warn("corrupt snapshot file during cleanup, marking files for deletion")
filesToDelete = append(filesToDelete, snapshot.AbsoluteFilepaths...)
continue
}
Expand All @@ -402,12 +406,11 @@ func (m *cleanupManager) cleanupSnapshotsAndCommitlogs() (finalErr error) {
// Delete corrupt snapshot metadata files.
for _, errorWithPath := range snapshotMetadataErrorsWithPaths {
m.metrics.corruptSnapshotMetadataFile.Inc(1)
m.opts.InstrumentOptions().Logger().With(
logger.With(
zap.Error(errorWithPath.Error),
zap.String("metadataFilePath", errorWithPath.MetadataFilePath),
zap.String("checkpointFilePath", errorWithPath.CheckpointFilePath),
).Error(
"encountered corrupt snapshot metadata file during cleanup, marking files for deletion")
).Warn("corrupt snapshot metadata file during cleanup, marking files for deletion")
filesToDelete = append(filesToDelete, errorWithPath.MetadataFilePath)
filesToDelete = append(filesToDelete, errorWithPath.CheckpointFilePath)
}
Expand Down Expand Up @@ -454,10 +457,10 @@ func (m *cleanupManager) cleanupSnapshotsAndCommitlogs() (finalErr error) {
// If we were unable to read the commit log files info header, then we're forced to assume
// that the file is corrupt and remove it. This can happen in situations where M3DB experiences
// sudden shutdown.
m.opts.InstrumentOptions().Logger().With(
logger.With(
zap.Error(errorWithPath),
zap.String("path", errorWithPath.Path()),
).Error("encountered corrupt commitlog file during cleanup, marking file for deletion")
).Warn("corrupt commitlog file during cleanup, marking file for deletion")
filesToDelete = append(filesToDelete, errorWithPath.Path())
}

Expand Down