diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml index b4e5a1d6db..aac7d5ec5f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml @@ -182,7 +182,7 @@ org.questdb questdb - 6.7-jdk8 + 7.2 org.apache.nifi diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbContext.java index ef28eec2cf..f79231c279 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbContext.java @@ -20,7 +20,6 @@ import io.questdb.cairo.CairoConfiguration; import io.questdb.cairo.CairoEngine; import io.questdb.griffin.SqlCompiler; import io.questdb.griffin.SqlExecutionContext; -import io.questdb.griffin.SqlExecutionContextImpl; public class QuestDbContext { private final CairoEngine engine; @@ -38,7 +37,7 @@ public class QuestDbContext { } public SqlExecutionContext getSqlExecutionContext() { - return new SqlExecutionContextImpl(engine, 1); + return SqlExecutionContextFactory.getInstance(engine); } public SqlCompiler getCompiler() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbDatabaseManager.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbDatabaseManager.java index 420904328f..492bf947d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbDatabaseManager.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbDatabaseManager.java @@ -21,11 +21,6 @@ import io.questdb.cairo.CairoEngine; import io.questdb.cairo.DefaultCairoConfiguration; import io.questdb.griffin.SqlCompiler; import io.questdb.griffin.SqlExecutionContext; -import io.questdb.griffin.SqlExecutionContextImpl; -import org.apache.nifi.util.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.nio.file.Path; import java.util.Arrays; @@ -33,6 +28,9 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import org.apache.nifi.util.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The database manager is responsible for checking and maintaining the health of the database during startup. @@ -149,7 +147,7 @@ public final class QuestDbDatabaseManager { final CairoEngine engine = new CairoEngine(configuration); final SqlCompiler compiler = new SqlCompiler(engine) ) { - final SqlExecutionContext context = new SqlExecutionContextImpl(engine, 1); + final SqlExecutionContext context = SqlExecutionContextFactory.getInstance(engine); // Node status tables compiler.compile(QuestDbQueries.CREATE_GARBAGE_COLLECTION_STATUS, context); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbWritingTemplate.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbWritingTemplate.java index db01d7f38a..e93d24bcb9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbWritingTemplate.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbWritingTemplate.java @@ -54,7 +54,7 @@ public abstract class QuestDbWritingTemplate { } try ( - final TableWriter tableWriter = engine.getWriter(context.getCairoSecurityContext(), engine.getTableToken(tableName), "adding rows") + final TableWriter tableWriter = engine.getWriter(engine.getTableTokenIfExists(tableName), "adding rows") ) { addRows(tableWriter, entries); tableWriter.commit(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/SqlExecutionContextFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/SqlExecutionContextFactory.java new file mode 100644 index 0000000000..5ac6c19d1a --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/SqlExecutionContextFactory.java @@ -0,0 +1,32 @@ +/* + * 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.controller.status.history.questdb; + +import io.questdb.cairo.CairoEngine; +import io.questdb.cairo.security.AllowAllSecurityContext; +import io.questdb.griffin.SqlExecutionContext; +import io.questdb.griffin.SqlExecutionContextImpl; + +final class SqlExecutionContextFactory { + private SqlExecutionContextFactory() { + // Not to be instantiated + } + + public static SqlExecutionContext getInstance(final CairoEngine engine) { + return new SqlExecutionContextImpl(engine, 1).with(AllowAllSecurityContext.INSTANCE, null); + } +}