Skip to content
GitLab
项目 群组 主题 代码片段
  • /
  • 帮助
    • 帮助
    • 支持
    • 社区论坛
    • 提交反馈
  • 登录
  • L large
  • 项目信息
    • 项目信息
    • 动态
    • 标记
    • 成员
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者统计
    • 分支图
    • 比较修订版本
  • 议题 21
    • 议题 21
    • 列表
    • 看板
    • 服务台
    • 里程碑
  • 合并请求 12
    • 合并请求 12
  • CI/CD
    • CI/CD
    • 流水线
    • 作业
    • 产物
    • 计划
  • 部署
    • 部署
    • 环境
    • 发布
  • 软件包与镜像库
    • 软件包与镜像库
    • 软件包库
    • 容器镜像库
    • Terraform 模块
    • 模型实验
  • 监控
    • 监控
    • 事件
  • 分析
    • 分析
    • 价值流
    • CI/CD
    • 仓库
  • Wiki
    • Wiki
  • 代码片段
    • 代码片段
  • 动态
  • 分支图
  • 创建新议题
  • 作业
  • 提交
  • 议题看板
收起侧边栏
  • 王权利
  • large
  • 议题
  • #3904

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

指派人
分配到
工时统计