I have a sqoop job that fetches data from SQL Server. For some reson if I am killing the sqoop-job, the --query trigerred at the source is not getting killed, it keeps running at the sql server end.
I checked this ghost query running using the command:
SELECT r.session_id,
st.TEXT AS batch_text,
qp.query_plan AS 'XML Plan',
r.start_time,
r.status,
r.total_elapsed_time
FROM sys.dm_exec_requests AS r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS st
CROSS APPLY sys.dm_exec_query_plan(r.plan_handle) AS qp
WHERE DB_NAME(r.database_id) = 'prd'
ORDER BY cpu_time DESC;
Sqoop command I am using is:
sqoop import -jt local -Dmapreduce.map.memory.mb=4096 -Dmapreduce.map.java.opts="-Xmx4096m -Xms4096m" \
--connect "jdbc:jtds:sqlserver://prod.server.com:10501;instanceName=HELIOS_LIVE;serverName=prod.server.com;databaseName=prd;multiSubnetFailover=true;integratedSecurity=true;authenticationScheme=JavaKerberos;useKerberos=true" \
--connection-manager org.apache.sqoop.manager.SQLServerManager \
--driver net.sourceforge.jtds.jdbc.Driver \
--outdir /home/aiman/sqoop_code/landing \
--class-name landing \
--target-dir /apps/aiman/tbl_landing_stg/19000101 \
--delete-target-dir \
--query "SELECT col1,col2,col3 from prd.tab1 where business_date=20240103"
What changes should I make to kill the sqoop trigerred query at the source, when the job is killed/terminated ?