You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2023/03/07 15:36:35 UTC

[nifi] branch main updated: NIFI-11253 Removed H2 1.4 database migration modules

This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new d3908dede8 NIFI-11253 Removed H2 1.4 database migration modules
d3908dede8 is described below

commit d3908dede8ab308923e19ea211e9760911142c00
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Mon Mar 6 10:19:38 2023 -0600

    NIFI-11253 Removed H2 1.4 database migration modules
    
    Signed-off-by: Matthew Burgess <ma...@apache.org>
    
    This closes #7014
---
 nifi-dependency-check-maven/suppressions.xml       |   5 -
 nifi-h2/nifi-h2-database-migrator/pom.xml          |  37 -------
 .../h2/database/migration/H2DatabaseMigrator.java  | 107 ---------------------
 .../h2/database/migration/H2DatabaseUpdater.java   |  87 -----------------
 .../database/migration/TestH2DatabaseUpdater.java  |  81 ----------------
 .../src/test/resources/nifi-flow-audit.mv.db       | Bin 20480 -> 0 bytes
 nifi-h2/nifi-h2-database/pom.xml                   | 107 ---------------------
 nifi-h2/pom.xml                                    |  30 ------
 .../nifi-framework/nifi-administration/pom.xml     |   5 -
 .../nifi/admin/AuditDataSourceFactoryBean.java     |   7 +-
 .../nifi/admin/IdpDataSourceFactoryBean.java       |   7 +-
 .../src/main/asciidoc/administration-guide.adoc    |   2 +-
 .../nifi-registry-framework/pom.xml                |   5 -
 .../apache/nifi/registry/db/DataSourceFactory.java |  19 ----
 pom.xml                                            |   1 -
 15 files changed, 3 insertions(+), 497 deletions(-)

diff --git a/nifi-dependency-check-maven/suppressions.xml b/nifi-dependency-check-maven/suppressions.xml
index fd17ad5457..d017e30e40 100644
--- a/nifi-dependency-check-maven/suppressions.xml
+++ b/nifi-dependency-check-maven/suppressions.xml
@@ -24,11 +24,6 @@
         <packageUrl regex="true">^pkg:maven/org\.mortbay\.jetty/jetty\-sslengine@.*$</packageUrl>
         <cpe regex="true">^cpe:.*$</cpe>
     </suppress>
-    <suppress>
-        <notes>H2 1.4.200 is shaded and repackaged without vulnerable components in nifi-h2-database for migration</notes>
-        <packageUrl>pkg:maven/com.h2database/h2@1.4.200</packageUrl>
-        <vulnerabilityName regex="true">^CVE.*$</vulnerabilityName>
-    </suppress>
     <suppress>
         <notes>CVE-2022-45868 requires running H2 from a command not applicable to project references</notes>
         <packageUrl regex="true">^pkg:maven/com\.h2database/h2@2.*$</packageUrl>
