Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB topic.name uses varying(25) which makes mirrors of repos with long topics fail #14108

Closed
1 task done
michaelx opened this issue Dec 22, 2020 · 11 comments · Fixed by #14150 or #14152
Closed
1 task done

DB topic.name uses varying(25) which makes mirrors of repos with long topics fail #14108

michaelx opened this issue Dec 22, 2020 · 11 comments · Fixed by #14150 or #14152
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug

Comments

@michaelx
Copy link

michaelx commented Dec 22, 2020

  • Gitea version: 1.13.0 (also fails on latest dev)
  • Git version: 2.26.2
  • Operating system:
    • docker-compose with the image gitea/gitea:1
  • Database:
    • PostgreSQL

Description

  1. Create new migration
  2. Select GitHub
  3. Clone https://github.com/survivejs/webpack-book as a mirror
  4. Will fail with:
Migrate repository from https://github.com/survivejs/webpack-book failed: pq: value too long for type character varying(25)

Can be solved by using varying(255) on topic.name. Is there a reason it's limited to 25?

@lunny
Copy link
Member

lunny commented Dec 22, 2020

We need index the column, so it shouldn't too big. How many characters with Github Topic name? 🤔

@michaelx
Copy link
Author

The one it fails with is 26, but I think it would be fine to just drop topics that are too long on migration. Gitea shouldn't fail just because of it though. What do you think?

@lunny
Copy link
Member

lunny commented Dec 22, 2020

@michaelx Good idea! We need a PR to fix that.

@michaelx
Copy link
Author

PR is up for grabs as this isn't my stack, I am afraid. Thanks.

@lunny lunny added type/bug topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them labels Dec 22, 2020
@zeripath
Copy link
Contributor

it certainly appears that there is no limit in GH

@Vitexus
Copy link

Vitexus commented Dec 23, 2020

I confirm that error:

2020/12/23 00:01:16 modules/task/task.go:51:handle() [E] Run task failed: Error 1406: Data too long for column 'name' at row 1

Is it an typo ? All other names in database are 255 chars long.
I'll fix it manually in my db using

ALTER TABLE `topic` CHANGE `name` `name` VARCHAR(255); 

After that migration was successfull

@zeripath
Copy link
Contributor

it's partly to do with the fact that they're indexed but I suspect it's an incorrect decision and we should just increase that field and either make it be indexed with bleve or just deal with it.

@Vitexus
Copy link

Vitexus commented Dec 25, 2020

I didn't provide pull request cause i don't know right final solution. It was only dirty hotfix. I'm looking forward fixed version.

@Vitexus
Copy link

Vitexus commented Dec 25, 2020

Please note: NOT ONLY POSTGRES
I use MariaDB with the same problem.

@somera
Copy link

somera commented Dec 25, 2020

In which Gitea version it will be fixed?

@lunny
Copy link
Member

lunny commented Dec 25, 2020

A simple solution is to change to a big size i.e. 50 , but that may also not enough?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
5 participants