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

[0.10.2] Backport #5594 to 0.10.0 #5933

Merged
merged 3 commits into from
Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
### Bugfixes

- [#5924](https://github.com/influxdata/influxdb/issues/5924): Missing data after using influx\_tsm
- [#5594](https://github.com/influxdata/influxdb/pull/5594): Fix missing url params on lease redirect - @oldmantaiter

## v0.10.2 [2016-03-03]
### Bugfixes
Expand Down
33 changes: 18 additions & 15 deletions services/meta/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,23 @@ func (h *handler) servePing(w http.ResponseWriter, r *http.Request) {

// serveLease
func (h *handler) serveLease(w http.ResponseWriter, r *http.Request) {
var name, nodeIDStr string
q := r.URL.Query()

// Get the requested lease name.
name = q.Get("name")
if name == "" {
http.Error(w, "lease name required", http.StatusBadRequest)
return
}

// Get the ID of the requesting node.
nodeIDStr = q.Get("nodeid")
if nodeIDStr == "" {
http.Error(w, "node ID required", http.StatusBadRequest)
return
}

// Redirect to leader if necessary.
leader := h.store.leaderHTTP()
if leader != h.s.httpAddr {
Expand All @@ -322,25 +339,11 @@ func (h *handler) serveLease(w http.ResponseWriter, r *http.Request) {
scheme = "https://"
}

leader = scheme + leader + "/lease"
leader = scheme + leader + "/lease?" + q.Encode()
http.Redirect(w, r, leader, http.StatusTemporaryRedirect)
return
}

q := r.URL.Query()

// Get the requested lease name.
name := q.Get("name")
if name == "" {
http.Error(w, "lease name required", http.StatusBadRequest)
return
}
// Get the ID of the requesting node.
nodeIDStr := q.Get("nodeid")
if name == "" {
http.Error(w, "node ID required", http.StatusBadRequest)
return
}
// Convert node ID to an int.
nodeID, err := strconv.ParseUint(nodeIDStr, 10, 64)
if err != nil {
Expand Down