Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #3904

Closed
Open
Created May 10, 2013 by Administrator@rootOwner

Snippet body is truncated

Created by: dblessing

I just encountered truncation on a snippet body that was excessively long. I added a thread dump file and it was truncated after 800 some lines. I'm guessing it has to do with the database column size. Is there any way we could increase the size of that column in the future? It would be nice if we weren't limited on snippet body at all. This issue occurred on tag v5.1.0 running on Centos 6.4 with MySQL backend. This could be related to #2677 (closed)

Steps to reproduce: Create a snippet that is greater than 65,535 characters in length. It will be created but will be truncated at 65,535 characters.

Expected behavior: Snippets can be of infinite length (or much longer than 65,535).

Observed behavior: Truncated at 65,535

Relevant screenshots:

mysql> desc snippets;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| title      | varchar(255) | YES  |     | NULL    |                |
| content    | text         | YES  |     | NULL    |                |
| author_id  | int(11)      | NO   |     | NULL    |                |
| project_id | int(11)      | NO   | MUL | NULL    |                |
| created_at | datetime     | NO   | MUL | NULL    |                |
| updated_at | datetime     | NO   |     | NULL    |                |
| file_name  | varchar(255) | YES  |     | NULL    |                |
| expires_at | datetime     | YES  | MUL | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)

mysql> SELECT MAX(LENGTH(content)) FROM snippets;
+----------------------+
| MAX(LENGTH(content)) |
+----------------------+
|                65535 |
+----------------------+
1 row in set (0.02 sec)

Possible fixes: Change db schema column size. This would be changed in this file, on this line - https://github.com/gitlabhq/gitlabhq/blob/master/db/schema.rb#L205. The line may end up being something like

    t.text     "content",                    :limit => 16777215

This would increase character max from 65,535 to 16,777,215. (Actually, that's bytes, but who's keeping track ;) ) This is as found in ActiveRecord docs at http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column

Assignee
Assign to
Time tracking