From 9b0203df43febac044584a6dc05715ffa86032aa Mon Sep 17 00:00:00 2001 From: Peter Mattis Date: Mon, 26 Sep 2016 14:04:38 -0400 Subject: [PATCH] [WIP] --- kv/transport.go | 2 ++ storage/replica.go | 2 ++ storage/replica_command.go | 2 +- storage/store.go | 55 +++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/kv/transport.go b/kv/transport.go index c84063f32cc5..4ccc22c72f14 100644 --- a/kv/transport.go +++ b/kv/transport.go @@ -157,6 +157,8 @@ func (gt *grpcTransport) SendNext(done chan<- BatchCall) { addr := client.remoteAddr if log.V(2) { log.Infof(gt.opts.ctx, "sending request to %s: %+v", addr, client.args) + } else { + log.Eventf(gt.opts.ctx, "sending request to %s", addr) } if localServer := gt.rpcContext.GetLocalInternalServerForAddr(addr); enableLocalCalls && localServer != nil { diff --git a/storage/replica.go b/storage/replica.go index 6182805be93e..e5787a3ecced 100644 --- a/storage/replica.go +++ b/storage/replica.go @@ -2280,6 +2280,7 @@ func (r *Replica) refreshPendingCmdsLocked(reason refreshRaftReason, refreshAtDe } delete(r.mu.pendingCmds, idKey) // The command can be refurbished. + log.VEventf(4, p.ctx, "refurbishing command %x; %s", p.idKey, reason) if pErr := r.refurbishPendingCmdLocked(p); pErr != nil { p.done <- roachpb.ResponseWithError{Err: pErr} } @@ -2299,6 +2300,7 @@ func (r *Replica) refreshPendingCmdsLocked(reason refreshRaftReason, refreshAtDe // the right place. Reproposing in order is definitely required, however. sort.Sort(reproposals) for _, p := range reproposals { + log.VEventf(4, p.ctx, "reproposing command %x; %s", p.idKey, reason) if err := r.proposePendingCmdLocked(p); err != nil { return err } diff --git a/storage/replica_command.go b/storage/replica_command.go index 45b5418c7ad9..04f95a2eaa9c 100644 --- a/storage/replica_command.go +++ b/storage/replica_command.go @@ -2308,7 +2308,7 @@ func (r *Replica) AdminSplit( leftDesc := *desc leftDesc.EndKey = splitKey - log.Infof(ctx, "initiating a split of this range at key %s", splitKey) + log.Infof(ctx, "initiating a split of this range at key %s [r%d]", splitKey, rightDesc.RangeID) if err := r.store.DB().Txn(ctx, func(txn *client.Txn) error { log.Event(ctx, "split closure begins") diff --git a/storage/store.go b/storage/store.go index 9a567b811c99..de5fb5e2d6f6 100644 --- a/storage/store.go +++ b/storage/store.go @@ -1538,33 +1538,34 @@ func splitTriggerPostCommit( // // Note: you must not use the context inside of this task since it may // contain a finished trace by the time it runs. - if err := r.store.stopper.RunAsyncTask(ctx, func(ctx context.Context) { - time.Sleep(10 * time.Millisecond) - // Make sure that rightRng hasn't been removed. - replica, err := r.store.GetReplica(rightRng.RangeID) - if err != nil { - if _, ok := err.(*roachpb.RangeNotFoundError); ok { - log.Infof(ctx, "%s: RHS replica %d removed before campaigning", - r, r.mu.replicaID) - } else { - log.Infof(ctx, "%s: RHS replica %d unable to campaign: %s", - r, r.mu.replicaID, err) - } - return - } - - if err := replica.withRaftGroup(func(raftGroup *raft.RawNode) (bool, error) { - if err := raftGroup.Campaign(); err != nil { - log.Warningf(ctx, "%s: error %v", r, err) - } - return true, nil - }); err != nil { - panic(err) - } - }); err != nil { - log.Warningf(ctx, "%s: error %v", r, err) - return - } + // if err := r.store.stopper.RunAsyncTask(ctx, func(ctx context.Context) { + // time.Sleep(10 * time.Millisecond) + // // Make sure that rightRng hasn't been removed. + // replica, err := r.store.GetReplica(rightRng.RangeID) + // if err != nil { + // if _, ok := err.(*roachpb.RangeNotFoundError); ok { + // log.Infof(ctx, "%s: RHS replica %d removed before campaigning", + // r, r.mu.replicaID) + // } else { + // log.Infof(ctx, "%s: RHS replica %d unable to campaign: %s", + // r, r.mu.replicaID, err) + // } + // return + // } + + // if err := replica.withRaftGroup(func(raftGroup *raft.RawNode) (bool, error) { + // log.Infof(replica.ctx, "campaigning after split") + // if err := raftGroup.Campaign(); err != nil { + // log.Warningf(ctx, "%s: error %v", r, err) + // } + // return true, nil + // }); err != nil { + // panic(err) + // } + // }); err != nil { + // log.Warningf(ctx, "%s: error %v", r, err) + // return + // } } else if len(split.RightDesc.Replicas) == 1 { // TODO(peter): In single-node clusters, we enqueue the right-hand side of // the split (the new range) for Raft processing so that the corresponding