Installer database upgrade script (install -d) scans every RRD directory, bombs with "too many open files"
Description
Attempting to upgrade from 1.9.92 snapshot to 1.9.94 snapshot, and install -d bombed with this error:
Running migration for changelog: URL [jar:file:/opt/opennms/lib/org.opennms.core.schema-1.9.94-SNAPSHOT-liquibase.jar!/changelog.xml] Exception in thread "main" org.opennms.core.schema.MigrationException: unable to migrate the database at org.opennms.core.schema.Migrator.migrate(Migrator.java:473) at org.opennms.install.Installer.install(Installer.java:255) at org.opennms.install.Installer.main(Installer.java:950) Caused by: org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:150) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:393) at org.postgresql.Driver.connect(Driver.java:267) at java.sql.DriverManager.getConnection(DriverManager.java:579) at java.sql.DriverManager.getConnection(DriverManager.java:190) at org.opennms.netmgt.dao.db.SimpleDataSource.getConnection(SimpleDataSource.java:90) at org.opennms.core.schema.Migrator.migrate(Migrator.java:458) ... 2 more Caused by: java.net.SocketException: Too many open files at java.net.Socket.createImpl(Socket.java:447) at java.net.Socket.<init>(Socket.java:421) at java.net.Socket.<init>(Socket.java:208) at org.postgresql.core.PGStream.<init>(PGStream.java:62) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76) ... 12 more
I've committed a change to try upping ulimit before the actual install runs.
Benjamin Reed November 6, 2014 at 12:46 PM
Liquibase is configured to look for changelog.xml anywhere in the classpath because we made it so that "plugins" can do database configuration (ie, the NCS plugin has its own liquibase changelog.xml that adds NCS-specific tables).
For some reason, spring's classpath-scanning is not just scanning the top of each classpath entry, but each sub-directory of them.
David Hustace November 6, 2014 at 11:38 AM
Why does -d cause scan of every RRD directory?
Seth Leger November 6, 2014 at 10:59 AM
This is probably still an open issue. I'm not sure if liquibase has been updated since my last comment.
Attempting to upgrade from 1.9.92 snapshot to 1.9.94 snapshot, and install -d bombed with this error:
Running migration for changelog: URL [jar:file:/opt/opennms/lib/org.opennms.core.schema-1.9.94-SNAPSHOT-liquibase.jar!/changelog.xml]
Exception in thread "main" org.opennms.core.schema.MigrationException: unable to migrate the database
at org.opennms.core.schema.Migrator.migrate(Migrator.java:473)
at org.opennms.install.Installer.install(Installer.java:255)
at org.opennms.install.Installer.main(Installer.java:950)
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:150)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:393)
at org.postgresql.Driver.connect(Driver.java:267)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:190)
at org.opennms.netmgt.dao.db.SimpleDataSource.getConnection(SimpleDataSource.java:90)
at org.opennms.core.schema.Migrator.migrate(Migrator.java:458)
... 2 more
Caused by: java.net.SocketException: Too many open files
at java.net.Socket.createImpl(Socket.java:447)
at java.net.Socket.<init>(Socket.java:421)
at java.net.Socket.<init>(Socket.java:208)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76)
... 12 more