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

Fix snapshot 500 error #2408

Merged
merged 3 commits into from
Apr 23, 2015
Merged

Fix snapshot 500 error #2408

merged 3 commits into from
Apr 23, 2015

Conversation

corylanou
Copy link
Contributor

I refactored the shard group creation deletion to put the shard responsibility in the shard.go file. Doing this uncovered that we were not removing the shards from the server shard map. This resulted in the snapshot trying to read closed (removed) shards and would respond with a server 500 error.

@@ -1286,6 +1243,12 @@ func (s *Server) applyDeleteShardGroup(m *messaging.Message) (err error) {
s.stats.Add("shardsDeleted", int64(len(g.Shards)))
return tx.saveDatabase(db)
})

// remove from lookups.
for _, sh := range g.Shards {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was causing snapshotting to break.

Copy link
Contributor

Choose a reason for hiding this comment

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

This "lookup" map has caused me problems before. We should think about seeing if there is a way to solve the problems it is solving in another way...later, of course.

@otoolep
Copy link
Contributor

otoolep commented Apr 23, 2015

@corylanou -- when would it respond with 500? Which endpoint would return 500?

@corylanou
Copy link
Contributor Author

Running this cmd:

 influxd backup ~/snapshot.bin

Which called this endpoint:

/data/snapshot

}

// ShardBySeriesID returns the shard that a series is assigned to in the group.
func (g *ShardGroup) ShardBySeriesID(seriesID uint64) *Shard {
return g.Shards[int(seriesID)%len(g.Shards)]
func (sg *ShardGroup) ShardBySeriesID(seriesID uint64) *Shard {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is g to sg considered more idiomatic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the letter to typically be the first letter of the variable I'm referencing. If the variable is made of two words, I usually use the abbreviation. Idiomatic might be a strong word for this, and wasn't really the reason I did it. The real reason is that sometimes I have shards, and like to use s for the shard variable name, and I don't want that to get confused for the ShardGroup which also starts with an s.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@otoolep
Copy link
Contributor

otoolep commented Apr 23, 2015

+1, this makes sense to me. Some small feedback.

@corylanou corylanou force-pushed the shard-creation-refactor branch from 7742d37 to f95dc00 Compare April 23, 2015 22:34
corylanou added a commit that referenced this pull request Apr 23, 2015
@corylanou corylanou merged commit e9f5eaa into master Apr 23, 2015
@corylanou corylanou deleted the shard-creation-refactor branch April 23, 2015 22:43
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.

3 participants