Can not connect to database (Postgresql)

117 views
Skip to first unread message

Dima Kryug

unread,
Nov 14, 2018, 6:44:35 AM11/14/18
to Repo and Gerrit Discussion
  I trying run gerrit (v.2.15.6) within docker container and trying to connect my local DB (Postgresql v.10) 
with command :

Enter code here.

docker run
--name gerrit \
 
--net=host  -p 8081:8081 \
 
-p 29418:29418 \
 
-e WEBURL=http:173.xxx.xxx.xxx:8081 \
 
-e DATABASE_TYPE=postgresql \
 
-e DATABASE_DATABASE=reviewdb \
 
-e DATABASE_HOSTNAME=127.0.0.1 \
 
-e DATABASE_PORT=5432 \
 
-e DATABASE_USERNAME=gerrit2 \
 
-e DATABASE_PASSWORD=gerrit \
 
-d gerritopenfrontier/gerrit

and it returns : 

Enter code here...[main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /var/gerrit/review_site/etc/gerrit.config; assuming defaults
Generating SSH host key ... rsa... dsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done
Initialized /var/gerrit/review_site

/gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/*

Waiting for database connection 127.0.0.1:5432 ...
Upgrading gerrit...
Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot downgrade database schema from version 169 to 161.
at com.google.gerrit.server.schema.SchemaVersion.check(SchemaVersion.java:76)
at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:118)
at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:389)
at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:146)
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:223)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:119)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63)
at Main.main(Main.java:24)


  So I already faced almost the same issue but with MySQL DB when I was trying to upgrade gerrit from v.2.8.3 to 2.15.5 saw the same issue with DB schema.
It's hard to tell that time I just randomly choose gerrit v.2.10.7 and db schema conflict expired.
This time I think I'am not so lucky, as I understand 2.15.6 latest stable release.
What should I do to run gerrit properly according current Postgres DB schema ?
Thank your in advance.

Gert van Dijk

unread,
Nov 14, 2018, 7:40:43 AM11/14/18
to Repo and Gerrit Discussion
On Wednesday, 14 November 2018 12:44:35 UTC+1, Dima Kryug wrote:
  I trying run gerrit (v.2.15.6) within docker container and trying to connect my local DB (Postgresql v.10) 
with command : <snip>
com.google.gwtorm.server.OrmException: Cannot downgrade database schema from version 169 to 161.
<snip>

Your database schema seems to have been upgraded to version 169 already (Gerrit 2.16.x) and you're attempting a downgrade here, which is not supported.

HTH

dmitry...@lge.com

unread,
Nov 14, 2018, 8:13:35 AM11/14/18
to Repo and Gerrit Discussion

 Hello!
I have some issue with Mysql DB actually my case is just the opposite :  "Cannot upgrade schema"
I run gerrit v.2.15.6 within docker container and this is my error log :

Waiting for database connection localhost:3306 ...
Upgrading gerrit...
Wed Nov 14 13:06:44 GMT 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Wed Nov 14 13:06:45 GMT 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Upgrading schema to 107 ...
Upgrading schema to 108 ...
Upgrading schema to 109 ...
Upgrading schema to 110 ...
Upgrading schema to 111 ...
Upgrading schema to 112 ...
Upgrading schema to 113 ...
Upgrading schema to 114 ...
Upgrading schema to 115 ...
Upgrading schema to 116 ...
Upgrading schema to 117 ...
Upgrading schema to 118 ...
Upgrading schema to 119 ...
Upgrading schema to 120 ...
Upgrading schema to 121 ...
Upgrading schema to 122 ...
Upgrading schema to 123 ...
Upgrading schema to 124 ...
Upgrading schema to 125 ...
Upgrading schema to 126 ...
Upgrading schema to 127 ...
Upgrading schema to 128 ...
Upgrading schema to 129 ...
Upgrading schema to 130 ...
Upgrading schema to 131 ...
Upgrading schema to 132 ...
Upgrading schema to 133 ...
Upgrading schema to 134 ...
Upgrading schema to 135 ...
Upgrading schema to 136 ...
Upgrading schema to 137 ...
Upgrading schema to 138 ...
Upgrading schema to 139 ...
Upgrading schema to 140 ...
Upgrading schema to 141 ...
Upgrading schema to 142 ...
Upgrading schema to 143 ...
Upgrading schema to 144 ...
Upgrading schema to 145 ...
Upgrading schema to 146 ...
Upgrading schema to 147 ...
Upgrading schema to 148 ...
Upgrading schema to 149 ...
Upgrading schema to 150 ...
Upgrading schema to 151 ...
Upgrading schema to 152 ...
Upgrading schema to 153 ...
Upgrading schema to 154 ...
Upgrading schema to 155 ...
Upgrading schema to 156 ...
Upgrading schema to 157 ...
Upgrading schema to 158 ...
Upgrading schema to 159 ...
Upgrading schema to 160 ...
Upgrading schema to 161 ...
Migrating data to schema 107 ...
Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot upgrade schema
at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:120)
at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:389)
at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:146)
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:223)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:119)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63)
at Main.main(Main.java:24)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'mute_common_path_prefixes' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2490)
at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1552)
at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2607)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1480)
at com.google.gerrit.server.schema.Schema_107.migrateData(Schema_107.java:34)
at com.google.gerrit.server.schema.SchemaVersion.migrateData(SchemaVersion.java:153)
at com.google.gerrit.server.schema.SchemaVersion.upgradeFrom(SchemaVersion.java:92)
at com.google.gerrit.server.schema.SchemaVersion.check(SchemaVersion.java:83)
at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:118)
... 11 more

How can I fix it ?

Thanks.

Gert van Dijk

unread,
Nov 14, 2018, 8:35:52 AM11/14/18
to Repo and Gerrit Discussion
On Wednesday, 14 November 2018 14:13:35 UTC+1, dmitry...@lge.com wrote:
On Wednesday, November 14, 2018 at 3:40:43 PM UTC+3, Gert van Dijk wrote:
On Wednesday, 14 November 2018 12:44:35 UTC+1, Dima Kryug wrote:
  I trying run gerrit (v.2.15.6) within docker container and trying to connect my local DB (Postgresql v.10) 
with command : <snip>
com.google.gwtorm.server.OrmException: Cannot downgrade database schema from version 169 to 161.
<snip>

Your database schema seems to have been upgraded to version 169 already (Gerrit 2.16.x) and you're attempting a downgrade here, which is not supported.

HTH

 Hello!
I have some issue with Mysql DB actually my case is [...]

Well, fist of all, please don't hijack the current thread about another (unrelated) migration issue.

Your issue happens on really old migration code (schema 107, 2.11.x), so you seem to be upgrading from a very old (<= 2.10) system directly to 2.15.x. Please open your own thread or bug report, but before you do so, try upgrading from latest-minor-in-next-major to latest-minor-in-next-next-major release, following each of the release notes pages.

dmitry...@lge.com

unread,
Nov 14, 2018, 9:20:05 AM11/14/18
to Repo and Gerrit Discussion


среда, 14 ноября 2018 г., 16:35:52 UTC+3 пользователь Gert van Dijk написал:

Excuse me for interruption.
You right, I was upgrading from 2.8.3 --> 2.10.7 and now from 2.10.7 --> 2.16.5 I get DB related error.
So, this way I should upgrade gerrti step by step according to db schema changes ?
Am I understood correctly ?
 
Reply all
Reply to author
Forward
0 new messages