From 43bead566c0592644b8a724135f774cee7c0f64e Mon Sep 17 00:00:00 2001 From: liningrui Date: Fri, 27 Nov 2020 16:21:49 +0800 Subject: [PATCH 1/3] Add check for load parameter --- .../controller/load/FileMappingController.java | 16 ++++++++++++++++ .../src/main/resources/i18n/messages.properties | 5 +++++ .../resources/i18n/messages_zh_CN.properties | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/hubble-be/src/main/java/com/baidu/hugegraph/controller/load/FileMappingController.java b/hubble-be/src/main/java/com/baidu/hugegraph/controller/load/FileMappingController.java index bcfed8b6..bb68827d 100644 --- a/hubble-be/src/main/java/com/baidu/hugegraph/controller/load/FileMappingController.java +++ b/hubble-be/src/main/java/com/baidu/hugegraph/controller/load/FileMappingController.java @@ -263,6 +263,7 @@ public FileMapping deleteEdgeMapping(@PathVariable("id") int id, */ @PostMapping("load-parameter") public void loadParameter(@RequestBody LoadParameter newEntity) { + this.checkLoadParameter(newEntity); List mappings = this.service.listAll(); for (FileMapping mapping : mappings) { LoadParameter oldEntity = mapping.getLoadParameter(); @@ -341,4 +342,19 @@ private void checkMappingValid(ElementMapping elementMapping, "load.file-mapping.value.keys-should-in-column-names"); } } + + private void checkLoadParameter(LoadParameter newEntity) { + Ex.check(newEntity.getMaxParseErrors() == Constant.NO_LIMIT || + newEntity.getMaxParseErrors() > 0, + "load.file-mapping.load-parameter.max-parse-error.illegal"); + Ex.check(newEntity.getMaxInsertErrors() == Constant.NO_LIMIT || + newEntity.getMaxInsertErrors() > 0, + "load.file-mapping.load-parameter.max-insert-error.illegal"); + Ex.check(newEntity.getInsertTimeout() > 0, + "load.file-mapping.load-parameter.insert-timeout.illegal"); + Ex.check(newEntity.getRetryTimes() > 0, + "load.file-mapping.load-parameter.retry-times.illegal"); + Ex.check(newEntity.getRetryInterval() > 0, + "load.file-mapping.load-parameter.retry-interval.illegal"); + } } diff --git a/hubble-be/src/main/resources/i18n/messages.properties b/hubble-be/src/main/resources/i18n/messages.properties index 26178988..6f0d7d39 100644 --- a/hubble-be/src/main/resources/i18n/messages.properties +++ b/hubble-be/src/main/resources/i18n/messages.properties @@ -134,6 +134,11 @@ load.file-mapping.vertex.id-fields-should-in-column-names=The all id fields {0} load.file-mapping.edge.not-exist.label=The edge mapping doesn't exist with label {0} load.file-mapping.edge.source-fields-cannot-be-empty=The source fields can't be empty load.file-mapping.edge.target-fields-cannot-be-empty=The target fields can't be empty +load.file-mapping.load-parameter.max-parse-error.illegal=The load paramter 'max-parse-errors' is illegal +load.file-mapping.load-parameter.max-insert-error.illegal=The load paramter 'max-insert-errors' is illegal +load.file-mapping.load-parameter.insert-timeout.illegal=The load paramter 'insert-timeout' is illegal +load.file-mapping.load-parameter.retry-times.illegal=The load paramter 'retry-times' is illegal +load.file-mapping.load-parameter.retry-interval.illegal=The load paramter 'retry-interval' is illegal load.build-task.failed=Build load task failed # job manager diff --git a/hubble-be/src/main/resources/i18n/messages_zh_CN.properties b/hubble-be/src/main/resources/i18n/messages_zh_CN.properties index 4e304200..0690c64b 100644 --- a/hubble-be/src/main/resources/i18n/messages_zh_CN.properties +++ b/hubble-be/src/main/resources/i18n/messages_zh_CN.properties @@ -134,6 +134,11 @@ load.file-mapping.vertex.id-fields-should-in-column-names=ID 列 {0} 必须都 load.file-mapping.edge.not-exist.label=不存在 label 为 {0} 的边映射 load.file-mapping.edge.source-fields-cannot-be-empty=起点 ID 列不能为空 load.file-mapping.edge.target-fields-cannot-be-empty=终点 ID 列不能为空 +load.file-mapping.load-parameter.max-parse-error.illegal=导入参数 'max-parse-errors' 不合法 +load.file-mapping.load-parameter.max-insert-error.illegal=导入参数 'max-insert-errors' 不合法 +load.file-mapping.load-parameter.insert-timeout.illegal=导入参数 'insert-timeout' 不合法 +load.file-mapping.load-parameter.retry-times.illegal=导入参数 'retry-times' 不合法 +load.file-mapping.load-parameter.retry-interval.illegal=导入参数 'retry-interval' 不合法 load.build-task.failed=构建导入任务失败 # job manager From 77ab547a5f0ea35b27f80f62be645756a7dda4a3 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 30 Nov 2020 11:28:31 +0800 Subject: [PATCH 2/3] tiny improve --- .../src/main/resources/i18n/messages_zh_CN.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hubble-be/src/main/resources/i18n/messages_zh_CN.properties b/hubble-be/src/main/resources/i18n/messages_zh_CN.properties index 0690c64b..0d461b57 100644 --- a/hubble-be/src/main/resources/i18n/messages_zh_CN.properties +++ b/hubble-be/src/main/resources/i18n/messages_zh_CN.properties @@ -134,11 +134,11 @@ load.file-mapping.vertex.id-fields-should-in-column-names=ID 列 {0} 必须都 load.file-mapping.edge.not-exist.label=不存在 label 为 {0} 的边映射 load.file-mapping.edge.source-fields-cannot-be-empty=起点 ID 列不能为空 load.file-mapping.edge.target-fields-cannot-be-empty=终点 ID 列不能为空 -load.file-mapping.load-parameter.max-parse-error.illegal=导入参数 'max-parse-errors' 不合法 -load.file-mapping.load-parameter.max-insert-error.illegal=导入参数 'max-insert-errors' 不合法 -load.file-mapping.load-parameter.insert-timeout.illegal=导入参数 'insert-timeout' 不合法 -load.file-mapping.load-parameter.retry-times.illegal=导入参数 'retry-times' 不合法 -load.file-mapping.load-parameter.retry-interval.illegal=导入参数 'retry-interval' 不合法 +load.file-mapping.load-parameter.max-parse-error.illegal=导入参数 允许最大解析错误行数 不合法 +load.file-mapping.load-parameter.max-insert-error.illegal=导入参数 允许最大插入错误行数 不合法 +load.file-mapping.load-parameter.insert-timeout.illegal=导入参数 插入超时时间/s 不合法 +load.file-mapping.load-parameter.retry-times.illegal=导入参数 插入失败重试次数 不合法 +load.file-mapping.load-parameter.retry-interval.illegal=导入参数 插入失败重试间隔/s 不合法 load.build-task.failed=构建导入任务失败 # job manager From d8a0234b8695c4100921a24f5fe31c5c9c22c281 Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 30 Nov 2020 12:00:49 +0800 Subject: [PATCH 3/3] tiny improve --- hubble-be/src/main/resources/i18n/messages.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hubble-be/src/main/resources/i18n/messages.properties b/hubble-be/src/main/resources/i18n/messages.properties index 6f0d7d39..ad5387a4 100644 --- a/hubble-be/src/main/resources/i18n/messages.properties +++ b/hubble-be/src/main/resources/i18n/messages.properties @@ -134,11 +134,11 @@ load.file-mapping.vertex.id-fields-should-in-column-names=The all id fields {0} load.file-mapping.edge.not-exist.label=The edge mapping doesn't exist with label {0} load.file-mapping.edge.source-fields-cannot-be-empty=The source fields can't be empty load.file-mapping.edge.target-fields-cannot-be-empty=The target fields can't be empty -load.file-mapping.load-parameter.max-parse-error.illegal=The load paramter 'max-parse-errors' is illegal -load.file-mapping.load-parameter.max-insert-error.illegal=The load paramter 'max-insert-errors' is illegal -load.file-mapping.load-parameter.insert-timeout.illegal=The load paramter 'insert-timeout' is illegal -load.file-mapping.load-parameter.retry-times.illegal=The load paramter 'retry-times' is illegal -load.file-mapping.load-parameter.retry-interval.illegal=The load paramter 'retry-interval' is illegal +load.file-mapping.load-parameter.max-parse-error.illegal=The load parameter 'max-parse-errors' is illegal +load.file-mapping.load-parameter.max-insert-error.illegal=The load parameter 'max-insert-errors' is illegal +load.file-mapping.load-parameter.insert-timeout.illegal=The load parameter 'insert-timeout' is illegal +load.file-mapping.load-parameter.retry-times.illegal=The load parameter 'retry-times' is illegal +load.file-mapping.load-parameter.retry-interval.illegal=The load parameter 'retry-interval' is illegal load.build-task.failed=Build load task failed # job manager