|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problem with inserting data from Compute node |
« View previous topic :: View next topic » |
Author |
Message
|
accosun |
Posted: Fri Mar 06, 2009 5:56 am Post subject: Problem with inserting data from Compute node |
|
|
Apprentice
Joined: 20 Dec 2001 Posts: 45 Location: Moscow
|
Hello everybody!
I'd like to describe a problem we faced some time ago. May be someone will give me an advice, what is the reason for this problem.
So... We have very complex transaction processing in our bank, and for the moment we use WMB v5.x running on AIX machine. The rate of messages is not very high (about 100 - 200 per hour), but, each transaction takes about a minute to be processed. We use hundreds of message flows and subflows in our solution. These messages are generateted by some (3-5) external applications, and these messages come in bulks of for example 10 msg. It is not neccessary, that all mesages in a bulk should be processed successfully. MsgId is generated by queue managers (and they should be unique) for these applications. We have 4 execution groups and in each EG we have one copy of nesessary flows. No additional instances of MF!
At the particular point of processing, we need to insert some audit data from message to remote external DB2 database (table MQSISIS.CONTEXT_DATA, Msg_ID field is a primary key), working on a remote AIX machine. You can find fragment of ESQL expression below:
PASSTHRU ('INSERT INTO Context_Data ( Msg_ID, '||
'Msg_Format, '||
'Msg_Version, '||
'Channel_ID, '||
'Channel_Function, '||
........
'UsrDfnd4, '||
'UsrDfnd5, '||
'General_Txt,TRAN_DATE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)',
CAST(OutputRoot.MQMD.MsgId AS BLOB), .........)
Everything is set up correctly, it works fine on the testing system and also on production system until the rate of the messges is icreased. Then the problem appears....
The first sign of problem - MF fails to insert one (any) message from the bulk to external DB. Error message is :
[IBM][CLI Driver][DB2/6000] SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "MQSISIS.CONTEXT_DATA" from having duplicate rows for those columns. SQLSTATE=23505 '
As I've said earlier, this is not a big problem, when one message from the bulk is failed, so the processing continues...
But very soon two messages from the bulk failed with the same error, then 3, 4 ... When the number of failed messages increses to 8-9 we have to reboot the boker. After rebooting system works fine again for some time, until the decribed problem appear again.
UNFORTUNATELLY, because of some regulatons, we cannot use any debug tools (user trace, db trace, etc) on the production system to find out, what is the reason for this error.
BUT, if we use a special procedure for MsgId generation (either at application side or broker side), the problem is gone. Too bad, that managers don't want to use this procedure anywhere in the code.
Do anyone have an idea about it?
Thank you, Alexander |
|
Back to top |
|
 |
Tibor |
Posted: Fri Mar 06, 2009 7:22 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Alexander, are you sure about that the messageids are unique if there are no trace logs? |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 06, 2009 8:48 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi accosun,
Is the flow which does the inserts into MQSISIS.CONTEXT_DATA separate or does each of your flows have this insertion logic ?
Are you doing updates/deletes etc over inserts ?
Please post the table script.
Please provide a higher level view of your flows and code logic related to this table.
Do not use MQ ids as database keys, they are unique but somehow it's not safe. Rather have the Db generate an id for you.
Regards. |
|
Back to top |
|
 |
accosun |
Posted: Tue Mar 17, 2009 1:06 am Post subject: |
|
|
Apprentice
Joined: 20 Dec 2001 Posts: 45 Location: Moscow
|
Hello, sorry for delay, here all informaton you asked about:
Quote: |
Are you doing updates/deletes etc over inserts ? |
- No, only iserts
Quote: |
Please post the table script: |
CREATE TABLE "MQSISIS"."CONTEXT_DATA"
("MSG_ID" CHARACTER(4 NOT NULL,
"MSG_FORMAT" VARCHAR(80),
"MSG_VERSION" VARCHAR( ,
"CHANNEL_ID" VARCHAR( ,
"CHANNEL_FUNCTION" VARCHAR(12),
"USER_ID" VARCHAR(30),
"LANGUAGE" VARCHAR(2),
"SECURITY_INFO" VARCHAR(100),
"CHANNEL_INFO" VARCHAR(100),
"APPLICATION_INFO" VARCHAR(100),
"REVERSAL_OPTIONS" VARCHAR(2),
"ORIG_MSG_ID" VARCHAR(96),
"REPLYTOQ" VARCHAR(100),
"REPLYTOQMGR" VARCHAR(100),
"ENCODING" INTEGER,
"CODEDCHARSETID" INTEGER,
"USRDFND1" VARCHAR(50),
"USRDFND2" VARCHAR(50),
"USRDFND3" VARCHAR(50),
"USRDFND4" VARCHAR(50),
"USRDFND5" VARCHAR(50),
"GENERAL_TXT" VARCHAR(200),
"TRAN_DATE" TIMESTAMP
)
DATA CAPTURE NONE
IN "ASIRLOG_TS"
CCSID UNICODE;
ALTER TABLE "MQSISIS"."CONTEXT_DATA"
LOCKSIZE ROW
APPEND OFF
NOT VOLATILE
LOG INDEX BUILD NULL;
GRANT CONTROL ON TABLE "MQSISIS"."CONTEXT_DATA" TO USER "DB2ADMIN";
ALTER TABLE "MQSISIS"."CONTEXT_DATA"
ADD CONSTRAINT "CONTEXT_DATA_PK" PRIMARY KEY
("MSG_ID"
);
Quote: |
Please provide a higher level view of your flows and code logic related to this table |
-
http://file.qip.ru/file/79986824/74b92a28/flow_with_audit_node.html
Quote: |
Do not use MQ ids as database keys, they are unique but somehow it's not safe. Rather have the Db generate an id for you. |
Could you please explain, why it is not safe? It's just a unique byte string, isn't it?
Thank you!!! |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Mar 17, 2009 1:58 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
accosun wrote: |
Quote: |
Do not use MQ ids as database keys, they are unique but somehow it's not safe. Rather have the Db generate an id for you. |
Could you please explain, why it is not safe? It's just a unique byte string, isn't it? |
Because they're only unique if you code them to always be unique.
And if you ever resend a message, you have to decide if it's got a new id or not. |
|
Back to top |
|
 |
Tibor |
Posted: Tue Mar 17, 2009 2:08 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
|
Back to top |
|
 |
Tibor |
Posted: Tue Mar 17, 2009 2:14 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Just a notice for your message flow: why don't you use the failure connector of the input node instead of wiring all the nodes to the General_Failure node. |
|
Back to top |
|
 |
accosun |
Posted: Tue Mar 17, 2009 3:11 am Post subject: |
|
|
Apprentice
Joined: 20 Dec 2001 Posts: 45 Location: Moscow
|
Quote: |
Because they're only unique if you code them to always be unique.
And if you ever resend a message, you have to decide if it's got a new id or not. |
I'm sure, they were coded in the right way... |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Mar 17, 2009 3:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
accosun wrote: |
Quote: |
Because they're only unique if you code them to always be unique.
And if you ever resend a message, you have to decide if it's got a new id or not. |
I'm sure, they were coded in the right way... |
Yes... you're sure they're coded in the right way *today*. Tomorrow, though? |
|
Back to top |
|
 |
accosun |
Posted: Tue Mar 17, 2009 3:48 am Post subject: |
|
|
Apprentice
Joined: 20 Dec 2001 Posts: 45 Location: Moscow
|
ok-ok, so, you suppose to use another field (generated by database) instead of MsgId as a primary key in the database? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|