You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Zoltán Kornél Török (Jira)" <ji...@apache.org> on 2022/03/26 14:37:00 UTC
[jira] [Created] (NIFI-9836) Nifi registry db migration fails if database is postgresql
Zoltán Kornél Török created NIFI-9836:
-----------------------------------------
Summary: Nifi registry db migration fails if database is postgresql
Key: NIFI-9836
URL: https://issues.apache.org/jira/browse/NIFI-9836
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 1.16.0
Reporter: Zoltán Kornél Török
There was an H2 upgrade - https://github.com/apache/nifi/commit/bcc8d03314889e7d2d0724390059d0315efe2a34
In this pr the following if is refactored: https://github.com/apache/nifi/blob/main/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayConfiguration.java#L64
However the
{code}
databaseType.equals(new PostgreSQLDatabaseType())
{code}
will not work, because flyway DatabaseType classes doesn’t implement a proper equals method: https://github.com/flyway/flyway/blob/master/flyway-core/src/main/java/org/flywaydb/core/internal/database/postgresql/PostgreSQLDatabaseType.java#L36
Because of this if the user not use the default database, then not the proper migration locations will be used.
{code}
2022-03-26 12:28:14,593 INFO org.apache.nifi.registry.db.CustomFlywayConfiguration: Determined database type is PostgreSQL
2022-03-26 12:28:14,593 INFO org.apache.nifi.registry.db.CustomFlywayConfiguration: Setting migration locations to [classpath:db/migration/common, classpath:db/migration/default]
2022-03-26 12:28:14,616 INFO org.apache.nifi.registry.db.CustomFlywayConfiguration: Using default Flyway configuration table
..
..
led; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V6__AddFlowPersistence.sql failed
-------------------------------------------
SQL State : 42704
Error Code : 0
Message : ERROR: type "blob" does not exist
Position: 951
Location : db/migration/default/V6__AddFlowPersistence.sql
Line : 16
Statement : -- 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.
CREATE TABLE FLOW_PERSISTENCE_PROVIDER (
BUCKET_ID VARCHAR(50) NOT NULL,
FLOW_ID VARCHAR(50) NOT NULL,
VERSION INT NOT NULL,
FLOW_CONTENT BLOB NOT NULL,
CONSTRAINT PK__FLOW_PERSISTENCE_PROVIDER PRIMARY KEY (BUCKET_ID, FLOW_ID, VERSION)
)
..
..
{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)