I'm comparing two files A & B and extracting columns from A which don't exists in B and adding it to B. When new record is added to B , it should be given an unique id. I'm looking for logic where I can get the total count from B , which is the max id now. Then pass the max to all the reducers. But the issue is multiple reducers will be processing in parallel. Is there a way to make a reducer assign incremental id in sync with all other reducers based on max value from B ?
Logic to compare A and B :
1.Assign number '2' to records from A
Assign number '1' to records from B
Sum the value in the reducer. If the sum%2 is 0, then record doesn't exists in B. Hence add it to B with unique id.