Defect #14626

Repositories' extra_info column is too short with MySQL

Added by Sergey Vasilyev about 4 years ago. Updated 6 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:SCM
Target version:3.4.0
Resolution:Fixed Affected version:2.3.1

Description

In the database table repositories a field named "extra_info" has type "text", which in mysql is limited to 65535 chars. This breaks fetch_changesets command on repositories with a very large amount of branches (git). Actual reason is that is stores only part of the last commit hash or other line (like "!b" for "!binary"), and this causes errors in in fetch_changeset:

$ /usr/local/rvm/bin/redmine_rails runner "Repository.fetch_changesets" -e production

/usr/local/rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands/runner.rb:53:in `eval': comparison of String with nil failed (ArgumentError)
    from /u01/apps/redmine-2.3.1/app/models/repository/git.rb:145:in `fetch_changesets'
    from /u01/apps/redmine-2.3.1/app/models/repository.rb:333:in `block (2 levels) in fetch_changesets'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:89:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
    from /u01/apps/redmine-2.3.1/app/models/repository.rb:331:in `block in fetch_changesets'
    from /u01/apps/redmine-2.3.1/app/models/repository.rb:330:in `each'
    from /u01/apps/redmine-2.3.1/app/models/repository.rb:330:in `fetch_changesets'
    from (eval):1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands/runner.rb:53:in `eval'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands/runner.rb:53:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:64:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands.rb:64:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Changing the field type to LONGTEXT fixes the problem.

14626-change_repositories_extra_info_limit.diff Magnifier - patch: increase size limit to 16MB (627 Bytes) Go MAEDA, 2017-03-20 06:24


Related issues

Related to Redmine - Defect #20127: The description column in the issues table is too short (... Closed

Associated revisions

Revision 16446
Added by Jean-Philippe Lang 6 months ago

Change extra_info to long text (#14626).

Patch by Go MAEDA.

History

#1 Updated by Toshi MARUYAMA about 4 years ago

  • Category changed from Database to SCM

#2 Updated by Dan Mick almost 2 years ago

Any plans to affect this?

In the meantime, not being a Rails programmer, can I change this in the database and expect the code to Just Work? (Edit: no, it'd at least take a migration and possible code change)

#3 Updated by Toshi MARUYAMA almost 2 years ago

Sergey Vasilyev wrote:

Changing the field type to LONGTEXT fixes the problem.

How to change on Rails?
http://railsdoc.com/migration

#4 Updated by Toshi MARUYAMA almost 2 years ago

Sergey Vasilyev wrote:

This breaks fetch_changesets command on repositories with a very large amount of branches (git).

I think you had better remove merged branches.
https://github.com/sparklemotion/nokogiri/issues/1336

#5 Updated by Florian Gruber over 1 year ago

encountered the same problem, Redmine version 3.1.1.stable.14752

Processing by SysController#fetch_changesets as HTML
  Parameters: {"key"=>"*********************"}
Mysql2::Error: Data too long for column 'extra_info' at row 1: UPDATE `repositories` SET `extra_info` = '---\nextra_report_last_commit: \'1\'\nheads:\n- !binar ....
...
n' WHERE `repositories`.`id` = 50

anything else to do except ?

ALTER TABLE repositories MODIFY extra_info LONGTEXT;

#6 Updated by Go MAEDA 6 months ago

  • Related to Defect #20127: The description column in the issues table is too short (MySQL) added

#7 Updated by Go MAEDA 6 months ago

Shouldn't we fix this issue along with #20127?
This is a patch to fix this: 14626-change_repositories_extra_info_limit.diff

#8 Updated by Go MAEDA 6 months ago

  • Target version set to 3.4.0

#9 Updated by Jean-Philippe Lang 6 months ago

  • Subject changed from repositories' extra_info is too short to Repositories' extra_info column is too short with MySQL
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed, thanks.

Also available in: Atom PDF