Update statement problem
Hi there,
We have encountered a problem regarding UPDATE statement in Ingres, in multithreaded environment, using ODBC. We are trying to access a table in database from two threads. From one thread, we are trying to update a table and from second thread we are just querying data. The problem is in fact that update thread first locks the mutex and blocks indefinitely on update statement, while querying thread is locked on mutex, as expected. Update statements are working properly when we try to execute it from sql client. Call stack in “update thread” looks like this:
0 __kernel_vsyscall 0
1 poll /lib/tls/i686/cmov/libc.so.6 0
2 ii_CL_poll_poll /opt/Ingres/IngresII/ingres/lib/libcompat.1.so 0
3 iiCLpoll /opt/Ingres/IngresII/ingres/lib/libcompat.1.so 0
4 GCsync /opt/Ingres/IngresII/ingres/lib/libcompat.1.so 0
5 IIapi_wait /opt/Ingres/IngresII/ingres/lib/libiiapi.1.so 0
6 odbc_getResult /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
7 odbc_getQInfo /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
8 odbc_query_sm /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
9 IIODsqap_SqlToIngresAPI /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
10 SQLExecDirect_Common /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
11 SQLExecDirect /opt/Ingres/IngresII/ingres/lib/libiiodbcdriver.1.so 0
In order to solve the problem we inserted following line before the UPDATE statement:
SET LOCK MODE SESSION WHERE TIMEOUT=NOWAIT
Once we do this, problematic UPDATE statement isn’t blocked any longer, but ODBC driver returns error: “timeout occurred on lock request” (error code 4702), and update statement fails.
One important note though, this two threads are the only ones that are trying to access database. We have learned this from debbuger and logger.
All settings in config.dat are default.
Any suggestion or hint would be more then helpful.
|