Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
7e5f22d8
Unverified
Commit
7e5f22d8
authored
Nov 30, 2023
by
gaoyan
Committed by
GitHub
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Independent batch model field to fix the H 2 SQL incompatibility issue (#2587)
* Independent batch model field to fix the H 2 SQL incompatibility issue * formate code
parent
f41358ec
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
16 deletions
+30
-16
History.java
...admin/src/main/java/org/dinky/data/model/job/History.java
+3
-0
Job2MysqlHandler.java
...src/main/java/org/dinky/job/handler/Job2MysqlHandler.java
+6
-4
db-h2-ddl.sql
dinky-admin/src/main/resources/db/db-h2-ddl.sql
+1
-0
JobInstanceMapper.xml
dinky-admin/src/main/resources/mapper/JobInstanceMapper.xml
+6
-6
Job.java
dinky-core/src/main/java/org/dinky/job/Job.java
+11
-5
dinky-mysql.sql
script/sql/dinky-mysql.sql
+1
-0
dinky-pg.sql
script/sql/dinky-pg.sql
+1
-0
dinky_dml.sql
script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_dml.sql
+1
-1
No files found.
dinky-admin/src/main/java/org/dinky/data/model/job/History.java
View file @
7e5f22d8
...
...
@@ -76,6 +76,9 @@ public class History implements Serializable {
@ApiModelProperty
(
value
=
"Job Manager Address"
,
dataType
=
"String"
)
private
String
jobManagerAddress
;
@ApiModelProperty
(
value
=
"batchModel"
,
dataType
=
"Boolean"
)
private
Boolean
batchModel
;
@ApiModelProperty
(
value
=
"Status"
,
dataType
=
"Integer"
)
private
Integer
status
;
...
...
dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java
View file @
7e5f22d8
...
...
@@ -86,7 +86,7 @@ public class Job2MysqlHandler implements JobHandler {
}
history
.
setJobManagerAddress
(
job
.
getJobManagerAddress
());
history
.
setJobName
(
job
.
getJobConfig
().
getJobName
());
history
.
setStatus
(
job
.
getStatus
().
ordinal
());
history
.
setStatus
(
job
.
getStatus
().
getCode
());
history
.
setStatement
(
job
.
getStatement
());
history
.
setStartTime
(
job
.
getStartTime
());
history
.
setTaskId
(
job
.
getJobConfig
().
getTaskId
());
...
...
@@ -115,9 +115,10 @@ public class Job2MysqlHandler implements JobHandler {
History
history
=
new
History
();
history
.
setId
(
job
.
getId
());
history
.
setBatchModel
(
job
.
getJobConfig
().
isBatchModel
());
if
(
job
.
isUseGateway
()
&&
Asserts
.
isNullString
(
job
.
getJobId
()))
{
job
.
setJobId
(
"unknown"
);
history
.
setStatus
(
Job
Status
.
FAILED
.
ordinal
());
history
.
setStatus
(
Job
.
JobStatus
.
FAILED
.
getCode
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setError
(
"没有获取到任何JID,请自行排查原因"
);
...
...
@@ -125,7 +126,7 @@ public class Job2MysqlHandler implements JobHandler {
return
false
;
}
history
.
setStatus
(
job
.
getStatus
().
ordinal
());
history
.
setStatus
(
job
.
getStatus
().
getCode
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setJobManagerAddress
(
job
.
isUseGateway
()
?
job
.
getJobManagerAddress
()
:
null
);
...
...
@@ -207,9 +208,10 @@ public class Job2MysqlHandler implements JobHandler {
public
boolean
failed
()
{
Job
job
=
JobContextHolder
.
getJob
();
History
history
=
new
History
();
history
.
setBatchModel
(
job
.
getJobConfig
().
isBatchModel
());
history
.
setId
(
job
.
getId
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setStatus
(
job
.
getStatus
().
ordinal
());
history
.
setStatus
(
job
.
getStatus
().
getCode
());
history
.
setJobManagerAddress
(
job
.
getJobManagerAddress
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setError
(
job
.
getError
());
...
...
dinky-admin/src/main/resources/db/db-h2-ddl.sql
View file @
7e5f22d8
...
...
@@ -158,6 +158,7 @@ CREATE TABLE `dinky_history` (
`job_id`
varchar
(
50
)
null
DEFAULT
null
COMMENT
'Job ID'
,
`job_name`
varchar
(
255
)
null
DEFAULT
null
COMMENT
'Job Name'
,
`job_manager_address`
varchar
(
255
)
null
DEFAULT
null
COMMENT
'JJobManager Address'
,
`batch_model`
boolean
null
DEFAULT
false
COMMENT
'is batch model'
,
`status`
int
(
11
)
NOT
null
DEFAULT
0
COMMENT
'status'
,
`type`
varchar
(
50
)
null
DEFAULT
null
COMMENT
'job type'
,
`statement`
text
null
COMMENT
'statement set'
,
...
...
dinky-admin/src/main/resources/mapper/JobInstanceMapper.xml
View file @
7e5f22d8
...
...
@@ -73,13 +73,13 @@
</select>
<select
id=
"getJobStreamingOrBatchModelOverview"
resultType=
"org.dinky.data.model.home.JobModelOverview"
>
select sum(
IF(b.batch, 1, 0)
) as batchJobCount,
sum(IF(b.batch, 0, 1)
) as streamingJobCount
from (select
json_extract(dh.config_json, '$.batchModel')
as batch
from (select max(ji.id) as id from dinky_job_instance ji group by ji.task_id) as a
select sum(
case when b.batch then 1 else 0 end
) as batchJobCount,
sum(case when b.batch then 0 else 1 end
) as streamingJobCount
from (select
batch_model
as batch
from (select max(ji.id) as id from dinky_job_instance ji group by ji.task_id) as a
left join dinky_job_instance dji on dji.id = a.id
left join dinky
.dinky
_history dh on dji.history_id = dh.id) b
group by b.batch
left join dinky_history dh on dji.history_id = dh.id) b
group by b.batch
;
</select>
<select
id=
"listJobInstanceActive"
resultType=
"org.dinky.data.model.job.JobInstance"
>
...
...
dinky-core/src/main/java/org/dinky/job/Job.java
View file @
7e5f22d8
...
...
@@ -55,12 +55,18 @@ public class Job {
private
boolean
useGateway
;
private
List
<
String
>
jids
;
@Getter
public
enum
JobStatus
{
INITIALIZE
,
RUNNING
,
SUCCESS
,
FAILED
,
CANCEL
INITIALIZE
(
1
),
RUNNING
(
2
),
SUCCESS
(
3
),
FAILED
(
4
),
CANCEL
(
5
);
final
int
code
;
JobStatus
(
int
code
)
{
this
.
code
=
code
;
}
}
public
Job
(
...
...
script/sql/dinky-mysql.sql
View file @
7e5f22d8
...
...
@@ -1158,6 +1158,7 @@ CREATE TABLE `dinky_history` (
`job_name`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
DEFAULT
NULL
COMMENT
'Job Name'
,
`job_manager_address`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
DEFAULT
NULL
COMMENT
'JJobManager Address'
,
`status`
int
(
11
)
NOT
NULL
DEFAULT
0
COMMENT
'status'
,
`batch_model`
boolean
NOT
NULL
DEFAULT
false
COMMENT
'is batch model'
,
`type`
varchar
(
50
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
DEFAULT
NULL
COMMENT
'job type'
,
`statement`
text
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
COMMENT
'statement set'
,
`error`
text
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
COMMENT
'error message'
,
...
...
script/sql/dinky-pg.sql
View file @
7e5f22d8
...
...
@@ -1351,6 +1351,7 @@ CREATE TABLE "public"."dinky_history" (
"job_id"
varchar
(
50
)
COLLATE
"pg_catalog"
.
"default"
,
"job_name"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"job_manager_address"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"batch_model"
boolean
COLLATE
"pg_catalog"
.
"default"
,
"status"
int4
NOT
null
,
"type"
varchar
(
50
)
COLLATE
"pg_catalog"
.
"default"
,
"statement"
text
COLLATE
"pg_catalog"
.
"default"
,
...
...
script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_dml.sql
View file @
7e5f22d8
...
...
@@ -286,7 +286,7 @@ UPDATE dinky_task_version SET task_configure=JSON_REMOVE(task_configure, '$.jarI
UPDATE
dinky_history
SET
config_json
=
JSON_REMOVE
(
config_json
,
'$.jarId'
);
UPDATE
dinky_history
SET
config_json
=
JSON_REMOVE
(
config_json
,
'$.jarTask'
);
UPDATE
dinky_history
SET
config_json
=
JSON_REMOVE
(
config_json
,
'$.session'
);
alter
table
dinky_history
add
batch_model
boolean
default
false
null
after
job_manager_address
;
insert
into
`dinky_flink_document`
(
id
,
category
,
type
,
subtype
,
name
,
description
,
fill_value
,
version
,
like_num
,
enabled
,
create_time
,
update_time
)
values
(
218
,
'Reference'
,
'建表语句'
,
'Streaming'
,
'EXECUTE CDCSOURCE print'
,
'Whole library synchronization print'
,
'EXECUTE CDCSOURCE demo_print WITH (
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment