sqoop fails to store incremental state to the metastore

与世无争的帅哥 提交于 2019-11-29 15:51:56
Samson Scharfrichter

It is not very difficult to start a HSQLDB instance as a Linux service somewhere. Even if you stick to the obsolete V1.8 that is packaged with Sqoop1.

=> Running Hsqldb (1.8) as a System Daemon

Then you have to backup the data periodically => connect with JDBC client, run a CHECKPOINT, backup the "script" file that contains all SQL necessary to rebuild the DB snapshot.

Might be much easier than trying to hack a MySQL JDBC connection into that source code that expects HSQLDB.

Ah, and for no additional cost, you will find here some explanations about how to use Java properties in the default conf files instead of command-line arguments.

Ran into the same problem today with MySQL and found out why.

Sqoop locks himself out i guess by using different jdbc connections within the same process. By default, MariaDB (MySQL) creates table using the INNODB engine witch introduces transactions... I guess nobody tested Sqoop with INNODB.

All I did was to recreate the SQOOP_SESSIONS table in the metastore and used MyISAM engine.

CREATE TABLE `SQOOP_SESSIONS_n` (
  `job_name` varchar(64) NOT NULL,
  `propname` varchar(128) NOT NULL,
  `propval` varchar(1024) DEFAULT NULL,
  `propclass` varchar(32) NOT NULL,
  UNIQUE KEY `SQOOP_SESSIONS_n_unq` (`job_name`,`propname`,`propclass`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

drop table SQOOP_SESSIONS;

rename table SQOOP_SESSIONS_n to SQOOP_SESSIONS;

Of course you wouldn't want to loose your created jobs if you had any. Just copy them BEFORE dropping the table:

insert into SQOOP_SESSIONS_n select * from SQOOP_SESSIONS;

It looks like you error is on the mySQL side. Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

Can you send the complete command you used to run this.

Check the following in MySQL:- show engine innodb status\G

You should consider increasing the lock wait timeout value for InnoDB by setting the innodb_lock_wait_timeout, default is 50 sec

show variables like 'innodb_lock_wait_timeout';

you can set it to higher value in /etc/my.cnf permanently with this line

innodb_lock_wait_timeout=120 and restart mysql.

If you cannot restart mysql at this time, run this:

SET GLOBAL innodb_lock_wait_timeout = 120; You could also just set it for the duration of your session

SET innodb_lock_wait_timeout = 120;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!