Created 04-03-2017 03:45 PM
I have a general question about how sqoop works.
When you run an import, does sqoop take a snapshot of the table at that time and import that result? Or does it keep an active window of the data?
If the table is rapidly changing, would that cause issues with the data import?
My import query looks like this: SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY COL1) R FROM TABLE) A WHERE \$CONDITIONS
Upon doing some QA on the imported data to HDFS, I am seeing the overall row count is close to the source table, but the data is inconsistent. For example, there are plenty of missing rows and duplicated rows. This is a large table sitting at ~560 million rows.
I am calculating the row number in order to get a perfect split-by, but I think that may be where the problem is coming from. It takes a few minutes to calculate the row numbers and my hunch is that while that's happening, the table is being updated at the source and it is throwing the row numbers and subsequent import off.
Created 04-03-2017 05:21 PM
Sqoop does not make a snapshot before moving data. By default sqoop uses "read committed isolation" level to import data. So if your data is committed, it will be read.
Created 04-03-2017 06:32 PM
Can you please explain further what read committed isolation is?
Created 04-03-2017 06:23 PM
Does this table have a timestamp column or a column that can be indexed as a highest value column. If you do, then sqoop job would be the most efficient and consistent way to move data from source to you destination, without loosing data.
Please read this tutorial to extract data to your source in a consistent way
Created 04-03-2017 06:33 PM
Unfortunately there is no timestamp or any other good candidate for a split-by, which is why I was trying to generate row numbers on the fly
Created 04-04-2017 03:35 PM
Can you write triggers that can copy the data into a newer table and may be you can introduce the timestamp and mark the transactions if it was update, insert or a delete. I know it may not be possible to influence the source databases..