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

check error when opening shard DBs. #3521

Merged
merged 1 commit into from
Aug 10, 2015

Conversation

DanielMorsing
Copy link
Contributor

Doing the initial work on #3516, I suspect that it's an issue where
we're throwing away an opening error and then accessing the database
to cause the panic. Since we threw away this error before, let's log
it so that we can see what's happening.

It doesn't fix the error proper, since the shard will still not be
accessible, but it will give us a better idea what's going on.

shard.Open()
err = shard.Open()
if err != nil {
s.Logger.Printf("failed to open shard %d: %s", shardID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like a real error here, I think we should actually return the error, not log it and continue. if you can't load a shard something bad happened, and likely is going to have something else bad happen if we let it continue. @pauldix thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm not clear which is the correct way to go either. It does feel like if a general shard.Open() fails something bad happened, and I would like to have more context on if we really should continue or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

The check here https://github.com/DanielMorsing/influxdb/blob/sharderrcheck/tsdb/store.go#L233, is making sure the file in the directory is actually named how shards we created are named. It's to prevent trying to open something like 1.bak which is not a file we would create.

L242 should return the error because we should only ever be attempting to open valid shards at this point. A failure would be problem.

This should catch the case where someone messed up the permisssions
for a database that they moved from one machine to another.
@DanielMorsing
Copy link
Contributor Author

I have a suspicion that #3603 is a result of this error not being checked.

@otoolep
Copy link
Contributor

otoolep commented Aug 10, 2015

+1, I will disable the failing test and open a bug.

DanielMorsing added a commit that referenced this pull request Aug 10, 2015
check error when opening shard DBs.
@DanielMorsing DanielMorsing merged commit 41733f6 into influxdata:master Aug 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants