Skip to content

[Bug][SonarQube] SonarQube data collection fails due to insufficient size of cq_issue_code_blocks.component column #8993

Description

@jvgr019

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

During the SonarQube data collection process, some executions fail due to a database column size limitation.
The issue appears to be related to the component column in the cq_issue_code_blocks table. Currently, this column is defined as:

component VARCHAR(191)

In certain cases, the value to insert at the column exceeds this length, causing the data collection process to fail.

The error is the following

attached stack trace -- stack trace: | github.com/apache/incubator-devlake/core/runner.RunPluginSubTasks | /app/core/runner/run_task.go:341 | [...repeated from below...] Wraps: (2) subtask convertIssueCodeBlocks ended unexpectedly Wraps: (3) attached stack trace -- stack trace: | github.com/apache/incubator-devlake/impls/dalgorm.(*Dalgorm).convertGormError | /app/impls/dalgorm/dalgorm.go:547 | github.com/apache/incubator-devlake/impls/dalgorm.(*Dalgorm).CreateOrUpdate | /app/impls/dalgorm/dalgorm.go:265 | github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*BatchSave).flushWithoutLocking | /app/helpers/pluginhelper/api/batch_save.go:131 | github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*BatchSave).Close | /app/helpers/pluginhelper/api/batch_save.go:147 | github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*BatchSaveDivider).Close | /app/helpers/pluginhelper/api/batch_save_divider.go:102 | github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*DataConverter).Execute | /app/helpers/pluginhelper/api/data_convertor.go:131 | github.com/apache/incubator-devlake/plugins/sonarqube/tasks.ConvertIssueCodeBlocks | /app/plugins/sonarqube/tasks/issue_code_blocks_convertor.go:77 | github.com/apache/incubator-devlake/core/runner.runSubtask | /app/core/runner/run_task.go:433 | github.com/apache/incubator-devlake/core/runner.RunPluginSubTasks | /app/core/runner/run_task.go:338 | github.com/apache/incubator-devlake/core/runner.RunPluginTask | /app/core/runner/run_task.go:173 | github.com/apache/incubator-devlake/core/runner.RunTask | /app/core/runner/run_task.go:147 | github.com/apache/incubator-devlake/server/services.runTaskStandalone | /app/server/services/task_runner.go:114 | github.com/apache/incubator-devlake/server/services.RunTasksStandalone.func1 | /app/server/services/task.go:187 | runtime.goexit | /usr/local/go/src/runtime/asm_amd64.s:1771 Wraps: (4) Error 1406 (22001): Data too long for column 'component' at row 299 (500) Wraps: (5) Error 1406 (22001): Data too long for column 'component' at row 299 Error types: (1) *withstack.withStack (2) *errutil.withPrefix (3) *withstack.withStack (4) *errutil.withPrefix (5) *mysql.MySQLError

Findings

After increasing the size of the component column, the data collection process completes successfully without errors.
This strongly suggests that the current column length is insufficient for some SonarQube component identifiers.
Transform to TEXT type should consider that there is an index for this column

Additionally, the current size of 191 characters seems unusual and arbitrary, making it difficult to justify from a functional perspective.

What do you expect to happen

The data collection process should successfully ingest SonarQube data regardless of the length of valid component identifiers returned by SonarQube.

How to reproduce

  • Collect SonarQube data for component with issue that have long path to the resource

Anything else

No response

Version

v1.0.3-beta14@50f664e

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThis issue is a bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions