wwojciechp
(Wojciech Pawłowski)
August 22, 2024, 6:17pm
1
Referring to the topic Update from v3.70.1 to 3.71.0 - #10 by wwojciechp which is already closed the problem is about auto-increment in migrated database to H2.
The resourceful question is whether a fix for nexus-db-migrator will be released. Currently there is a version available: https://download.sonatype.com/nexus/nxrm3-migrator/nexus-db-migrator-3.70.1-03.jar
However, after migration, the error 500 described in the indicated thread is returned, what is the official position of sonatype? Will a new version of the migrator be released, if so in what time period? However, should we use the script from GitHub? Personally, I would prefer to use the official solution despite the script from comunity works.
2 Likes
wwojciechp
(Wojciech Pawłowski)
September 4, 2024, 8:07am
2
Regarding to this post on GitHub, fix ha been released:
opened 02:17PM - 12 Aug 24 UTC
bug
We are running "OSS 3.70.1-02", after running the migration script and setting `… nexus.datastore.enabled=true` everything seems to work except uploading new data.
When uploading we see exceptions like this
`Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.RAW_ASSET_BLOB(ASSET_BLOB_ID) ( /* key:0 */ 36, 'default@e6eab474-ed51-4131-8c45-f9bdae0fd551', CAST(420190 AS BIGINT), 'application/x-bzip2', JSON '{""sha1"":""cd45031441ac944eacebdc8d4b82b20cd9cc8461"",""md5"":""a23646617546bf6ad56f061d8b283c85""}', TIMESTAMP WITH TIME ZONE '2019-04-04 13:41:49.113+00', 'stijnv', '10.152.0.56', TIMESTAMP WITH TIME ZONE '1970-01-01 00:00:00+00')"; SQL statement:
INSERT INTO raw_asset_blob (blob_ref, blob_size, content_type, checksums,
blob_created, created_by, created_by_ip
)
VALUES (?, ?, ?, ?,
?, ?, ?
) [23505-224]`
After some further investigation it seems like all "auto increment" columns in the H2 database have been reset to start at "1"
I believe the workaround is to manually fix all the auto increment columns to not start at "1" but at the last value + 1:
`ALTER TABLE PUBLIC.DOCKER_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM DOCKER_ASSET_BLOB
`
However, I would assume the migration script already takes this into account, so I am wondering if something else is going on and other data might be missing in the migration?
jsevans
(Jason Evans)
September 13, 2024, 2:36pm
3
I’m getting the same error after upgrading. I upgraded from 3.68 to 3.70 then I upgraded my DB to H2 then to 3.72.
Now my self-hosted repos are getting the same issue but my proxy repos are now affected. I am running Nexus in a Docker container.