Search code examples
gerrit

How to migrate gerrit 2.16 to gerrit 3.0 ? "--migrate-to-note-db" is not a valid option


I upgraded to latest stable 2.* version, now following the doc, I try to upgrade from 2.16 to 3.0, and I have this error (trying to migrate from PostgresSql to NoteDB):

$ java -jar gerrit-3.0.0.war init -d ~/gerrit --migrate-to-note-db
fatal: "--migrate-to-note-db" is not a valid option

Or by a restart :

[...]
Exception in thread "main" com.google.gerrit.exceptions.StorageException: You appear to be upgrading from a 2.x site, but the NoteDb change migration was not completed. See documentation:
https://gerrit-review.googlesource.com/Documentation/note-db.html#migration
    at com.google.gerrit.server.schema.NoteDbSchemaUpdater.checkNoteDbConfigFor216(NoteDbSchemaUpdater.java:128)
    at com.google.gerrit.server.schema.NoteDbSchemaUpdater.update(NoteDbSchemaUpdater.java:88)
    at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:353)
    at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:119)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:225)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:121)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:66)
    at Main.main(Main.java:28)

My config have

[noteDb "changes"]
    autoMigrate = true

What I'm missing ?


Solution

  • The "--migrate-to-note-db" option is available only in Gerrit 2.15.x and 2.16.x versions and not in 3.0.x one. Use it first in 2.16.x and after that upgrade to 3.0.x.