You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2023/01/20 01:44:56 UTC
[GitHub] [incubator-devlake] keon94 opened a new issue, #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
keon94 opened a new issue, #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
### What happened
I was testing out Jenkins, and decided to add a new job to scopes. It throws:
```
time="2023-01-19 19:36:04" level=info msg="[31;1m/mnt/c/Users/Keon/Dev/Shared/lake/backend/impls/dalgorm/dalgorm.go:180 [35;1mError 1062: Duplicate entry 'Jenkins-Local-Project-cicd_scopes-jenkins:JenkinsJob:3:test-fold' for key 'project_mapping.PRIMARY'
[0m[33m[0.497ms] [34;1m[rows:0][0m INSERT INTO `project_mapping` (`project_name`,`table`,`row_id`,`created_at`,`updated_at`,`_raw_data_params`,`_raw_data_table`,`_raw_data_id`,`_raw_data_remark`) VALUES ('Jenkins-Local-Project','cicd_scopes','jenkins:JenkinsJob:3:test-folder/basic-job','2023-01-19 19:36:04.415','2023-01-19 19:36:04.415','','',0,'')"
time="2023-01-19 19:36:04" level=error msg="HTTP 400 error
caused by: attached stack trace
-- stack trace:
| github.com/apache/incubator-devlake/server/api/blueprints.Patch
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/api/blueprints/blueprints.go:159
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/recovery.go:99
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.LoggerWithConfig.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/logger.go:241
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:555
| github.com/gin-gonic/gin.(*Engine).ServeHTTP
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:511
| net/http.serverHandler.ServeHTTP
| /home/keon/go/src/net/http/server.go:2947
| net/http.(*conn).serve
| /home/keon/go/src/net/http/server.go:1991
Wraps: (2) error patching the blueprint (400)
Wraps: (3) attached stack trace
-- stack trace:
| github.com/apache/incubator-devlake/server/services.saveBlueprint
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:163
| github.com/apache/incubator-devlake/server/services.PatchBlueprint
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:197
| github.com/apache/incubator-devlake/server/api/blueprints.Patch
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/api/blueprints/blueprints.go:157
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/recovery.go:99
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.LoggerWithConfig.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/logger.go:241
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:555
| github.com/gin-gonic/gin.(*Engine).ServeHTTP
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:511
| net/http.serverHandler.ServeHTTP
| /home/keon/go/src/net/http/server.go:2947
| net/http.(*conn).serve
| /home/keon/go/src/net/http/server.go:1991
Wraps: (4) attached stack trace
-- stack trace:
| github.com/apache/incubator-devlake/server/services.validateBlueprintAndMakePlan
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:149
| [...repeated from below...]
Wraps: (5) make plan for blueprint failed
Wraps: (6) attached stack trace
-- stack trace:
| github.com/apache/incubator-devlake/impls/dalgorm.(*Dalgorm).Create
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/impls/dalgorm/dalgorm.go:180
| github.com/apache/incubator-devlake/server/services.GeneratePlanJsonV200
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint_makeplan_v200.go:65
| github.com/apache/incubator-devlake/server/services.MakePlanForBlueprint
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:296
| github.com/apache/incubator-devlake/server/services.validateBlueprintAndMakePlan
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:147
| github.com/apache/incubator-devlake/server/services.saveBlueprint
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:161
| github.com/apache/incubator-devlake/server/services.PatchBlueprint
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/services/blueprint.go:197
| github.com/apache/incubator-devlake/server/api/blueprints.Patch
| /mnt/c/Users/Keon/Dev/Shared/lake/backend/server/api/blueprints/blueprints.go:157
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/recovery.go:99
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.LoggerWithConfig.func1
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/logger.go:241
| github.com/gin-gonic/gin.(*Context).Next
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/context.go:168
| github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:555
| github.com/gin-gonic/gin.(*Engine).ServeHTTP
| /home/keon/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:511
| net/http.serverHandler.ServeHTTP
| /home/keon/go/src/net/http/server.go:2947
| net/http.(*conn).serve
| /home/keon/go/src/net/http/server.go:1991
| runtime.goexit
| /home/keon/go/src/runtime/asm_amd64.s:1594
Wraps: (7) Error 1062: Duplicate entry 'Jenkins-Local-Project-cicd_scopes-jenkins:JenkinsJob:3:test-fold' for key 'project_mapping.PRIMARY
```
### What do you expect to happen
No error.
### How to reproduce
Reconfigure any project scope. This should be independent of Jenkins.
### Anything else
Fix should be straightforward. Change [this line](https://github.com/apache/incubator-devlake/blob/e6021492cd935f29ad61475d13d326dba0074a44/backend/server/services/blueprint_makeplan_v200.go#L65) to use _CreateOrUpdate_ instead of _Create_.
### Version
main
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "likyh (via GitHub)" <gi...@apache.org>.
likyh commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407381856
@keon94 Hi, would you like add some information for it? I want know when scopes will be duplicated like this issue to confirm the fix PR is right.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] keon94 commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "keon94 (via GitHub)" <gi...@apache.org>.
keon94 commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407744646
@likyh @klesh
You just have to change the Data scope of an existing blueprint and try rerunning it. For example this one:

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "likyh (via GitHub)" <gi...@apache.org>.
likyh commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407275866
The reason that `'Jenkins-Local-Project','cicd_scopes','jenkins:JenkinsJob:3:test-folder/basic-job'` will duplicate with `'Jenkins-Local-Project-cicd_scopes-jenkins:JenkinsJob:3:test-fold' for key 'project_mapping.PRIMARY'` is mysql error message don't show correctly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "likyh (via GitHub)" <gi...@apache.org>.
likyh commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407884012

1. choose a repo in a folder and save
2. choose the parent folder
3. save and find a duplicate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] keon94 commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "keon94 (via GitHub)" <gi...@apache.org>.
keon94 commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1400884445
@anurag-rajawat yes, I'vd assigned it to you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] klesh commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407535734
@keon94 Can you describe how to reproduce the error so we can fix it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] likyh closed issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "likyh (via GitHub)" <gi...@apache.org>.
likyh closed issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
URL: https://github.com/apache/incubator-devlake/issues/4240
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] keon94 commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "keon94 (via GitHub)" <gi...@apache.org>.
keon94 commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1407749289
I am at the moment only getting this with my existing Jenkins blueprint. Adding a brand new one and redoing everything the same way didn't encounter this. Did the same with Github and tried adding a new repo and had no problems. I am assuming something has already been fixed/changed? If so, it's just a corrupt blueprint that I have then, and we can probably close this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] anurag-rajawat commented on issue #4240: [Bug][Framework] Reconfiguring projects throws SQL Duplicate key error
Posted by "anurag-rajawat (via GitHub)" <gi...@apache.org>.
anurag-rajawat commented on issue #4240:
URL: https://github.com/apache/incubator-devlake/issues/4240#issuecomment-1399181172
Hi @keon94
May I work on this one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org