diff --git a/pool-server.go b/pool-server.go index 435ddbf..54c38ff 100644 --- a/pool-server.go +++ b/pool-server.go @@ -2,6 +2,7 @@ package main import ( "encoding/json" + "log" "net/http" "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) { err := fn(w, r) if err != nil { + log.Printf("Server error, not remote error: %v\n", err) w.WriteHeader(http.StatusInternalServerError) 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("X-Pod-Name", s.pod_name) if result.StatusCode != 200 { + log.Printf("Call error: %d\n", result.StatusCode) if result.StatusCode >= 200 && result.StatusCode < 600 { w.WriteHeader(int(result.StatusCode)) } else { diff --git a/synced-pool.go b/synced-pool.go index 11725d8..125fc21 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -339,7 +339,7 @@ func (p *SyncedPool) RequestOwnership(id CartId) error { if !r.IsHealthy() { 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) all++ if err != nil { @@ -352,14 +352,10 @@ func (p *SyncedPool) RequestOwnership(id CartId) error { } continue } - log.Printf("Remote confirmed change %s\n", r.Host) + //log.Printf("Remote confirmed change %s\n", r.Host) ok++ } - if ok == 0 && all > 0 { - p.removeLocalGrain(id) - return fmt.Errorf("no remotes confirmed change") - } if (all < 3 && ok < all) || ok < (all/2) { p.removeLocalGrain(id) return fmt.Errorf("quorum not reached")