Files
spring-cloud-task/docs/modules/ROOT/pages/appendix-task-repository-schema.adoc
Marcin Grzejszczak 9b4d7f09c1 Spring Cloud Task generates documentation for Antora infra
Migrate Structure

Insert explicit ids for headers

Remove unnecessary asciidoc attributes

Copy default antora files

Fix indentation for all pages

Generate a default navigation

Remove includes

Fix cross references

Enable Section Summary TOC for small pages

WIP

Nav.adoc now represents a list of navigation properties

Warning and errors are now resolved.
Observability docs now present in navigation bar and properly visible

Index.adoc contains preface information .

Nav.adoc contains proper ordering for appendix information
2023-09-11 08:20:34 -04:00

101 lines
4.5 KiB
Plaintext

[[appendix-task-repository-schema]]
= Task Repository Schema
[[partintro]]
--
This appendix provides an ERD for the database schema used in the task repository.
--
image::task_schema.png[]
[[table-information]]
== Table Information
--
.TASK_EXECUTION
Stores the task execution information.
[width="80%", cols="1,1,1,1,10", options="header"]
|=========================================================
|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 `TASK_SEQ`. Or if the record is created outside of task then the value must be populated at record creation time.
|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 `spring.application.name`.
|EXIT_CODE |FALSE | INTEGER | X | Follows Spring Boot defaults unless overridden by the user as discussed https://docs.spring.io/spring-cloud-task/docs/current/reference/#features-lifecycle-exit-codes[here].
|EXIT_MESSAGE |FALSE | VARCHAR | 2500 | User Defined as discussed https://docs.spring.io/spring-cloud-task/docs/current/reference/#features-task-execution-listener-exit-messages[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 `spring.cloud.task.external-execution-id` property is set then Spring Cloud Task Framework at app startup will set this to the value specified. More information can be found xref:features.adoc#features-external_task_id[here]
|PARENT_TASK_EXECUTION_ID |FALSE |BIGINT | X | If the `spring.cloud.task.parent-execution-id` property is set then Spring Cloud Task Framework at app startup will set this to the value specified. More information can be found xref:features.adoc#features-parent_task_id[here]
|=========================================================
.TASK_EXECUTION_PARAMS
Stores the parameters used for a task execution
[width="80%", cols="1,1,1,1", options="header"]
|=========================================================
|Column Name |Required |Type |Field Length
|TASK_EXECUTION_ID |TRUE |BIGINT | X
|TASK_PARAM |FALSE | VARCHAR | 2500
|=========================================================
.TASK_TASK_BATCH
Used to link the task execution to the batch execution.
[width="80%", cols="1,1,1,1", options="header"]
|=========================================================
|Column Name |Required |Type |Field Length
|TASK_EXECUTION_ID |TRUE |BIGINT | X
|JOB_EXECUTION_ID |TRUE | BIGINT | X
|=========================================================
.TASK_LOCK
Used for the `single-instance-enabled` feature discussed xref:features.adoc#features-single-instance-enabled[here].
[width="80%", cols="1,1,1,1,10", options="header"]
|=========================================================
|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
|=========================================================
NOTE: The DDL for setting up tables for each database type can be found https://github.com/spring-cloud/spring-cloud-task/tree/master/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task[here].
--
[[sql-server]]
== SQL Server
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;
```
NOTE: Set the `START WITH` to a higher value than your current execution id.