Skip to content

Commit

Permalink
update log
Browse files Browse the repository at this point in the history
Signed-off-by: lance6716 <lance6716@gmail.com>
  • Loading branch information
lance6716 committed Aug 24, 2023
1 parent 7e29a1b commit 8f4ca49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion br/pkg/lightning/backend/local/mockserver/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import (
)

func main() {
lis, err := net.Listen("tcp", ":0")
portStr := os.Args[1]
lis, err := net.Listen("tcp", ":"+portStr)
if err != nil {
log.Fatal(err)
}
Expand Down
14 changes: 9 additions & 5 deletions br/pkg/lightning/backend/local/mockserver/main2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package main
import (
"context"
"fmt"
"log"
"os"

sst "github.com/pingcap/kvproto/pkg/import_sstpb"
"github.com/pingcap/log"
"go.uber.org/zap"
"google.golang.org/grpc"
)

Expand All @@ -29,13 +30,14 @@ func main() {

conn, err := grpc.DialContext(ctx, os.Args[1], grpc.WithInsecure())
if err != nil {
log.Fatal(err)
log.Fatal("fail to dial", zap.Error(err))
}
for {
client := sst.NewImportSSTClient(conn)
stream, err := client.Write(ctx)
if err != nil {
log.Fatal(err)
log.Error("fail to write", zap.Error(err))
continue
}
err = stream.Send(&sst.WriteRequest{
Chunk: &sst.WriteRequest_Meta{
Expand All @@ -45,11 +47,13 @@ func main() {
},
})
if err != nil {
log.Fatal(err)
log.Error("fail to send", zap.Error(err))
continue
}
resp, err := stream.CloseAndRecv()
if err != nil {
log.Fatal(err)
log.Error("fail to close and recv", zap.Error(err))
continue
}
fmt.Printf("resp: %v\n", resp)
}
Expand Down

0 comments on commit 8f4ca49

Please sign in to comment.