我对整个 Lambda、AWS、步进函数和 Redshift 非常陌生。但我想我已经指出了一个让我去调查的问题。
step 函数调用 lambda 节点 js 代码来执行从 S3 到 Redshift 的复制。
相关步骤定义如下图
"States": {
...
"CopyFiles": {
"Type": "Task",
"Resource": "ARN:activity:CopyFiles",
"ResultPath": "...",
"Retry": [
{
"ErrorEquals": ["Error"],
"MaxAttempts": 0
},
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 60,
"BackoffRate": 2.0,
"MaxAttempts": 3
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"ResultPath": "$.errorPath",
"Next": "ErrorStateHandler"
}
],
"Next": "SuccessStep"
},
"SuccessStep": {
"Type": "Task",
"Resource": "ARN....",
"ResultPath": null,
"Retry": [
{
"ErrorEquals": ["Error"],
"MaxAttempts": 0
},
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 60,
"BackoffRate": 2.0,
"MaxAttempts": 3
}
],
"End": true
},
SQL 语句(在 CopyFiles 活动中使用)被包装在事务中
"BEGIN;
CREATE TABLE "tempTable_datetimestamp_here" (LIKE real_table);
COPY tempTable_datetimestamp_here from 's3://bucket/key...' IGNOREHEADER 1 COMPUPDATE OFF STATUPDATE OFF';
DELETE FROM toTable
USING tempTable_datetimestamp_here
WHERE toTable.index = tempTable_datetimestamp_here.index;
INSERT INTO toTable SELECT * FROM tempTable_datetimestamp_here;
END;
当我同时通过多个文件(50)时,所有步骤功能都挂起(继续运行直到我中止),请看截图。如果我输入一个文件,那么它工作正常。
select pid, trim(starttime) as start,
duration, trim(user_name) as user,
query as querytxt
from stv_recents
where status = 'Running';
不再返回任何内容。但是,阶跃函数仍显示为“正在运行”。
任何人都请告诉我我需要做什么才能让这个工作?谢谢蒂姆