【问题标题】:Deadlock problem in MySQL RDS using AWS Glue job使用 AWS Glue 作业的 MySQL RDS 中的死锁问题
【发布时间】:2020-08-11 10:40:46
【问题描述】:

我在 AWS UI 上使用 pyspark 编写了 Glue 作业。该作业从 json 中提取列名和值并写入 MySQL 表。 直到昨天,一切正常。现在我在 AWS Glue 控制台上收到错误消息:

调用 o984.pyWriteDynamicFrame 时出错。作业因阶段失败而中止:阶段 371.0 中的任务 71 失败 4 次,最近一次失败:阶段 371.0 中的任务 71.3 丢失(TID 25999,ip-10-0-1-5.eu-west-1.compute.internal,执行者 7):未知原因

在 cloudwatch 日志中,我可以看到:java.sql.BatchUpdateException: Deadlock found when trying to get lock;尝试重启事务

当我在 MySQL RDS 实例上运行命令时:

**show engine innodb status;**

Output: 

LATEST DETECTED DEADLOCK
------------------------
2020-08-11 10:17:57 0x2aca59649700TOO DEEP OR LONG SEARCH IN THE LOCK TABLE WAITS-FOR GRAPH, WE WILL ROLL BACK FOLLOWING TRANSACTION

*** TRANSACTION:
TRANSACTION 71219, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
6 lock struct(s), heap size 1136, 4 row lock(s), undo log entries 75
MySQL thread id 1771, OS thread handle 47048571524864, query id 38693 10.0.1.175 admin update
INSERT INTO etl_adp_engine_audit_items (`objectid`,`formula`,`date_end`,`decline_reasonid`,`object_name`,`audit_levelid`,`date_start`,`object_no`,`is_exit`,`outcomeid`,`parent_objectid`,`resultid`,`object_levelid`,`application_id`,`object_type`,`etl_adp_audit_id`,`id`) VALUES ('ab072fbc-88ce-4516-b89a-e44a5bb1f19d','ADP_Engine_Logic_Action_Variables.CreateVariableInteger(Convert.ToString(Functions.ParseEquation(Me, \'SC01\')),System.Int32.Parse(Functions.ParseEquation(Me, \'264\')))','2019-03-11 12:44:49.443000',NULL,'5.001 - Create Variable SC01',1,'2019-03-11 12:44:49.443000',253,0,1,'026f2cec-253f-4ac9-a4b9-3195de2a6a11',NULL,2,'1552308273','Action',20317,3365)
*** WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 443 page no 10 n bits 240 index adp_audit_items_index of table `culoansportaldb`.`etl_adp_engine_audit_items` trx id 71219 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 43 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 27; hex 352e3031202d2048617665457870657269616e203d202759455327; asc 5.01 - HaveExperian = 'YES';;
 1: len 4; hex 80000108; asc     ;;
 2: len 4; hex 52756c65; asc Rule;;
 3: len 8; hex 8000000000100ea6; asc         ;;
 4: len 8; hex 800000000000965b; asc        [;;

*** WE ROLL BACK TRANSACTION (2)
------------
TRANSACTIONS
------------
Trx id counter 71241
Purge done for trx's n:o < 71238 undo n:o < 0 state: running but idle
History list length 10
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 328521077494880, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 328521077494016, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 328521077493152, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 328521077492288, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 328521077491424, not started
0 lock struct(s), heap size 1136, 0 row lock(s)

谁能告诉我如何解决 Glue 中的问题或必须在 MySQL 上解决问题?

我已经探索过 AWS Glue,目前尚不支持自动提交或事务回滚。

任何帮助将不胜感激!

【问题讨论】:

    标签: mysql amazon-web-services amazon-rds deadlock aws-glue


    【解决方案1】:

    我认为这是 Glue 问题,但您可以在 MySQL 中解决问题。

    您可以将参数 innodb_lock_wait_timeout 增加到最大值,看看它是否适合您。

    如果可能的话,对粘合执行器的数量设置一个下限。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-27
      • 2022-12-03
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      相关资源
      最近更新 更多