How to create the H2 database for the events-log plugin?

514 views
Skip to first unread message

Benoit Sigoure

unread,
Jul 12, 2017, 5:55:13 PM7/12/17
to Repo and Gerrit Discussion, Hugo Arès
Hi there,
I’m trying to deploy the events-log plugin, so I just downloaded https://gerrit-ci.gerritforge.com/job/plugin-events-log-bazel-master-stable-2.14/lastSuccessfulBuild/artifact/bazel-genfiles/plugins/events-log/events-log.jar in the plugins directory, and added the following to gerrit.config:

[plugin "events-log"]
        storeUrl = jdbc:h2:~/gerrit/events-log/

I created the directory and restarted Gerrit.  After restarting Gerrit I still see the plugin complain and the directory remains empty (I expected to see some H2 databases show up in there).

[2017-07-12 14:14:25,409] [main] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.14.1 ready
[2017-07-12 14:14:26,008] [Store events-1] ERROR com.ericsson.gerrit.plugins.eventslog.sql.SQLStore : Problem checking database connection
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Invalid database name: "~/gerrit/events-log/" [90138-176])
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at com.ericsson.gerrit.plugins.eventslog.sql.SQLClient.execute(SQLClient.java:253)
        at com.ericsson.gerrit.plugins.eventslog.sql.SQLClient.queryOne(SQLClient.java:212)
        at com.ericsson.gerrit.plugins.eventslog.sql.SQLStore$CheckConnectionTask.checkConnection(SQLStore.java:279)
        at com.ericsson.gerrit.plugins.eventslog.sql.SQLStore$CheckConnectionTask.run(SQLStore.java:265)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:418)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.h2.jdbc.JdbcSQLException: Invalid database name: "~/gerrit/events-log/" [90138-176]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
        at org.h2.message.DbException.get(DbException.java:178)
        at org.h2.message.DbException.get(DbException.java:154)
        at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:408)
        at org.h2.engine.Engine.openSession(Engine.java:42)
        at org.h2.engine.Engine.openSession(Engine.java:164)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:142)
        at org.h2.engine.Engine.createSession(Engine.java:125)
        at org.h2.engine.Engine.createSession(Engine.java:27)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:331)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
        at org.h2.Driver.connect(Driver.java:74)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
        ... 14 more

I haven’t found anything online or in the ML archives as far as what specific steps need to be taken to initialize the plugin properly.  Can anybody steer me in the right direction?

--
Benoit "tsuna" Sigoure

Saša Živkov

unread,
Jul 13, 2017, 4:22:16 AM7/13/17
to Benoit Sigoure, Repo and Gerrit Discussion, Hugo Arès
Just a few guesses... 

On Wed, Jul 12, 2017 at 11:54 PM, Benoit Sigoure <tsun...@gmail.com> wrote:
Hi there,
I’m trying to deploy the events-log plugin, so I just downloaded https://gerrit-ci.gerritforge.com/job/plugin-events-log-bazel-master-stable-2.14/lastSuccessfulBuild/artifact/bazel-genfiles/plugins/events-log/events-log.jar in the plugins directory, and added the following to gerrit.config:

[plugin "events-log"]
        storeUrl = jdbc:h2:~/gerrit/events-log/
Have you tried without that trailing slash? 

I created the directory and restarted Gerrit.

and without creating the events-log directory. I expect that H2 will create events-log database inside ~/gerrit directory.
I would just make sure that ~/gerrit directory exists.

Another thing to try is to add :file to the URL:
jdbc:h2:file:~/gerrit/events-log/

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benoit Sigoure

unread,
Jul 13, 2017, 4:25:10 AM7/13/17
to Saša Živkov, Hugo Arès, Repo and Gerrit Discussion
I'll try, thanks. Is there a way to tell gerrit to reload gerrit.config?

--
Sent from my Android phone
   

Saša Živkov

unread,
Jul 13, 2017, 5:05:27 AM7/13/17
to Benoit Sigoure, repo-d...@googlegroups.com, Hugo Ares


On Jul 13, 2017 10:25 AM, "Benoit Sigoure" <tsun...@gmail.com> wrote:
I'll try, thanks. Is there a way to tell gerrit to reload gerrit.config?
No.

Björn Pedersen

unread,
Jul 13, 2017, 7:23:35 AM7/13/17
to Repo and Gerrit Discussion, tsun...@gmail.com, hugo...@ericsson.com
Hi,

for events log you need to specifiy the full url to the db.

I have:
storeUrl = jdbc:h2:/usr/src/tmp/gerrittest/db/Events

Which creates a h" database named "Events" in /usr/src/tmp/gerrittest/db.

I had problems with the  ~ expansion not working, so try to give the full path.

Björn
Just a few guesses... 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages