Staggered Sequential Key

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
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Staggered Sequential Key

Post by Raftsman »

When I generate a unique partitioned key using

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

Where MAXEVNTID = max value from the last job execution,

The DB2 table sequentially increment the key by 1 on different partitions.

So far so good.

When the key sequence number hit 100, it begins to jump by 2, sometimes 4 etc. It no longer increase by one. Is this normal. I have 111 records and I would of thought that my key would of been 1 thru 111. It goes from 1 to 100 and then staggers up to 132.

Could someone please explain why.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why not do some of the research yourself? Capture the individual values of the system variables into additional columns (maybe an additional output link from the Transformer stage) into a text file and see where the cause is.
Let us know.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

In your DataStage Director open up the job monitor, from a right mouse click display all stage instances, what you should see in your row counts is that one instance of the Transformer processed about 50 rows and the other instance processed 66 rows. That gave Transformer instance 1 the odd numbers 1-99 and Transformer instance 2 even numbers 2-132.

You cannot get a robust sequence without gaps from a parallel counter unless you perfectly or almost perfectly balance the load across all instances.
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

Post by Raftsman »

It was the load balancing the staggers the numbers. I have 4 node processing 111 records, Partition 0,1,2,3. Part 0 contained 1-27, Part 1 contained 1-26, part 2 contained 1-26 and part 3 contained 1-32. Using the formula to assign keys staggers the counts by 4. So the last partition 3 contained numbers from 100 - 132 due to the extra records in the partition.

Thanbks for the load bearing answer, it is reacting ass it should. Also Ray, thanks for telling me to insert debug variable, I understand the logic much better
Post Reply