Task Repository Schema
本附录提供了在任务存储库中所用数据库模式的 ERD。
This appendix provides an ERD for the database schema used in the task repository. image::task_schema.png[]
Table Information
存储任务执行信息。
Stores the task execution information.
Column Name | Required | Type | Field Length | Notes |
---|---|---|---|---|
TASK_EXECUTION_ID |
TRUE |
BIGINT |
X |
Spring Cloud Task Framework at app startup establishes the next available id as obtained from the |
START_TIME |
FALSE |
DATETIME(6) |
X |
Spring Cloud Task Framework at app startup establishes the value. |
END_TIME |
FALSE |
DATETIME(6) |
X |
Spring Cloud Task Framework at app exit establishes the value. |
TASK_NAME |
FALSE |
VARCHAR |
100 |
Spring Cloud Task Framework at app startup will set this to "Application" unless user establish the name using the |
EXIT_CODE |
FALSE |
INTEGER |
X |
Follows Spring Boot defaults unless overridden by the user as discussed here. |
EXIT_MESSAGE |
FALSE |
VARCHAR |
2500 |
User Defined as discussed here. |
ERROR_MESSAGE |
FALSE |
VARCHAR |
2500 |
Spring Cloud Task Framework at app exit establishes the value. |
LAST_UPDATED |
TRUE |
TIMESTAMP |
X |
Spring Cloud Task Framework at app startup establishes the value. Or if the record is created outside of task then the value must be populated at record creation time. |
EXTERNAL_EXECUTION_ID |
FALSE |
VARCHAR |
250 |
If the |
PARENT_TASK_EXECUTION_ID |
FALSE |
BIGINT |
X |
If the |
存储用于任务执行的参数。
Stores the parameters used for a task execution
Column Name | Required | Type | Field Length |
---|---|---|---|
TASK_EXECUTION_ID |
TRUE |
BIGINT |
X |
TASK_PARAM |
FALSE |
VARCHAR |
2500 |
用于将任务执行链接到批次执行。
Used to link the task execution to the batch execution.
Column Name | Required | Type | Field Length |
---|---|---|---|
TASK_EXECUTION_ID |
TRUE |
BIGINT |
X |
JOB_EXECUTION_ID |
TRUE |
BIGINT |
X |
用于在 here 中讨论的 single-instance-enabled
功能。
Used for the single-instance-enabled
feature discussed here.
Column Name | Required | Type | Field Length | Notes |
---|---|---|---|---|
LOCK_KEY |
TRUE |
CHAR |
36 |
UUID for the this lock |
REGION |
TRUE |
VARCHAR |
100 |
User can establish a group of locks using this field. |
CLIENT_ID |
TRUE |
CHAR |
36 |
The task execution id that contains the name of the app to lock. |
CREATED_DATE |
TRUE |
DATETIME |
X |
The date that the entry was created |
可以在 here 中找到设置每种数据库类型的表的 DDL。 |
The DDL for setting up tables for each database type can be found here. |
SQL Server
默认情况下,Spring Cloud Task 使用一个序列表确定 TASK_EXECUTION
表的 TASK_EXECUTION_ID
。但是,在使用 SQL Server 同时启动多个任务时,这可能导致 TASK_SEQ
表发生死锁。解决方法是删除 TASK_EXECUTION_SEQ
表并使用相同名称创建序列。例如:
By default Spring Cloud Task uses a sequence table for determining the TASK_EXECUTION_ID
for the TASK_EXECUTION
table.
However, when launching multiple tasks simultaneously while using SQL Server, this can cause a deadlock to occur on the TASK_SEQ
table.
The resolution is to drop the TASK_EXECUTION_SEQ
table and create a sequence using the same name. For example:
DROP TABLE TASK_SEQ;
CREATE SEQUENCE [DBO].[TASK_SEQ] AS BIGINT
START WITH 1
INCREMENT BY 1;
将 |
Set the |