Skip to content

Commit

Permalink
sql: Log statements to event log earlier
Browse files Browse the repository at this point in the history
This ensures that all statements get logged, particularly COMMIT and
ROLLBACK, which were handled with an early return before the previous
location of the logging statement.
  • Loading branch information
bdarnell committed Sep 24, 2016
1 parent 061d197 commit e11034b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sql/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,9 @@ func (e *Executor) execStmtInOpenTxn(
planMaker.evalCtx.SetTxnTimestamp(txnState.sqlTimestamp)
planMaker.evalCtx.SetStmtTimestamp(e.cfg.Clock.PhysicalTime())

session := planMaker.session
log.Event(session.context, stmt.String())

// TODO(cdo): Figure out how to not double count on retries.
e.updateStmtCounts(stmt)
switch s := stmt.(type) {
Expand Down Expand Up @@ -980,9 +983,6 @@ func (e *Executor) execStmtInOpenTxn(
return Result{PGTag: s.StatementTag()}, nil
}

session := planMaker.session
log.Event(session.context, stmt.String())

result, err := e.execStmt(stmt, planMaker, implicitTxn /* autoCommit */)
if err != nil {
if traceSQL {
Expand Down

0 comments on commit e11034b

Please sign in to comment.