![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello all. I recently had an issue with a programmer on our site, regarding concurrency control and an SDS environment. The problem is, that he had a little table that was used to control an order sequence number. No serial column or sequence were used. It is a normal table and the sequence column is an integer. The table is from a local ERP package, and the program is a customerīs customization. Here follows some more information. This is an example on the tableīs data (letīs call it order_seq): company * * user * * * * seq 01 * * * * * * * *user1 * * * *10 01 * * * * * * * *user2 * * * *10 01 * * * * * * * *user3 * * * *10 02 * * * * * * * *user1 * * * *153 02 * * * * * * * *user5 * * * *153 seq - is the column that contains the order sequence number, and in this particular customer case, no matter what the user is, the order will be the same for the company column. Other ERP customers may not use the same approach but for this particular customer, that is the behaviour. So the ERP developers defined company and user as the primary key, but for us, company is what matters. So our developer had in his customized code, something like the code that follows, in order to increment the seq column: begin work; lock table order_seq in exclusive mode; * * *** Here the programmer assumed no concurrency issues if (not ok) then * *abort the program end if select max(seq) into v_seq from order_seq where company = '01'; .... do some code ... *let v_seq = v_seq + 1; update order_seq set seq = v_seq where company = '01'; ... do some other code ... if (ok) then * commit work; else * rollback work; end if; Without discussing the quality of the code, since there are better ways of doing it, this code worked well for years. About 10 months ago, we configured an SDS environment using the load balance capabilities (knowing in advance its limitations). But what happened? When this code ran on the secondary node, and it reached the LOCK TABLE statement, no error or warning messages were generated, but IDS did not really locked anything. We debugged the program and saw no sign of locks on the primary node, nor on the secondary. However, when this code ran on the primary, the lock was in place! When the programmer complained about two orders with the same number, I immediatelly tested the LOCK TABLE on dbaccess on the secondary node, and to my surprise, it says that the table is locked, when in fact no locks were placed at all: begin work; lock table order_seq in exclusive mode; ... Table locked. *** But no locks on syslocks and onstat -k. So, I opened a case at IBM, and the response until now is that the behaviour is expected since the LOCK TABLE statement is 'ignored' on the secondary nodes, and this was a design decision. This answer is questionable, and the issue is very dangerous, at least in my point of view! Follows some of the arguments one can pose: 1-There is no documentation on this behaviour, at least at infocenter. IBM support said they are going to correct the documentation now! 2-Shouldnīt the engine be a little more verbose about something we think it is doing, and in fact it is not? Some kind of error message or warning that the application receive and can be aware of it (the application programmer might correct the code, or at least, this program can be moved to run only the primary node)? So the load balance becomes questionable here? 3-How can dbaccess (or IDS engine) say that the table is locked, when in fact it is not? 4-Can SDS be used on a load balance environment without any risk (as other manufacturers claim their product can), since oneīs company can be using a product without access to the source code? Imagine how much time we have to wait for the ERP developers guarantee that their code runs on an SDS environment correctly! I am posting this here, to share the issue with everyone, and to ask if anyone else has problems close to this one, that we might be aware of. I know of one other 'big' limitation regarding temporary tables and transaction logs, but this one is at least very well documented! But I also think that the LOCK TABLE is much more dangerous in terms of stability and consistency. As most of you, I use Informix products for a long time, I like them a lot, I fight for them almost any time, but I feel that when decisions are questionable we also have to talk about it! Thank you! |
![]() |
| Thread Tools | |
| Display Modes | |
| |