surrogate key logic not working on 4 node

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

Post Reply
rakeshvayu
Participant
Posts: 6
Joined: Mon Feb 08, 2010 10:57 pm

surrogate key logic not working on 4 node

Post by rakeshvayu »

Hi Guys

I want to generate sequential numbers in a parallel job with configuration file using 4 nodes. I have done the following in the transformer stage.

1) Created a stage variable for the counter named Skdelta.
with the value as "@PARTITIONNUM - @NUMPARTITIONS + 1".
2) Set the derivation of the stage variable named SVRow to "Skdelta + @NUMPARTITIONS".

its working fiine in single node.

Each instance will start at a different number, eg. -1, -2, -3, -4. When the counter is incremented each instance is increment by the number of partitions, eg. 4. This gives us a sequence in instance 1 of 1, 5, 9, 13... Instance 2 is 2, 6, 10, 14... etc

can anyone suggest me any idea.....how to get the increment like 1,2,3,4 while running on 4 node and also i can't use surrogate stage over here.so, plz help me in this logic.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

@NUMPARTITIONS * ( @INROWNUM - 1) +  @PARTITIONNUM
You are the creator of your destiny - Swami Vivekananda
rakeshvayu
Participant
Posts: 6
Joined: Mon Feb 08, 2010 10:57 pm

Post by rakeshvayu »

Hi Anbu.........i tried with the logic as you have mentioned......but it is still incrementing by 4 while running on 4 node..........is there any other way possible............anyway thanks for the reply.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What exactly do you want it to do when it runs on multiple nodes? Typically you want the 'round robin' effect that anbu mentioned, i.e.

Node 1: 1,5,9,13
Node 2: 2,6,10,14
Node 3: 3,7,11,15
Node 4: 4,8,12,16

However, it seems like you want something else? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rakeshvayu
Participant
Posts: 6
Joined: Mon Feb 08, 2010 10:57 pm

hi

Post by rakeshvayu »

chulett wrote:What exactly do you want it to do when it runs on multiple nodes? Typically you want the 'round robin' effect that anbu mentioned, i.e.

Node 1: 1,5,9,13
Node 2: 2,6,10,14
Node 3: 3,7,11,15
Node 4: 4,8,12,16

However, it seems like you want something else? :?

Hi Chulett.......i need the data to read exactly as u have metioned over here.......when i tried the logic with 4000 records it worked fine createing records like
Node 1: 1,5,9,13
Node 2: 2,6,10,14
Node 3: 3,7,11,15

but when i tried with 1 million records.......i am getting records as 1,5,9,13,....so on.........i guess all the records is passing through single node only at this point........is it because .....i have used AUTO method in transformer stage...
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

What you are seeing is the data from the first partition/node in your view data result set. Just for the sake of it, after the transformer stage put a sort stage and sort your data on the key and then try viewing the data. That should make you feel better :)
Kris

Where's the "Any" key?-Homer Simpson
rakeshvayu
Participant
Posts: 6
Joined: Mon Feb 08, 2010 10:57 pm

Post by rakeshvayu »

Hi Kris.........ya i did that too..........in my job .......i have used the tail stage too see the max of surrogate key generated.......like if i am expecting max num to be 100.......but i am getting as 400.......which is a mutiple of 4.....
:roll:
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

check your partitioning scheme before transformer.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Is there any constraint in the flow that may restrict data from other nodes ?
rakeshvayu
Participant
Posts: 6
Joined: Mon Feb 08, 2010 10:57 pm

Post by rakeshvayu »

Hello friends

Thanks for all ur valuable suggestion........its really helped me alot to go through my logic..........i just used this logic which is working fine now...

@PARTITIONNUM + ( @NUMPARTITIONS * (@INROWNUM - 1) ) + 1

even on 4 node..........

Thanks,
Rakesh.
Post Reply