Process was intentionally killed - now the process is still showing in “show processlist ”

dba.stackexchange https://dba.stackexchange.com/questions/265476

  •  28-02-2021
  •  | 
  •  

Question

We had a MariaDB long-running process (40 hours), so I killed the thread. But, the thread is still there, with:

  • showing Command as Killed.
  • a State of Unlocking tables.
  • Info is insert into ...

What does this mean? More importantly, how do I get rid of it? It's been over 31 hours since the thread entered the "Killed" state.

UPDATE: We restarted the container running MariaDB. There was no indication of anything wrong but... Would it make sense to recast this thread to be now about how to check for errors in the database (My MariaDB skills are rudimentary) or should I start a new thread?

Was it helpful?

Solution

The process is undoing its changes after being killed (that is why killing write processes on a long running transaction can be dangerous- it can lead to a long undo process with blocking).

The rule of thumb is that InnoDB's UNDO can take multiple times the time it took to write. If it is unsustainable, you can stop the server when ther is no more write activity and restart it skipping pending UNDOs (so it doesn't start again). This is done with the start option:

innodb_force_recovery = 3

Not ideal as a normal start option, as it could make you lose data. Generating a backup before the unclean restart (or in general) is always a good idea, even if technically safe assuming no other writes or undos are ongoing.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top