Обсуждение: Cannot cancel LOCK TABLE

Поиск
Список
Период
Сортировка

Cannot cancel LOCK TABLE

От
Leon
Дата:
Hi!

There we have a need of canceling LOCK TABLE requests
which fail to lock the table in a given time. Scenario is following:
try to issue a lock on a table, wait for a given time for a completion
ot this lock request, and, if it fails, cancel a lock request and go on
processing other queries. A little experimenting showed that LOCK TABLE
requests cannot be canceled. They just sit in the queue of queries
and don't let other queries to be processed. How can I overcome
that? The piece of code where I try to cancel lock request:

     if (difftime(t1,t0) > LOCK_WAIT_TIMEOUT)
     {
      printf("\nTimeout waiting for lock. Try again.\n");
      PQrequestCancel(conn);
      PQsendQuery(conn,"rollback");
      return 1;
     }

--
Leon.
---------
"This may seem a bit weird, but that's okay, because it is weird." -
Perl manpage.