https://slingdata.io logo
Hi, I need a help to understand the "
# sling-help
m
Hi, I need a help to understand the "Parallel Chunking" process, there is something that feels like risky to use, so I want to understand if I'm not missing anything. I have created new replication to test it. This replication is set to 4 threads, and for first run there was 14 parts. 3 of them has failed, but other succeed. From this point we are on problem, because: 1. there is a gap of data that not filled 2. the latest incremental value set to latest value from overall process, and will continue without filling again the failed parts from previous runs I know that there is retry mechanism, but lets say that there is problem with data in the source that I want to fix by talking to customer, and later on I guess the process will be fine, but, I would have to maintain it manually, because we have missed some of the parts. So, is it something that Im doing wrong? If so, than how should I implement it. Otherwise, Is there any additional configuration that I can set to define more control over it? For example, it feel more safe, if it was in next method: stream that will create 20 parts, and there is 5 threads. The process will run every 5 parts, and will merge it to the final table, only after they are all finished, and only after that, continue to next 5 parts (because of 5 threads). But if its something that wasnt designed at all in sling parallel chunking, than, at minimum I excpected to fail entire process if there is failed parts, or to be able to try them again in next runs untill they completed. Please advise, it feels that we can use it to boost our processes, but in the way it act like now feels that it will cause us alot of problems. Thanks in advence
f
hey @marikt94 yes that's something that needs improvement. The retry would usually take care of it. And yes, you can add a end-hook to check if any have failed. I agree that if some parts fail even after retry, that the whole run should fail. Currently, for the successful ones, the temp data would have already been merged into the final, so that would be an issue. I can the solution would be to have the temp data merged into final in a single transaction once all the parts are loaded in the temp table. Although I am curious, could you share the error of why the parts failed in your test? typically from DB to DB, it's just a different where clauses for each part, so failing parts typically don't occur.
m
Sure no problem, I will share that tonorrow. I wanted to mention again the merge process. I think that it can be problematic to make it works only by the "fully merged" or "failed". Lets say I have atable with 100M rows to move, so I can do it by chunk instead pf waiting to load it in one run, and the problem is that even the last chunk ia failed, the process will failed also, and ita fine by idea of "all or nothing", but I really suggest about adding ability to choose strategy, because it can me .ore efficient, if the process will merge only thoose first set of parts that succed until the one that fails, and in that case we wont lost time for nothing. From my experience, this is how we maintain our processes.. because there can be a lot of other things that can happen.. lost connection, timeout and e.t.c.. What do you think?
In summary: If there will be merge strategy that will merge only thoose parta that succeed until the first one that fails (in order) it will be perfect strategy in my opinion
f
Great suggestion. The thing is too, is that the data can be skewed. So a partition/chunk can be much bigger than others and can linger (say 3rd part out of 10), than all other 9 finish by 3rd (which is biggest) fails. If we are to do in order, than we start to lose the advantage of parallelism, since the next one has to wait to not get too ahead. So it gets tricky. I'll think more about this and get your feedback before implementation. having a choice of a Strategy is the right start 👍
m
Right, I also though anout it.. the other approach is to save the info of failed parts and to be able in next run prpcess them again.. Its can be only happen when the chunk is period or number, in chunk size shpuld be any problem like that..
f
@Colin thoughts are welcome
c
In my case i just re ran the entire failed table. But you could be more surgical with ranges. My understanding is sling state and increment is ignored when using backfill and range so that's not a problem
m
As I understand, this approach is mostly for initial el for a table? Because, I cant imagine maintaining on daily base tables with backfill or full refresh them if they failed. Another thoughts that I had, is to make it works almost as "stream" style, like to run it very frequintly but with limit.. But there is other problems with that..
@itamars_78208 what your thoughts?
i
Hi, 1. We can't wait until everything is successful and if it's not to fail it basically leaving it in the temp. Because as Mark said if it is very large tables, to start over will take all the time again. 2. Entering only the successful ones creates holes in the data. 3. I think the solution can be dividing the chunks into groups by the threads amount (or other parameter). Order the data, load to the Target the group if it's successful and update the state. If the group fails, stop the process. For example, let's say we have 30 days of (1 day chunk), we group them by 5 days so the first group will be 1-5 second group 6-10 ... I agree that if one of those chunks is very large, The load will be slower than if we let it go forward like you do today, because the next group will wait. But this way we can get parallelism without corrupting the target. Basically in this case a person can still set high thread amount and have the same experience like today, in my example if the thread will be 30 then it will behave the same. I think you can add it as new parameter: "group chunks" And the user can decide if he prefer inserting the chunk to the Target with no regards to the other chunks or use The group chunks method. What do you think?
m
this is the error one of the parts:~ Could not merge ~ error executing: with src_table ....... pq: could not serialize access due to read / write dependencies among transactions
f
@itamars_78208 yes, something in that order could work. Just don't want to make it too complicated as well, so will find a balance.
m
I tried the serializable level, and there is more successes.. But received several fails.. The error is different, it says that there are duplicates for primary key.. but actually there is no duplicates, I have the regular stream without chunking that works fine. What Im thinking is happened, is because my stream is based on modified time, is that specific row was updated while the stream was running, and it was catches in more than 1 part... lets say a chunk is 2 hours, than, can be situation when the rows from 2 hours ago, that already processed in this part was updated and now it will process also in current chunk. So, we are going back to idea, where every chunk\part should be inserted in order also because of this situation (in that way, there will be merge process that will replace the same row but for newer part), otherwise chunking should work based on creation date and not updated date, and I dont think that most of processes operate data on creation date.
i
@flarco Hi, this subject came back again in a project we do. From my perspective If there will be an option to insert chunks of chunks in Order, it will be good for our needs. I know it's not fully parallel. But let's say that we have 10 threads. Run parallelly on first ten only if all of them written to the temp table , load them all to the target and start the next 10. I understand that if nine of them are very small and one is large it will not be efficient as full parallelism. On the other hand to have the target chunks that succeeded in targte while missing chunks that didn't will leave us with gaps in the data needing manual find of the chunks that fail and try to understand why, 2. write the all 10 to one temp table and load it then start the next 10. 3. continue directly with writing to temp when a thread is free, but load to the table only on successful full bulk. that mean you are writing in parallel to temp tables, just load them in bulks of 10 (thread number) . This way if something fails you just don't load all the temps that wait.