Inserting to SDS secondary
Posted in 2010
Topics: High Availability & Replication
IDS 11.50 FC6 X3 Linux I am wondering if anyone is successfully using an SDS server and regularly inserting data from that server? I have an updateable SDS server that I am trying insert records to... the records insert successfully, but the application tries to get the generated value in the serial8 field, the result is NULL. Because the application runs through a black box module, I can't say how it is trying to access the serial value. If the record is inserted to teh primary, everything works fine, it is just when it is connected through the secondary. I understand that there will be some latency on writes, since they all really go through the primary, but I would think that when the successful insert code is returned, the serial value would be available. Any insight into this would be greatly appreciated. I have 5 SDS servers planned, with moderate writing on each server. If this is not going to work, I need to seriously look at my planned architecture. Thanks a bunch! Laurie Laurie Gustin IT Programmer Analyst Department of Public Safety lgustin@utah.gov 801-965-4410
I just did some quick testing and I was able to see immediately what I had inserted from an updatable secondary. If I just used a normal serial value I had no problem using sqlca.sqlerrd[1] to get the value of the inserted serial when connected to an updatable secondary. However, when I tried to do the same thing with a serial8, you are supposed to use the esql/c call ifx_getserial8(). When I tried that when connected to the secondary or the primary my ifx_getserial8() was always returning 0. My current version of csdk is pretty old and I didn't look for any previously reported defects. I would say without knowing for sure how the application is trying to get the value of the inserted serial8 value it would be hard to say for sure it's a problem only on updatable secondaries. Jacques Renaut IBM Informix Advanced Support APD Team
To follow up on my previous post, I got a newer version of CSDK (3.50.FC7) and tested using ifx_getserial8 on both a primary and updatable SDS secondary and still in both cases ifx_getserial8 still doesn't return the correct value (in my testing it always seems to return 0). However, if I use ifx_getbigserial instead then it properly returns the value of the serial on both the primary and updatable SDS secondary. Jacques Renaut IBM Informix Advanced Support APD Team
And another follow up post. Apparently you need to be very careful when you use ifx_getserial8 and ifx_getbigserial. I had thought my table was defined with a serial8 column, but it was not. If you create your table with a serial column that is defined as serial8 and you then use ifx_getserial8() for inserts from both the primary and the updatable secondaries, I was able to successfully get the value for the serial value that I had just inserted. If you create your table with a serial column that is defined as bigserial, you must use ifx_getbigserial to get the serial value. If you mistakenly try to use ifx_getserial8 you always get 0. So my test case was in error. When everything matches up like it should, both ifx_getserial8 and ifx_getbigserial worked on either the primary or updatable secondaries. Jacques Renaut IBM Informix Advanced Support APD Team
I like BIGSERIAL and BIGINT a whole lot better than SERIAL8 and INT8 anyway, since BIGINT can be used directly in host apps as (long long) (or 64bit long) and doesn't require function calls to manipulate or display. It would be nice, however, if esql/c supported (long long) as a host type instead of making us use the defines. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Tue, Jun 29, 2010 at 12:09 PM, JACQUES RENAUT <jrenaut@us.ibm.com> wrote: > To follow up on my previous post, I got a newer version of CSDK (3.50.FC7) > and > tested using ifx_getserial8 on both a primary and updatable SDS secondary > and > still in both cases ifx_getserial8 still doesn't return the correct value > (in > my testing it always seems to return 0). However, if I use ifx_getbigserial > instead then it properly returns the value of the serial on both the > primary > and updatable SDS secondary. > > Jacques Renaut > IBM Informix Advanced Support > APD Team > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --000e0cd14b1899d234048a2da00b