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

repositories gone when upgrade from 2.2.4 to 2.3.5 #18019

Closed
finalha opened this issue Dec 21, 2022 · 7 comments
Closed

repositories gone when upgrade from 2.2.4 to 2.3.5 #18019

finalha opened this issue Dec 21, 2022 · 7 comments

Comments

@finalha
Copy link

finalha commented Dec 21, 2022

Harbor version: v2.2.4
OS: CentOS Linux release 7.6.1810 (Core)
Docker version:
Client: Docker Engine - Community
Version: 20.10.22
API version: 1.41
Go version: go1.18.9
Git commit: 3a2c30b
Built: Thu Dec 15 22:30:24 2022
OS/Arch:

linux/amd64

Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.22
API version: 1.41 (minimum version 1.12)
Go version: go1.18.9
Git commit: 42c8b31
Built: Thu Dec 15 22:28:33 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0

follow the document in https://goharbor.io/docs/2.3.0/administration/upgrade/
There are no issues during the the process of upgrading and logging.
The harbor.yaml is below:
图片

When I login the harbor, the old repositories are gone, but I can find the files in /opt/docker-hub/data/registry/docker/registry/v2/repositories, it seems that the database has someting wrong: there is no data in table task and execution
图片

The log of harbor-core and harbor-db containers are here:
harbor-core.log
harbor-db.log

By the way, when I try to upgrade from 2.2.4 to 2.4.3, the issue is the same. How could I fix it?

@chlins
Copy link
Member

chlins commented Dec 22, 2022

Maybe related with #17544.

@finalha
Copy link
Author

finalha commented Dec 23, 2022

Maybe related with #17544.

#17544 is the issue that the repositories are more than one with the same name in UI.
My issue is that I could not find all the repos from UI after upgrading.
It seems to be different.

@stonezdj
Copy link
Contributor

stonezdj commented Jan 3, 2023

You should add a semicolon at the end of the sql.

@finalha
Copy link
Author

finalha commented Jan 4, 2023

You should add a semicolon at the end of the sql.

registry=# select * from task;
id | execution_id | job_id | status | status_code | status_revision | status_message | run_count | extra_attrs | creation_time | start_time | update_time | end_time | vendor_type
----+--------------+--------+--------+-------------+-----------------+----------------+-----------+-------------+---------------+------------+-------------+----------+-------------
(0 rows)

registry=# select * from execution;
id | vendor_type | vendor_id | status | status_message | trigger | extra_attrs | start_time | end_time | revision | update_time
----+-------------+-----------+--------+----------------+---------+-------------+------------+----------+----------+-------------
(0 rows)

The result is nothing.

@chlins
Copy link
Member

chlins commented Jan 4, 2023

Could you try to execute select * from artifact; and select * from repository;?

@finalha
Copy link
Author

finalha commented Jan 5, 2023

Could you try to execute select * from artifact; and select * from repository;?

[root@harbor_test ~]# docker exec -it harbor-db bash
postgres [ / ]$ psql registry
psql (13.5)
Type "help" for help.

registry=# select * from artifact;
id | project_id | repository_name | digest | type | pull_time | push_time | repository_id | media_type | manifest_media_type | size | extra_attrs | annotations | icon
----+------------+-----------------+--------+------+-----------+-----------+---------------+------------+---------------------+------+-------------+-------------+------
(0 rows)

registry=# select * from repository;
repository_id | name | project_id | description | pull_count | star_count | creation_time | update_time
---------------+------+------------+-------------+------------+------------+---------------+-------------
(0 rows)

The old repo files of v2.2.4 is in /opt/docker-hub/data/registry/docker/registry/v2/repositories/, but can not find anything in the database
[root@harbor_test ~]# ls -al /opt/docker-hub/data/registry/docker/registry/v2/repositories/
总用量 0
drwxr-xr-x. 9 10000 10000 101 1月 4 09:47 .
drwxr-xr-x. 4 10000 10000 39 1月 4 09:47 ..
drwxr-xr-x. 4 10000 10000 35 1月 4 09:47 3rdparty
drwxr-xr-x. 3 10000 10000 27 1月 4 09:47 cnops
drwxr-xr-x. 3 10000 10000 24 1月 4 09:47 daily
drwxr-xr-x. 3 10000 10000 19 1月 4 09:47 dali
drwxr-xr-x. 3 10000 10000 18 1月 4 09:47 library
drwxr-xr-x. 3 10000 10000 21 1月 4 09:47 test
drwxr-xr-x. 3 10000 10000 22 1月 4 09:47 toolrd

@stonezdj
Copy link
Contributor

stonezdj commented Jan 9, 2023

It seems the database directory/file is incorrect.
If it is upgraded correctly, these two tables should not be empty.
Could you please upload the upgrade logs?

There is a similar issue, could you please apply this workaround?
#15464 (comment)

@stonezdj stonezdj closed this as completed Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants