зеркало из https://github.com/github/vitess-gh.git
Merge commit 'a64f1a634ff57f3902770cfc75bd10249d898245'
This commit is contained in:
Коммит
dcd66642de
|
@ -8,11 +8,11 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/db"
|
||||
_ "github.com/youtube/vitess/go/vt/client2"
|
||||
_ "github.com/youtube/vitess/go/vt/client2/tablet"
|
||||
|
@ -105,7 +105,7 @@ func main() {
|
|||
log.Fatalf("client error: %v", err)
|
||||
}
|
||||
|
||||
log.Println("Sending the query...")
|
||||
log.Infof("Sending the query...")
|
||||
now := time.Now()
|
||||
|
||||
// handle dml
|
||||
|
@ -126,7 +126,7 @@ func main() {
|
|||
}
|
||||
|
||||
n, err := r.RowsAffected()
|
||||
log.Println("Total time:", time.Now().Sub(now), "Rows affected:", n)
|
||||
log.Infof("Total time:", time.Now().Sub(now), "Rows affected:", n)
|
||||
} else {
|
||||
|
||||
// launch the query
|
||||
|
@ -147,7 +147,7 @@ func main() {
|
|||
for _, field := range cols {
|
||||
line += "\t" + field
|
||||
}
|
||||
log.Println(line)
|
||||
log.Infof(line)
|
||||
}
|
||||
|
||||
// get the rows
|
||||
|
@ -168,13 +168,13 @@ func main() {
|
|||
line += "\t"
|
||||
}
|
||||
}
|
||||
log.Println(line)
|
||||
log.Infof(line)
|
||||
}
|
||||
rowIndex++
|
||||
}
|
||||
if err := r.Err(); err != nil {
|
||||
log.Fatalf("Error %v\n", err)
|
||||
}
|
||||
log.Println("Total time:", time.Now().Sub(now), "Row count:", rowIndex)
|
||||
log.Infof("Total time:", time.Now().Sub(now), "Row count:", rowIndex)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"archive/zip"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
|
@ -16,6 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
opts "code.google.com/p/opts-go"
|
||||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/terminal"
|
||||
"github.com/youtube/vitess/go/zk"
|
||||
|
||||
|
@ -131,7 +131,6 @@ func init() {
|
|||
"watch": cmdWatch,
|
||||
"zip": cmdZip,
|
||||
}
|
||||
log.SetFlags(0)
|
||||
|
||||
zconn = zk.NewMetaConn(false)
|
||||
}
|
||||
|
@ -259,7 +258,7 @@ func cmdElock(args []string) {
|
|||
zconn.Delete(zkPath, -1)
|
||||
return
|
||||
case event := <-watch:
|
||||
log.Printf("elock: event %v: %v", zkPath, event)
|
||||
log.Infof("elock: event %v: %v", zkPath, event)
|
||||
if !event.Ok() {
|
||||
//log.Fatalf("elock: error %v: %v", zkPath, event)
|
||||
break watchLoop
|
||||
|
@ -293,13 +292,13 @@ func cmdWatch(args []string) {
|
|||
case <-sigRecv:
|
||||
return
|
||||
case event := <-eventChan:
|
||||
log.Printf("watch: event %v: %v", event.Path, event)
|
||||
log.Infof("watch: event %v: %v", event.Path, event)
|
||||
if event.Type == zookeeper.EVENT_CHANGED {
|
||||
data, stat, watch, err := zconn.GetW(event.Path)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: failed to watch %v", err)
|
||||
}
|
||||
log.Printf("watch: %v %v\n", event.Path, stat)
|
||||
log.Infof("watch: %v %v\n", event.Path, stat)
|
||||
println(data)
|
||||
go func() {
|
||||
eventChan <- <-watch
|
||||
|
@ -307,7 +306,7 @@ func cmdWatch(args []string) {
|
|||
} else if event.State == zookeeper.STATE_CLOSED {
|
||||
return
|
||||
} else if event.Type == zookeeper.EVENT_DELETED {
|
||||
log.Printf("watch: %v deleted\n", event.Path)
|
||||
log.Infof("watch: %v deleted\n", event.Path)
|
||||
} else {
|
||||
// Most likely a session event - try t
|
||||
_, _, watch, err := zconn.GetW(event.Path)
|
||||
|
@ -358,7 +357,7 @@ func cmdLs(args []string) {
|
|||
if err != nil {
|
||||
hasError = true
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
log.Printf("ls: cannot access %v: %v", zkPath, err)
|
||||
log.Warningf("ls: cannot access %v: %v", zkPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +383,7 @@ func cmdLs(args []string) {
|
|||
stat, err := zconn.Exists(localPath)
|
||||
if err != nil {
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
log.Printf("ls: cannot access: %v: %v", localPath, err)
|
||||
log.Warningf("ls: cannot access: %v: %v", localPath, err)
|
||||
}
|
||||
} else {
|
||||
stats[i] = stat
|
||||
|
@ -521,7 +520,7 @@ func cmdRm(args []string) {
|
|||
if err != nil {
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
hasError = true
|
||||
log.Printf("rm: cannot delete %v: %v", zkPath, err)
|
||||
log.Warningf("rm: cannot delete %v: %v", zkPath, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +551,7 @@ func cmdCat(args []string) {
|
|||
if err != nil {
|
||||
hasError = true
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
log.Printf("cat: cannot access %v: %v", zkPath, err)
|
||||
log.Warningf("cat: cannot access %v: %v", zkPath, err)
|
||||
}
|
||||
} else {
|
||||
if *longListing {
|
||||
|
@ -578,7 +577,7 @@ func cmdEdit(args []string) {
|
|||
data, stat, err := zconn.Get(zkPath)
|
||||
if err != nil {
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
log.Printf("edit: cannot access %v: %v", zkPath, err)
|
||||
log.Warningf("edit: cannot access %v: %v", zkPath, err)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -591,7 +590,7 @@ func cmdEdit(args []string) {
|
|||
f.Close()
|
||||
}
|
||||
if err != nil {
|
||||
log.Printf("edit: cannot write file %v", err)
|
||||
log.Warningf("edit: cannot write file %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -602,15 +601,13 @@ func cmdEdit(args []string) {
|
|||
err = cmd.Run()
|
||||
if err != nil {
|
||||
os.Remove(tmpPath)
|
||||
log.Printf("edit: cannot start $EDITOR: %v", err)
|
||||
os.Exit(1)
|
||||
log.Fatalf("edit: cannot start $EDITOR: %v", err)
|
||||
}
|
||||
|
||||
fileData, err := ioutil.ReadFile(tmpPath)
|
||||
if err != nil {
|
||||
os.Remove(tmpPath)
|
||||
log.Printf("edit: cannot read file %v", err)
|
||||
os.Exit(1)
|
||||
log.Fatalf("edit: cannot read file %v", err)
|
||||
}
|
||||
|
||||
if string(fileData) != data {
|
||||
|
@ -618,8 +615,7 @@ func cmdEdit(args []string) {
|
|||
_, err = zconn.Set(zkPath, string(fileData), stat.Version())
|
||||
if err != nil {
|
||||
os.Remove(tmpPath)
|
||||
log.Printf("edit: cannot write zk file %v", err)
|
||||
os.Exit(1)
|
||||
log.Fatalf("edit: cannot write zk file %v", err)
|
||||
}
|
||||
}
|
||||
os.Remove(tmpPath)
|
||||
|
@ -648,7 +644,7 @@ func cmdStat(args []string) {
|
|||
if err != nil {
|
||||
hasError = true
|
||||
if !*force || !zookeeper.IsError(err, zookeeper.ZNONODE) {
|
||||
log.Printf("stat: cannot access %v: %v", zkPath, err)
|
||||
log.Warningf("stat: cannot access %v: %v", zkPath, err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
@ -735,7 +731,7 @@ func cmdChmod(args []string) {
|
|||
aclv, _, err := zconn.ACL(zkPath)
|
||||
if err != nil {
|
||||
hasError = true
|
||||
log.Printf("chmod: cannot set access %v: %v", zkPath, err)
|
||||
log.Warningf("chmod: cannot set access %v: %v", zkPath, err)
|
||||
continue
|
||||
}
|
||||
if addPerms {
|
||||
|
@ -746,7 +742,7 @@ func cmdChmod(args []string) {
|
|||
err = zconn.SetACL(zkPath, aclv, -1)
|
||||
if err != nil {
|
||||
hasError = true
|
||||
log.Printf("chmod: cannot set access %v: %v", zkPath, err)
|
||||
log.Warningf("chmod: cannot set access %v: %v", zkPath, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/rpcplus"
|
||||
"github.com/youtube/vitess/go/rpcwrap/bsonrpc"
|
||||
"github.com/youtube/vitess/go/sync2"
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
"github.com/youtube/vitess/go/sync2"
|
||||
"github.com/youtube/vitess/go/testfiles"
|
||||
"github.com/youtube/vitess/go/vt/mysqlctl/proto"
|
||||
"github.com/youtube/vitess/go/vt/binlog/proto"
|
||||
)
|
||||
|
||||
func TestPosParse(t *testing.T) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/youtube/vitess/go/vt/mysqlctl/proto"
|
||||
"github.com/youtube/vitess/go/vt/binlog/proto"
|
||||
)
|
||||
|
||||
type eventErrorCase struct {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/youtube/vitess/go/vt/binlog/proto"
|
||||
"github.com/youtube/vitess/go/vt/key"
|
||||
"github.com/youtube/vitess/go/vt/mysqlctl/proto"
|
||||
)
|
||||
|
||||
var testKeyRange = key.KeyRange{
|
||||
|
|
|
@ -112,7 +112,7 @@ func TestWarning(t *testing.T) {
|
|||
ioutil.ReadAll(out)
|
||||
mbl.Wait()
|
||||
logutil.Flush()
|
||||
warnbytes, err := ioutil.ReadFile(path.Join(os.TempDir(), "mysqlctl.test.WARNING"))
|
||||
warnbytes, err := ioutil.ReadFile(path.Join(os.TempDir(), "binlog.test.WARNING"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func TestError(t *testing.T) {
|
|||
ioutil.ReadAll(out)
|
||||
mbl.Wait()
|
||||
logutil.Flush()
|
||||
warnbytes, err := ioutil.ReadFile(path.Join(os.TempDir(), "mysqlctl.test.ERROR"))
|
||||
warnbytes, err := ioutil.ReadFile(path.Join(os.TempDir(), "binlog.test.ERROR"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
|
@ -5,11 +5,9 @@
|
|||
package binlog
|
||||
|
||||
import (
|
||||
//"fmt"
|
||||
"testing"
|
||||
|
||||
// "github.com/youtube/vitess/go/vt/key"
|
||||
"github.com/youtube/vitess/go/vt/mysqlctl/proto"
|
||||
"github.com/youtube/vitess/go/vt/binlog/proto"
|
||||
)
|
||||
|
||||
var testTables = []string{
|
||||
|
|
|
@ -11,10 +11,10 @@ package tablet
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/db"
|
||||
mproto "github.com/youtube/vitess/go/mysql/proto"
|
||||
"github.com/youtube/vitess/go/rpcplus"
|
||||
|
@ -315,7 +315,7 @@ func (sr *StreamResult) Next() (row []interface{}) {
|
|||
qr, ok := <-sr.sr
|
||||
if !ok {
|
||||
if sr.call.Error != nil {
|
||||
log.Printf("vt: error reading the next value %v", sr.call.Error.Error())
|
||||
log.Warningf("vt: error reading the next value %v", sr.call.Error.Error())
|
||||
sr.err = sr.call.Error
|
||||
}
|
||||
return nil
|
||||
|
|
Загрузка…
Ссылка в новой задаче