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

Always check if shard is local when accessing its stats #2449

Merged
merged 1 commit into from
Apr 29, 2015
Merged

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Apr 29, 2015

No description provided.

@otoolep
Copy link
Contributor Author

otoolep commented Apr 29, 2015

Fixes issue #2452

@@ -3355,7 +3359,7 @@ func (s *Server) DiagnosticsAsRows() []*influxql.Row {
nodes = append(nodes, strconv.FormatUint(n, 10))
}
var path string
if sh.store != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not strictly necessary, but standardizes on using HasDataNodeID to check if a shard is local.

@otoolep otoolep changed the title Test stats on a cluster Always check if shard is local when accessing its stats Apr 29, 2015
@@ -234,7 +234,9 @@ func (s *Shard) close() error {
if s.store != nil {
_ = s.store.Close()
}
s.stats.Inc("close")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also caused panic. We need to continue to rework the shard type in our code. @corylanou started some of this work.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how stats can ever be nil. We instantiate it for both creating or opening a shard. It feels like somewhere else in our code we are creating a shard and not instantiating it properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is why we need to continue to rework this code. Here:

https://github.com/influxdb/influxdb/blob/master/server.go#L318

we add shards, but never open them. But in this function nothing prevents close being called on a shard object that was never opened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/influxdb/influxdb/blob/master/server.go#L275 is where shards can be closed that were never opened.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other problem it would appear is something is calling code when the server is shut down, which doesn't seem right either.

@corylanou
Copy link
Contributor

+1

@otoolep
Copy link
Contributor Author

otoolep commented Apr 29, 2015

Thanks @corylanou -- I have opened ticket #2455 to work on refactoring.

otoolep added a commit that referenced this pull request Apr 29, 2015
Always check if shard is local when accessing its stats
@otoolep otoolep merged commit cadc4ec into master Apr 29, 2015
@otoolep otoolep deleted the diags_panic branch April 29, 2015 22:10
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.

2 participants