Deadlock while updating Oracle table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

ankita
Participant
Posts: 57
Joined: Sun Nov 13, 2005 11:17 pm

Deadlock while updating Oracle table

Post by ankita »

Hi All,
While trynig to update a Sales fact table using 4 node the job is failing with the following error:
ORA-00060: deadlock detected while waiting for resource

It's a update only query and input is hash partitioned on keys.
Target table is range partitioned on date and job is running fine when data
is distributed within two nodes or single node.There is no duplicate record.
Also MAX_TRANS is not set at DB level.

-Can a range partitioned table lead to deadlock if more than one node try to update records belonging to single partition ?
-Is there any way to avoid deadlock even with 4 nodes ?

Thanks for your help!
Ankita
sanjay
Premium Member
Premium Member
Posts: 203
Joined: Fri Apr 23, 2004 2:22 am

Re: Deadlock while updating Oracle table

Post by sanjay »

Hi

change oracle stage partition to sequential.

Thanks
Sanjay
ankita wrote:Hi All,
While trynig to update a Sales fact table using 4 node the job is failing with the following error:
ORA-00060: deadlock detected while waiting for resource

It's a update only query and input is hash partitioned on keys.
Target table is range partitioned on date and job is running fine when data
is distributed within two nodes or single node.There is no duplicate record.
Also MAX_TRANS is not set at DB level.

-Can a range partitioned table lead to deadlock if more than one node try to update records belonging to single partition ?
-Is there any way to avoid deadlock even with 4 nodes ?

Thanks for your help!
Ankita
ankita
Participant
Posts: 57
Joined: Sun Nov 13, 2005 11:17 pm

Post by ankita »

As per my understanding, changing Oracle partitions into sequential will again make the load sequential, but is there any way to avoid deadlock even with parallel loading ?
Ankita
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

ankita wrote:As per my understanding, changing Oracle partitions into sequential will again make the load sequential, but is there any way to avoid deadlock even with parallel loading ?
Of course.
So basically, the answer you got is not a good answer. (it amused me somehow)

And I don't have a good answer to you neither as i'm experiencing the same issue. This looks like a bug.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

It seems like this is caused by the parallel configuration. I was using 6 nodes. I tried 8 and 4 nodes and I don't get the deadlock anymore.

Now I don't know yet if it's the number of nodes, or the location of the disk and scratch. On 6 nodes I had it on the same filesystems. On 4 and 8, I splitted it across 4 filesystems.
roceller wrote:
ankita wrote:As per my understanding, changing Oracle partitions into sequential will again make the load sequential, but is there any way to avoid deadlock even with parallel loading ?
Of course.
So basically, the answer you got is not a good answer. (it amused me somehow)

And I don't have a good answer to you neither as i'm experiencing the same issue. This looks like a bug.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
bucks
Premium Member
Premium Member
Posts: 21
Joined: Tue Feb 20, 2007 1:31 pm

Post by bucks »

I think this is not a node configuration issue. it is more of a database issue.

Can you please check the sort option and hash partition on the primary keys and try ?

thanks
Sri
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

i had similar problem and hash partitioning help me.
hash partition the input, on the columns used in the where clause.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Only a small amount of thought will explain why hash partitioning on the column(s) in the WHERE clause is the solution, and why not having it might cause a deadlock, particularly if rows/transaction > 1.

So please think about it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

keshav0307 wrote:i had similar problem and hash partitioning help me.
hash partition the input, on the columns used in the where clause.
Now i'm getting a deadlock too on another job even if I try 4 or 8 nodes.

I just have one primary key (used on the update condition). Hash partitioning on the Update input stage did not help me.

Now, I wonder how my other job worked fine after I changed from 6 to 8 nodes.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Find out from your DBA on which record the deadlock is occurring - for example it might be an update being performed by a trigger from each node, but of which you were unaware.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post by madhukar »

Hash Partition and sort on the update key should resolve your problem.
If you are updating a particular set of records, putting that filter in update will you help you better
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

madhukar wrote:Hash Partition and sort on the update key should resolve your problem.
If you are updating a particular set of records, putting that filter in update will you help you better
I've done this and it was fine for some days, but today, I got the same deadlock. I even had it checked "unique" to remove duplicates even though I'm sure there is no duplicate. This problem is just happening occasionally on the same set of data.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

FINALLY!!!
I think we solved this mysterious deadlock issue!!!
It's a table setup issue.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Meaning what, exactly? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
roceller
Participant
Posts: 26
Joined: Fri Jun 04, 2004 3:38 pm
Contact:

Post by roceller »

Sorry took me sooo long to follow up..... just in case for those looking for answers... the DBA has to recreate the Oracle table segment with higher INITRANS and PCTFREE values... i don't remember it now exactly. Just work with your DBA.
Roceller Alvarez - Sr. ETL Designer/Developer and Administrator - also a Web Guru
<a href="http://www.i-vibe.com/">DATASTAGE DEVELOPER RESOURCE & TIPS PORTAL</a>
Post Reply