Skip to content

Commit

Permalink
Merge pull request cockroachdb#9013 from RaduBerinde/merge-from-master
Browse files Browse the repository at this point in the history
master -> develop
  • Loading branch information
RaduBerinde authored Sep 1, 2016
2 parents 18929ed + 86e5381 commit a1cb894
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
5 changes: 2 additions & 3 deletions server/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ func (n *Node) initStores(
// Bootstrap any uninitialized stores asynchronously.
if len(bootstraps) > 0 {
if err := stopper.RunAsyncTask(func() {
taskCtx := context.TODO()
n.bootstrapStores(taskCtx, bootstraps, stopper)
n.bootstrapStores(n.Ctx(), bootstraps, stopper)
}); err != nil {
return err
}
Expand Down Expand Up @@ -646,7 +645,7 @@ func (n *Node) startComputePeriodicMetrics(stopper *stop.Stopper) {
func (n *Node) computePeriodicMetrics(tick int) error {
return n.stores.VisitStores(func(store *storage.Store) error {
if err := store.ComputeMetrics(tick); err != nil {
log.Warningf(context.TODO(), "%s: unable to compute metrics: %s", store, err)
log.Warningf(n.Ctx(), "%s: unable to compute metrics: %s", store, err)
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion storage/replica_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (r *Replica) executeCmd(
reply.SetHeader(header)

if log.V(2) {
log.Infof(ctx, "%s: executed %s command %+v: %+v, err=%v", r, args.Method(), args, reply, err)
log.Infof(ctx, "executed %s command %+v: %+v, err=%v", args.Method(), args, reply, err)
}

// Create a roachpb.Error by initializing txn from the request/response header.
Expand Down
14 changes: 6 additions & 8 deletions storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ func (s *Store) Start(ctx context.Context, stopper *stop.Stopper) error {

doneUnfreezing := make(chan struct{})
if s.stopper.RunAsyncTask(func() {
taskCtx := s.Ctx()
defer close(doneUnfreezing)
sem := make(chan struct{}, 512)
var wg sync.WaitGroup // wait for unfreeze goroutines
Expand All @@ -891,8 +890,8 @@ func (s *Store) Start(ctx context.Context, stopper *stop.Stopper) error {
MustVersion: build.GetInfo().Tag,
}
ba.Add(&fReq)
if _, pErr := r.Send(taskCtx, ba); pErr != nil {
log.Errorf(taskCtx, "%s: could not unfreeze Range %s on startup: %s", s, r, pErr)
if _, pErr := r.Send(s.Ctx(), ba); pErr != nil {
log.Errorf(s.Ctx(), "%s: could not unfreeze Range %s on startup: %s", s, r, pErr)
} else {
// We don't use the returned RangesAffected (0 or 1) for
// counting. One of the other Replicas may have beaten us
Expand All @@ -908,7 +907,7 @@ func (s *Store) Start(ctx context.Context, stopper *stop.Stopper) error {
})
wg.Wait()
if unfrozen > 0 {
log.Infof(taskCtx, "%s: reactivated %d frozen Ranges", s, unfrozen)
log.Infof(s.Ctx(), "reactivated %d frozen Ranges", unfrozen)
}
}) != nil {
close(doneUnfreezing)
Expand Down Expand Up @@ -1906,7 +1905,6 @@ func (s *Store) Send(ctx context.Context, ba roachpb.BatchRequest) (br *roachpb.
// Attach any log tags from the store to the context (which normally
// comes from gRPC).
ctx = s.logContext(ctx)

for _, union := range ba.Requests {
arg := union.GetInner()
header := arg.Header()
Expand Down Expand Up @@ -2523,8 +2521,8 @@ func (s *Store) HandleRaftResponse(ctx context.Context, resp *RaftMessageRespons
}

default:
log.Warningf(ctx, "%s: got error from range %d, replica %s: %s",
s, resp.RangeID, resp.FromReplica, val)
log.Warningf(ctx, "got error from range %d, replica %s: %s",
resp.RangeID, resp.FromReplica, val)
}

default:
Expand Down Expand Up @@ -3023,7 +3021,7 @@ func (s *Store) ComputeMetrics(tick int) error {
s.metrics.RdbReadAmplification.Update(int64(readAmp))
// Log this metric infrequently.
if tick%100 == 0 {
log.Infof(s.Ctx(), "%s: sstables (read amplification = %d):\n%s", s, readAmp, sstables)
log.Infof(s.Ctx(), "sstables (read amplification = %d):\n%s", readAmp, sstables)
}
}
return nil
Expand Down
14 changes: 13 additions & 1 deletion ui/app/containers/raftRanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,21 @@ class RangesMain extends React.Component<RangesMainProps, RangesMainState> {
" Store " + replica.store_id.toString() +
" ReplicaID " + replica.replica_id.toString() + ")"
);
let display = (l?: Long): string => {
if (l) {
return l.toString();
}
return "N/A";
};
let index = nodeIDIndex[node.node_id];
let raftState = nodeRange.raft_state;
let cell = <td key={index}>
{(this.state.showState) ? <div>State: {nodeRange.raft_state.state} ReplicaID={nodeRange.raft_state.getReplicaId().toString()} Term={nodeRange.raft_state.getHardState().getTerm().toString()} Lead={nodeRange.raft_state.getLead().toString()}</div> : ""}
{(this.state.showState) ? <div>
State: {raftState.state}&nbsp;
ReplicaID={display(raftState.replica_id)}&nbsp;
Term={display(raftState.hard_state.term)}&nbsp;
Lead={display(raftState.lead)}&nbsp;
</div> : ""}
{(this.state.showReplicas) ? <div>
<div>Replica On: {replicaLocations.join(", ")}</div>
<div>Next Replica ID: {nodeRange.state.state.desc.next_replica_id}</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/embedded.go

Large diffs are not rendered by default.

0 comments on commit a1cb894

Please sign in to comment.