Skip to content

Commit

Permalink
This is an automated cherry-pick of tikv#5310
Browse files Browse the repository at this point in the history
close tikv#5161, ref tikv#5161

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
HuSharp authored and ti-chi-bot committed Jun 30, 2023
1 parent cfdcdff commit 1584544
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,7 @@ func (c *client) WatchGlobalConfig(ctx context.Context) (chan []GlobalConfigItem
return globalConfigWatcherCh, err
}

<<<<<<< HEAD
func (c *client) GetExternalTimestamp(ctx context.Context) (uint64, error) {
resp, err := c.getClient().GetExternalTimestamp(ctx, &pdpb.GetExternalTimestampRequest{
Header: c.requestHeader(),
Expand Down Expand Up @@ -1919,6 +1920,8 @@ func (c *client) SetExternalTimestamp(ctx context.Context, timestamp uint64) err
return nil
}

=======
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
func (c *client) respForErr(observer prometheus.Observer, start time.Time, err error, header *pdpb.ResponseHeader) error {
if err != nil || header.GetError() != nil {
observer.Observe(time.Since(start).Seconds())
Expand Down
Empty file modified server/grpc_service.go
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions server/tso/allocator_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tso
import (
"context"
"fmt"
"github.com/pingcap/errors"
"math"
"path"
"strconv"
Expand Down
1 change: 1 addition & 0 deletions server/tso/global_allocator.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tso
import (
"context"
"fmt"
"github.com/pingcap/errors"
"sync"
"sync/atomic"
"time"
Expand Down
22 changes: 22 additions & 0 deletions tools/pd-heartbeat-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ func initClusterID(ctx context.Context, cli pdpb.PDClient) {
if res.GetHeader().GetError() != nil {
log.Fatal("failed to get members", zap.String("err", res.GetHeader().GetError().String()))
}
if res.GetHeader().GetError() != nil {
log.Fatal(res.GetHeader().GetError())
}
clusterID = res.GetHeader().GetClusterId()
log.Info("init cluster ID successfully", zap.Uint64("cluster-id", clusterID))
}
Expand Down Expand Up @@ -109,16 +112,26 @@ func bootstrap(ctx context.Context, cli pdpb.PDClient) {
Store: store,
Region: region,
}
<<<<<<< HEAD
cctx, cancel = context.WithCancel(ctx)
resp, err := cli.Bootstrap(cctx, req)
cancel()
=======
resp, err := cli.Bootstrap(context.TODO(), req)
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
if err != nil {
log.Fatal("failed to bootstrap the cluster", zap.Error(err))
}
if resp.GetHeader().GetError() != nil {
<<<<<<< HEAD
log.Fatal("failed to bootstrap the cluster", zap.String("err", resp.GetHeader().GetError().String()))
}
log.Info("bootstrapped")
=======
log.Fatalf("bootstrap failed: %s", resp.GetHeader().GetError().String())
}
log.Println("bootstrapped")
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
}

func putStores(ctx context.Context, cfg *config.Config, cli pdpb.PDClient) {
Expand All @@ -128,13 +141,18 @@ func putStores(ctx context.Context, cfg *config.Config, cli pdpb.PDClient) {
Address: fmt.Sprintf("localhost:%d", i),
Version: "6.4.0-alpha",
}
<<<<<<< HEAD
cctx, cancel := context.WithCancel(ctx)
resp, err := cli.PutStore(cctx, &pdpb.PutStoreRequest{Header: header(), Store: store})
cancel()
=======
resp, err := cli.PutStore(context.TODO(), &pdpb.PutStoreRequest{Header: header(), Store: store})
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
if err != nil {
log.Fatal("failed to put store", zap.Uint64("store-id", i), zap.Error(err))
}
if resp.GetHeader().GetError() != nil {
<<<<<<< HEAD
log.Fatal("failed to put store", zap.Uint64("store-id", i), zap.String("err", resp.GetHeader().GetError().String()))
}
go func(ctx context.Context, storeID uint64) {
Expand All @@ -155,6 +173,10 @@ func putStores(ctx context.Context, cfg *config.Config, cli pdpb.PDClient) {
}
}
}(ctx, i)
=======
log.Fatalf("put store failed: %s", resp.GetHeader().GetError().String())
}
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
}
}

Expand Down
3 changes: 3 additions & 0 deletions tools/pd-simulator/simulator/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,12 @@ func (c *client) Bootstrap(ctx context.Context, store *metapb.Store, region *met
if err != nil {
return err
}
<<<<<<< HEAD
newStore := typeutil.DeepClone(store, core.StoreFactory)
newRegion := typeutil.DeepClone(region, core.RegionFactory)

=======
>>>>>>> bde0a1b42 (*: put gRPC unknown error into the header. (#5310))
res, err := c.pdClient().Bootstrap(ctx, &pdpb.BootstrapRequest{
Header: c.requestHeader(),
Store: newStore,
Expand Down

0 comments on commit 1584544

Please sign in to comment.