diff --git a/nifi-h2/nifi-h2-database-migrator/pom.xml b/nifi-h2/nifi-h2-database-migrator/pom.xml
deleted file mode 100644
index 772d5cc086..0000000000
--- a/nifi-h2/nifi-h2-database-migrator/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-      http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.nifi</groupId>
-        <artifactId>nifi-h2</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-    <artifactId>nifi-h2-database-migrator</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>${h2.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.nifi</groupId>
-            <artifactId>nifi-h2-database</artifactId>
-            <version>2.0.0-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseMigrator.java b/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseMigrator.java
deleted file mode 100644
index e8e255ecee..0000000000
--- a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseMigrator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.h2.database.migration;
-
-import org.apache.nifi.org.h2.jdbcx.JdbcDataSource;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import static org.apache.nifi.h2.database.migration.H2DatabaseUpdater.EXPORT_FILE_POSTFIX;
-import static org.apache.nifi.h2.database.migration.H2DatabaseUpdater.EXPORT_FILE_PREFIX;
-
-public class H2DatabaseMigrator {
-    public static final String BACKUP_FILE_POSTFIX = ".migration_backup";
-
-    public static void exportAndBackup(final String dbUrl, final String dbPath, final String user, final String pass) {
-
-        // Attempt to connect with the latest driver
-        JdbcDataSource migrationDataSource = new JdbcDataSource();
-        migrationDataSource.setURL(dbUrl);
-        migrationDataSource.setUser(user);
-        migrationDataSource.setPassword(pass);
-
-        final File dbPathFile = Paths.get(dbPath).toFile();
-
-        String exportFile = Paths.get(dbPathFile.getParent(), EXPORT_FILE_PREFIX + dbPathFile.getName() + EXPORT_FILE_POSTFIX).toString();
-
-        Connection conn;
-        Statement s;
-        try {
-            conn = migrationDataSource.getConnection();
-            s = conn.createStatement();
-        } catch (SQLException sqle) {
-            final String message = String.format("H2 1.4 connection failed URL [%s] Path [%s] SQL State [%s]", dbUrl, dbPath, sqle.getSQLState());
-            throw new RuntimeException(message, sqle);
-        }
-
-        try {
-            // Perform an export of the database to SQL statements
-            s.execute("SCRIPT TO '" + exportFile + "'");
-        } catch (SQLException sqle) {
-            try {
-                s.close();
-            } catch (SQLException se2) {
-                // Ignore, the error will be handled
-            }
-            final String message = String.format("H2 1.4 export failed URL [%s] Path [%s] SQL State [%s]", dbUrl, dbPath, sqle.getSQLState());
-            throw new RuntimeException(message, sqle);
-        }
-
-        closeQuietly(s);
-        closeQuietly(conn);
-
-        // Verify the export file exists
-        if (!Files.exists(Paths.get(exportFile))) {
-            throw new RuntimeException(String.format("H2 1.4 export failed URL [%s] Path [%s] Export File not found [%s]", dbUrl, dbPath, exportFile));
-        }
-
-        // Now that the export file exists, backup (rename) the DB files so the main process with the newer H2 driver can create and import the previous database
-        File dbDir = new File(dbPath).getParentFile();
-        File[] dbFiles = dbDir.listFiles((dir, name) -> !name.endsWith(EXPORT_FILE_POSTFIX) && name.startsWith(dbPathFile.getName()));
-        if (dbFiles == null || dbFiles.length == 0) {
-            throw new RuntimeException(String.format("H2 1.4 backup failed URL [%s] Path [%s] no database files found", dbUrl, dbPath));
-        }
-
-        for (File dbFile : dbFiles) {
-            File dbBackupFile = new File(dbFile.getAbsolutePath() + BACKUP_FILE_POSTFIX);
-            if (!dbFile.renameTo(dbBackupFile)) {
-                throw new RuntimeException(String.format("H2 1.4 backup failed URL [%s] Path [%s] rename failed [%s]", dbUrl, dbPath, dbFile));
-            }
-        }
-    }
-
-    private static void closeQuietly(final Statement statement) {
-        try {
-            statement.close();
-        } catch (final SQLException e) {
-            // Ignore, nothing to be done
-        }
-    }
-
-    private static void closeQuietly(final Connection connection) {
-        try {
-            connection.close();
-        } catch (final SQLException e) {
-            // Ignore, nothing to be done
-        }
-    }
-}
diff --git a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java b/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java
deleted file mode 100644
index 7a5109214b..0000000000
--- a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.h2.database.migration;
-
-import org.h2.jdbcx.JdbcDataSource;
-import org.h2.mvstore.MVStoreException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.SQLNonTransientException;
-import java.sql.Statement;
-
-public class H2DatabaseUpdater {
-
-    private static final Logger logger = LoggerFactory.getLogger(H2DatabaseUpdater.class);
-
-    public static final String EXPORT_FILE_PREFIX = "export_";
-    public static final String EXPORT_FILE_POSTFIX = ".sql";
-    public static final String H2_URL_PREFIX = "jdbc:h2:";
-
-    public static void checkAndPerformMigration(final String dbPathNoExtension, final String dbUrl, final String user, final String pass) throws Exception {
-
-        final JdbcDataSource migrationDataSource = new JdbcDataSource();
-
-        // Attempt to connect with the latest driver
-        migrationDataSource.setURL(dbUrl);
-        migrationDataSource.setUser(user);
-        migrationDataSource.setPassword(pass);
-        try (Connection connection = migrationDataSource.getConnection()) {
-            return;
-        } catch (SQLNonTransientException e) {
-            // Migration/version issues will be caused by an MVStoreException
-            final Throwable exceptionCause = e.getCause();
-            if (exceptionCause instanceof MVStoreException) {
-                // Check for specific error message
-                final String errorMessage = exceptionCause.getMessage();
-                if (!errorMessage.contains("The write format")
-                        && !errorMessage.contains("is smaller than the supported format")) {
-                    throw e;
-                }
-            } else {
-                throw e;
-            }
-        } catch (SQLException sqle) {
-            throw new RuntimeException(String.format("H2 connection failed URL [%s] File [%s]", dbUrl, dbPathNoExtension), sqle);
-        }
-        // At this point it is known that migration should be attempted
-        logger.info("H2 1.4 database detected [{}]: starting migration to H2 2.1", dbPathNoExtension);
-        H2DatabaseMigrator.exportAndBackup(dbUrl, dbPathNoExtension, user, pass);
-
-        // The export file has been created and the DB has been backed up, now create a new one with the same name and run the SQL script to import the database
-        try (Connection migrationConnection = migrationDataSource.getConnection();
-             Statement s = migrationConnection.createStatement()) {
-            final Path dbFilePath = Paths.get(dbPathNoExtension);
-            final String dbDirectory = dbFilePath.getParent().toFile().getAbsolutePath();
-            // use RUNSCRIPT to recreate the database
-            final String exportSqlLocation = dbDirectory + File.separator
-                    + H2DatabaseUpdater.EXPORT_FILE_PREFIX + dbFilePath.toFile().getName() + H2DatabaseUpdater.EXPORT_FILE_POSTFIX;
-            s.execute("RUNSCRIPT FROM '" + exportSqlLocation + "'");
-
-        } catch (SQLException sqle) {
-            throw new IOException(String.format("H2 import database creation failed URL [%s]", dbUrl), sqle);
-        }
-
-        logger.info("H2 1.4 to 2.1 migration completed [{}]", dbPathNoExtension);
-    }
-}
diff --git a/nifi-h2/nifi-h2-database-migrator/src/test/java/org/apache/nifi/h2/database/migration/TestH2DatabaseUpdater.java b/nifi-h2/nifi-h2-database-migrator/src/test/java/org/apache/nifi/h2/database/migration/TestH2DatabaseUpdater.java
deleted file mode 100644
index 9493394907..0000000000
--- a/nifi-h2/nifi-h2-database-migrator/src/test/java/org/apache/nifi/h2/database/migration/TestH2DatabaseUpdater.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.h2.database.migration;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-public class TestH2DatabaseUpdater {
-
-    public static final String DB_NAME = "nifi-flow-audit";
-    public static final String MVDB_EXTENSION = ".mv.db";
-    public static final String ORIGINAL_AUDIT_DB_PATH = "./src/test/resources/" + DB_NAME;
-    public static final String ORIGINAL_AUDIT_DB_PATH_FILE = ORIGINAL_AUDIT_DB_PATH + MVDB_EXTENSION;
-
-    @TempDir
-    File tmpDir;
-
-    @BeforeEach
-    public void copyDatabaseFile() throws IOException {
-        // Copy the legacy database file to a temporary directory
-        final Path origAuditDbPath = Paths.get(ORIGINAL_AUDIT_DB_PATH_FILE);
-        final Path destAuditDbPath = Paths.get(tmpDir.getAbsolutePath(), DB_NAME + MVDB_EXTENSION);
-        Files.copy(origAuditDbPath, destAuditDbPath, REPLACE_EXISTING);
-    }
-
-    @Test
-    public void testMigration() throws Exception {
-        final Path testAuditDbPath = Paths.get(tmpDir.getAbsolutePath(), DB_NAME);
-        final File dbFileNoExtension = testAuditDbPath.toFile();
-        final String migrationDbUrl = H2DatabaseUpdater.H2_URL_PREFIX + dbFileNoExtension + ";LOCK_MODE=3";
-
-        H2DatabaseUpdater.checkAndPerformMigration(dbFileNoExtension.getAbsolutePath(), migrationDbUrl, "nf", "nf");
-
-        // Verify the export, backup, and new database files were created
-        final File exportFile = Paths.get(dbFileNoExtension.getParent(), H2DatabaseUpdater.EXPORT_FILE_PREFIX + dbFileNoExtension.getName() + H2DatabaseUpdater.EXPORT_FILE_POSTFIX).toFile();
-        assertTrue(exportFile.exists());
-
-        File dbDir = dbFileNoExtension.getParentFile();
-        File[] backupFiles = dbDir.listFiles((dir, name) -> name.endsWith(H2DatabaseMigrator.BACKUP_FILE_POSTFIX) && name.startsWith(dbFileNoExtension.getName()));
-        try {
-            assertNotNull(backupFiles);
-
-            // The database and its trace file should exist after the initial connection is made, so they both should be backed up
-            assertEquals(2, backupFiles.length);
-            final File newDbFile = Paths.get(tmpDir.getAbsolutePath(), DB_NAME + MVDB_EXTENSION).toFile();
-            assertTrue(newDbFile.exists());
-        } finally {
-            // Remove the export and backup files
-            exportFile.delete();
-            for (File f : backupFiles) {
-                f.delete();
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/nifi-h2/nifi-h2-database-migrator/src/test/resources/nifi-flow-audit.mv.db b/nifi-h2/nifi-h2-database-migrator/src/test/resources/nifi-flow-audit.mv.db
deleted file mode 100644
index 2a3735e0eb..0000000000
Binary files a/nifi-h2/nifi-h2-database-migrator/src/test/resources/nifi-flow-audit.mv.db and /dev/null differ
diff --git a/nifi-h2/nifi-h2-database/pom.xml b/nifi-h2/nifi-h2-database/pom.xml
deleted file mode 100644
index 8ddfa2c8bc..0000000000
--- a/nifi-h2/nifi-h2-database/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
-    license agreements. See the NOTICE file distributed with this work for additional
-    information regarding copyright ownership. The ASF licenses this file to
-    You under the Apache License, Version 2.0 (the "License"); you may not use
-    this file except in compliance with the License. You may obtain a copy of
-    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
-    by applicable law or agreed to in writing, software distributed under the
-    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-    OF ANY KIND, either express or implied. See the License for the specific
-    language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.nifi</groupId>
-        <artifactId>nifi-h2</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>nifi-h2-database</artifactId>
-    <packaging>jar</packaging>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>1.4.200</version>
-            <optional>true</optional>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>3.3.0</version>
-                <executions>
-                    <execution>
-                        <id>default-jar</id>
-                        <phase>compile</phase>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-shade-plugin</artifactId>
-                <version>3.4.1</version>
-                <executions>
-                    <execution>
-                        <phase>compile</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <createDependencyReducedPom>false</createDependencyReducedPom>
-                            <filters>
-                                <filter>
-                                    <artifact>com.h2database:h2</artifact>
-                                    <excludes>
-                                        <exclude>org/h2/fulltext/**</exclude>
-                                        <exclude>org/h2/jdbc/JdbcSQLXML.class</exclude>
-                                        <exclude>org/h2/jmx/**</exclude>
-                                        <exclude>org/h2/server/**</exclude>
-                                    </excludes>
-                                </filter>
-                            </filters>
-                            <relocations>
-                                <relocation>
-                                    <pattern>org.h2</pattern>
-                                    <shadedPattern>org.apache.nifi.org.h2</shadedPattern>
-                                </relocation>
-                            </relocations>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <version>3.0.0</version>
-                <executions>
-                    <execution>
-                        <id>attach-shade-jar</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>${basedir}/target/${project.build.finalName}.jar</file>
-                                    <type>jar</type>
-                                    <classifier>shaded</classifier>
-                                </artifact>
-                            </artifacts>
-                            <skipAttach>true</skipAttach>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
\ No newline at end of file
diff --git a/nifi-h2/pom.xml b/nifi-h2/pom.xml
deleted file mode 100644
index 430c27371a..0000000000
--- a/nifi-h2/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements. See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License. You may obtain a copy of the License at
-  http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.nifi</groupId>
-        <artifactId>nifi</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>nifi-h2</artifactId>
-    <packaging>pom</packaging>
-    <modules>
-        <module>nifi-h2-database</module>
-        <module>nifi-h2-database-migrator</module>
-    </modules>
-</project>
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml
index 45a87158c7..69a01c6f2c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml
@@ -58,11 +58,6 @@
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.nifi</groupId>
-            <artifactId>nifi-h2-database-migrator</artifactId>
-            <version>2.0.0-SNAPSHOT</version>
-        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-beans</artifactId>
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/AuditDataSourceFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/AuditDataSourceFactoryBean.java
index 11d7c30e64..22165d2b68 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/AuditDataSourceFactoryBean.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/AuditDataSourceFactoryBean.java
@@ -17,7 +17,6 @@
 package org.apache.nifi.admin;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.h2.database.migration.H2DatabaseUpdater;
 import org.apache.nifi.util.NiFiProperties;
 import org.h2.jdbcx.JdbcConnectionPool;
 import org.slf4j.Logger;
@@ -131,16 +130,12 @@ public class AuditDataSourceFactoryBean implements FactoryBean {
             File dbFileNoExtension = new File(repositoryDirectory, AUDIT_DATABASE_FILE_NAME);
 
             // format the database url
-            String databaseUrl = H2DatabaseUpdater.H2_URL_PREFIX + dbFileNoExtension + ";AUTOCOMMIT=OFF;DB_CLOSE_ON_EXIT=FALSE;LOCK_MODE=3";
+            String databaseUrl = "jdbc:h2:" + dbFileNoExtension + ";AUTOCOMMIT=OFF;DB_CLOSE_ON_EXIT=FALSE;LOCK_MODE=3";
             String databaseUrlAppend = properties.getProperty(NiFiProperties.H2_URL_APPEND);
             if (StringUtils.isNotBlank(databaseUrlAppend)) {
                 databaseUrl += databaseUrlAppend;
             }
 
-            // Migrate an existing database if required
-            final String migrationDbUrl = H2DatabaseUpdater.H2_URL_PREFIX + dbFileNoExtension + ";LOCK_MODE=3";
-            H2DatabaseUpdater.checkAndPerformMigration(dbFileNoExtension.getAbsolutePath(), migrationDbUrl, NF_USERNAME_PASSWORD, NF_USERNAME_PASSWORD);
-
             // create the pool
             connectionPool = JdbcConnectionPool.create(databaseUrl, NF_USERNAME_PASSWORD, NF_USERNAME_PASSWORD);
             connectionPool.setMaxConnections(MAX_CONNECTIONS);
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/IdpDataSourceFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/IdpDataSourceFactoryBean.java
index 9a34561c2e..8ccf71873f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/IdpDataSourceFactoryBean.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/IdpDataSourceFactoryBean.java
@@ -17,7 +17,6 @@
 package org.apache.nifi.admin;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.h2.database.migration.H2DatabaseUpdater;
 import org.apache.nifi.util.NiFiProperties;
 import org.h2.jdbcx.JdbcConnectionPool;
 import org.slf4j.Logger;
@@ -77,10 +76,6 @@ public class IdpDataSourceFactoryBean implements FactoryBean<JdbcConnectionPool>
             File dbFileNoExtension = new File(repositoryDirectory, IDP_DATABASE_FILE_NAME);
             String databaseUrl = getDatabaseUrl(dbFileNoExtension);
 
-            // Migrate an existing database if required
-            final String migrationDbUrl = H2DatabaseUpdater.H2_URL_PREFIX + dbFileNoExtension + ";LOCK_MODE=3";
-            H2DatabaseUpdater.checkAndPerformMigration(dbFileNoExtension.getAbsolutePath(), migrationDbUrl, NF_USERNAME_PASSWORD, NF_USERNAME_PASSWORD);
-
             // create the pool
             connectionPool = JdbcConnectionPool.create(databaseUrl, NF_USERNAME_PASSWORD, NF_USERNAME_PASSWORD);
             connectionPool.setMaxConnections(MAX_CONNECTIONS);
@@ -118,7 +113,7 @@ public class IdpDataSourceFactoryBean implements FactoryBean<JdbcConnectionPool>
     }
 
     private String getDatabaseUrl(File databaseFile) {
-        String databaseUrl = H2DatabaseUpdater.H2_URL_PREFIX + databaseFile + ";AUTOCOMMIT=OFF;DB_CLOSE_ON_EXIT=FALSE;LOCK_MODE=3";
+        String databaseUrl = "jdbc:h2:" + databaseFile + ";AUTOCOMMIT=OFF;DB_CLOSE_ON_EXIT=FALSE;LOCK_MODE=3";
         String databaseUrlAppend = properties.getProperty(NiFiProperties.H2_URL_APPEND);
         if (StringUtils.isNotBlank(databaseUrlAppend)) {
             databaseUrl += databaseUrlAppend;
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
index 2d0baacab7..3878d4719d 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
+++ b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
@@ -1186,7 +1186,7 @@ For NiFi Registry 0.2.0 and forward, the location of the H2 database is specifie
 
 3. Connect to database
 
-  Welcome to H2 Shell 1.4.200 (2019-10-14)
+  Welcome to H2 Shell 2.1
   Exit with Ctrl+C
   URL       jdbc:h2:./database/nifi-registry-primary
   Driver    org.h2.Driver
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml
index 460fcbd5cf..2f23054adb 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml
@@ -206,11 +206,6 @@
             <artifactId>nifi-registry-flow-diff</artifactId>
             <version>2.0.0-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.nifi</groupId>
-            <artifactId>nifi-h2-database-migrator</artifactId>
-            <version>2.0.0-SNAPSHOT</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-security-ssl</artifactId>
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DataSourceFactory.java
index 41135e7c13..10b0ce9832 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DataSourceFactory.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DataSourceFactory.java
@@ -18,7 +18,6 @@ package org.apache.nifi.registry.db;
 
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.h2.database.migration.H2DatabaseUpdater;
 import org.apache.nifi.registry.properties.NiFiRegistryProperties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,7 +28,6 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 
 import javax.sql.DataSource;
-import java.io.File;
 
 /**
  * Overriding Spring Boot's normal automatic creation of a DataSource in order to use the properties
@@ -93,23 +91,6 @@ public class DataSourceFactory {
             ((HikariDataSource) dataSource).setMaximumPoolSize(properties.getDatabaseMaxConnections());
         }
 
-        // Migrate an H2 existing database if required
-        if (databaseUrl.startsWith(H2DatabaseUpdater.H2_URL_PREFIX)) {
-            final File databaseFile = getFileFromH2URL(databaseUrl);
-            final String migrationDbUrl = H2DatabaseUpdater.H2_URL_PREFIX + databaseFile + ";LOCK_MODE=3";
-
-            try {
-                H2DatabaseUpdater.checkAndPerformMigration(databaseFile.getAbsolutePath(), migrationDbUrl, databaseUsername, databasePassword);
-            } catch (Exception e) {
-                throw new RuntimeException("H2 database migration failed", e);
-            }
-        }
-
         return dataSource;
     }
-
-    private File getFileFromH2URL(final String databaseUrl) {
-        final String dbPath = databaseUrl.substring(H2DatabaseUpdater.H2_URL_PREFIX.length(), databaseUrl.indexOf(";"));
-        return new File(dbPath);
-    }
 }
diff --git a/pom.xml b/pom.xml
index 2fae67f0f4..561abe7074 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,6 @@
         <module>nifi-toolkit</module>
         <module>nifi-manifest</module>
         <module>c2</module>
-        <module>nifi-h2</module>
     </modules>
     <url>https://nifi.apache.org</url>
     <organization>