Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Ingres Forums > Contributor's Forum
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2009-06-19   #1 (permalink)
Ingres Community
 
Join Date: Mar 2009
Posts: 10
Default 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.
pstech is offline   Reply With Quote
Old 2009-06-24   #2 (permalink)
Ingres Corp
 
Join Date: Mar 2007
Location: Australia
Posts: 329
Blog Entries: 1
Default RE: Update statement problem

You might be better off posting this is in the "Database Drivers and APIs" forum. This forum is for people who contribute code to the Ingres open source product itself, and I suspect that none of the app dev experts are reading it (hence no replies).

Last edited by teresa; 2009-06-25 at 10:25 AM. Reason: add title for move to correct forum
stephenb is offline   Reply With Quote
Old 2009-06-30   #3 (permalink)
Ingres Community
 
Join Date: Mar 2009
Posts: 10
Default

OK, thanks. I moved my post in "Database Drivers and APIs".
pstech is offline   Reply With Quote

Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved