more logs since k6 is fucked
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ func ErrorHandler(fn func(w http.ResponseWriter, r *http.Request) error) func(w
|
|||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
err := fn(w, r)
|
err := fn(w, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("Server error, not remote error: %v\n", err)
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
}
|
}
|
||||||
@@ -57,6 +59,7 @@ func (s *PoolServer) WriteResult(w http.ResponseWriter, result *CallResult) erro
|
|||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.Header().Set("X-Pod-Name", s.pod_name)
|
w.Header().Set("X-Pod-Name", s.pod_name)
|
||||||
if result.StatusCode != 200 {
|
if result.StatusCode != 200 {
|
||||||
|
log.Printf("Call error: %d\n", result.StatusCode)
|
||||||
if result.StatusCode >= 200 && result.StatusCode < 600 {
|
if result.StatusCode >= 200 && result.StatusCode < 600 {
|
||||||
w.WriteHeader(int(result.StatusCode))
|
w.WriteHeader(int(result.StatusCode))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ func (p *SyncedPool) RequestOwnership(id CartId) error {
|
|||||||
if !r.IsHealthy() {
|
if !r.IsHealthy() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Printf("Asking for confirmation change of %s to %s (me) with %s\n", id, p.Hostname, r.Host)
|
//log.Printf("Asking for confirmation change of %s to %s (me) with %s\n", id, p.Hostname, r.Host)
|
||||||
err := r.ConfirmChange(id, p.Hostname)
|
err := r.ConfirmChange(id, p.Hostname)
|
||||||
all++
|
all++
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -352,14 +352,10 @@ func (p *SyncedPool) RequestOwnership(id CartId) error {
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Printf("Remote confirmed change %s\n", r.Host)
|
//log.Printf("Remote confirmed change %s\n", r.Host)
|
||||||
ok++
|
ok++
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok == 0 && all > 0 {
|
|
||||||
p.removeLocalGrain(id)
|
|
||||||
return fmt.Errorf("no remotes confirmed change")
|
|
||||||
}
|
|
||||||
if (all < 3 && ok < all) || ok < (all/2) {
|
if (all < 3 && ok < all) || ok < (all/2) {
|
||||||
p.removeLocalGrain(id)
|
p.removeLocalGrain(id)
|
||||||
return fmt.Errorf("quorum not reached")
|
return fmt.Errorf("quorum not reached")
|
||||||
|
|||||||
Reference in New Issue
Block a user