release-0.4
Xiang Li 2013-08-11 09:48:12 -07:00
parent 434b0045db
commit d3649d3254
4 changed files with 11 additions and 11 deletions

View File

@ -364,7 +364,7 @@ func newTransporter(scheme string, tlsConf tls.Config) transporter {
t.scheme = scheme
tr := &http.Transport{
Dial: dialTimeout,
Dial: dialTimeout,
}
if scheme == "https" {
@ -594,7 +594,7 @@ func joinCluster(s *raft.Server, raftURL string) error {
joinURL := url.URL{Host: raftURL, Scheme: raftTransporter.scheme, Path: "/join"}
debugf("Send Join Request to %s", raftURL)
resp, err := t.Post(joinURL.String(), &b)
for {

View File

@ -109,7 +109,7 @@ func DeleteHttpHandler(w *http.ResponseWriter, req *http.Request) {
func dispatch(c Command, w *http.ResponseWriter, req *http.Request, etcd bool) {
if raftServer.State() == "leader" {
if body, err := raftServer.Do(c); err != nil {
if _, ok := err.(store.NotFoundError); ok {
(*w).WriteHeader(http.StatusNotFound)
(*w).Write(newJsonError(100, err.Error()))

View File

@ -1,25 +1,25 @@
package main
import (
"time"
"fmt"
"time"
)
type snapshotConf struct {
// basic
// basic
checkingInterval time.Duration
lastWrites uint64
writesThr uint64
lastWrites uint64
writesThr uint64
}
var snapConf *snapshotConf
func newSnapshotConf() *snapshotConf {
return &snapshotConf {time.Second*3, etcdStore.TotalWrites(), 20*1000}
return &snapshotConf{time.Second * 3, etcdStore.TotalWrites(), 20 * 1000}
}
func monitorSnapshot() {
for {
for {
time.Sleep(snapConf.checkingInterval)
currentWrites := etcdStore.TotalWrites() - snapConf.lastWrites
@ -31,4 +31,4 @@ func monitorSnapshot() {
fmt.Println(currentWrites)
}
}
}
}

View File

@ -30,4 +30,4 @@ func (s *Store) TotalWrites() uint64 {
bs := s.BasicStats
return bs.Deletes + bs.Sets + bs.TestAndSets
}
}