Skip to content

Commit

Permalink
store/tikv: add/update some logs. (pingcap#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored and coocood committed Oct 18, 2016
1 parent 3d670c4 commit a12842e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion store/tikv/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,19 @@ func (it *copIterator) handleTask(bo *Backoffer, task *copTask) (*coprocessor.Re
if e := resp.GetRegionError(); e != nil {
reportRegionError(e)
if notLeader := e.GetNotLeader(); notLeader != nil {
log.Warnf("tikv reports `NotLeader`: %s, ctx: %s, retry later", notLeader, req.Context)
it.store.regionCache.UpdateLeader(task.region.VerID(), notLeader.GetLeader().GetId())
} else if staleEpoch := e.GetStaleEpoch(); staleEpoch != nil {
log.Warnf("tikv reports `StaleEpoch`, ctx: %s, retry later", req.Context)
err = it.store.regionCache.OnRegionStale(task.region, staleEpoch.NewRegions)
if err != nil {
return nil, errors.Trace(err)
}
} else {
log.Warnf("tikv reports region error: %s, ctx: %s, retry later", e, req.Context)
it.store.regionCache.DropRegion(task.region.VerID())
}
err = bo.Backoff(boRegionMiss, err)
err = bo.Backoff(boRegionMiss, errors.Errorf("regionError: %s", e))
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -470,6 +473,7 @@ func (it *copIterator) handleTask(bo *Backoffer, task *copTask) (*coprocessor.Re
continue
}
if e := resp.GetLocked(); e != nil {
log.Debugf("coprocessor encounters lock: %v", e)
ok, err1 := it.store.lockResolver.ResolveLocks(bo, []*Lock{newLock(e)})
if err1 != nil {
return nil, errors.Trace(err1)
Expand Down
14 changes: 11 additions & 3 deletions store/tikv/txn_committer.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ func (c *txnCommitter) iterKeys(bo *Backoffer, keys [][]byte, f func(*Backoffer,
}
if asyncNonPrimary {
go func() {
c.doBatches(bo, batches, f)
e := c.doBatches(bo, batches, f)
if e != nil {
log.Warnf("txnCommitter async doBatches err: %v", e)
}
}()
return nil
}
Expand Down Expand Up @@ -215,6 +218,7 @@ func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) erro
if err1 != nil {
return errors.Trace(err1)
}
log.Debugf("prewrite encounters lock: %v", lock)
locks = append(locks, lock)
}
ok, err := c.store.lockResolver.ResolveLocks(bo, locks)
Expand Down Expand Up @@ -334,8 +338,12 @@ func (c *txnCommitter) Commit() error {
c.mu.RUnlock()
if !committed {
go func() {
c.cleanupKeys(NewBackoffer(cleanupMaxBackoff), writtenKeys)
log.Infof("txn clean up done, tid: %d", c.startTS)
err := c.cleanupKeys(NewBackoffer(cleanupMaxBackoff), writtenKeys)
if err != nil {
log.Infof("txn cleanup err: %v, tid: %d", err, c.startTS)
} else {
log.Infof("txn clean up done, tid: %d", c.startTS)
}
}()
}
}()
Expand Down

0 comments on commit a12842e

Please sign in to comment.