DEV Community

Michael
Michael

Posted on • Originally published at gbase.cn

Track Rolling-Back Transactions in GBase 8s

Quickly identifying transactions that are rolling back is essential for diagnosing blocking and assessing impact. These two onstat chains give you the session ID and the running SQL in seconds.

Method 1: Find Sessions with the RP Flag

  1. Look for sessions with the RP flag (Rollback in Progress) and note the session ID:
   onstat -u | grep RP
Enter fullscreen mode Exit fullscreen mode
  1. Retrieve the SQL for that session:
   onstat -g ses <sid>
Enter fullscreen mode Exit fullscreen mode

Method 2: Use the Transaction Flags

  1. List active transactions; an R in the third position of flags means a rollback is underway. Capture the userthread address (e.g., 686cb9e8) and the estimated remaining time (rb_time):
   onstat -x | grep "A-R"
Enter fullscreen mode Exit fullscreen mode
  1. Map the userthread to a session ID:
   onstat -u | grep "686cb9e8"
Enter fullscreen mode Exit fullscreen mode
  1. Then extract the SQL:
   onstat -g ses <sid>
Enter fullscreen mode Exit fullscreen mode

Both methods are non‑intrusive and help you pinpoint problematic SQL quickly, keeping your gbase database running smoothly.

Top comments (0)