READ COMMITED ERROR
Hi,
Can anyone give how to resolve this error.
events.js:163
throw er; // Unhandled 'error' event
^
Error: Unavailable: initiator locks for query - Locking failure: Timed out X locking Table:public.test2. X held by [user user_testing (select count(*) from test2;)]. Your current transaction isolation level is READ COMMITTED
0
Comments
Hi,
The issue is that the user "user_testing" took an exclusive "X" lock on the table public.test2 (via an UPDATE or DELETE) and did not commit leaving the transaction open. Then another session came along and also tried to grab an exclusive "X" lock on the table (also via an UPDATE or DELETE) . But it can't and has to wait in a queue until that first session either commits or rollbacks the transaction. The default timeout for waiting on an X lock is controlled via the "LockTimeout" configuration parameter:
Example:
Session #1 (usera):
Session #2 (userb):
userb=> delete from some_table;
After 5 minutes, I get this error:
Solution? Either make sure users aren't holding onto "X" locks longer than 10 minutes, or increase the "LockTimeout" configuration parameter value. But be careful as you could end up with a lot of transactions in the queue!
Here is a link to more info. on Vertica lock modes:
https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/ConceptsGuide/Components/Locks/LockModes.htm